huggingface/diffusers

Any chance class members like self._interrupt could be defined in __init__ across pipelines?

Open

#11.002 aberto em 7 de mar. de 2025

Ver no GitHub
 (11 comments) (0 reactions) (0 assignees)Python (4.562 forks)batch import
bugcontributions-welcomehelp wantedstale

Métricas do repositório

Stars
 (22.190 stars)
Métricas de merge de PR
 (Mesclagem média 13d 1h) (96 fundiu PRs em 30d)

Description

Describe the bug

I think there is no benefit to late initializing here and it puts a burden on the library user that could be easily avoided. Also leads to some confusion as it is uncommon, code inspection flags this. Let me know if I'm missing something.

Reproduction

class WanImageToVideoPipeline:
	def __init__(self):
		pass
	
	def __call__(self, *args, **kwargs):
		self._interrupt = False
		return 23

	@property
	def interrupt(self):
		return self._interrupt
	
pipe = WanImageToVideoPipeline()

def on_async_user_abort_call_me_any_time():
	# check if already interrupted but mid step
	print(pipe.interrupt)


on_async_user_abort_call_me_any_time()

Logs

AttributeError: 'WanImageToVideoPipeline' object has no attribute '_interrupt'. Did you mean: 'interrupt'?

System Info

Diffusers 0.33.0.dev0, Linux, Python 3.10

Who can help?

@yiyixuxu @DN6

Guia do colaborador