Open philpax opened 10 months ago
Thanks for creating this issue do you want to open a PR to fix the type hint?
Hi, sorry for the late response! Yes, I can take a look at it; should hopefully be a relatively straightforward fix.
Edit: I'm not currently working with diffusers, so I haven't been able to work on this fix. Free for anyone else to take it.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Thanks for reporting, I will do a type hint sprint soon and try taking this into account
Describe the bug
As far as I can tell, the type hint
callback_on_step_end
for all pipelines (as seen in this search) is incorrect.Taking the SDXL pipeline as an example, the type hint in
__call__
is:but it is called like this:
That is, the type hint suggests that it's a function with three arguments that returns nothing, but it's actually a function with four arguments that returns a
Dict
. This ends up failing at runtime. Using a four-argument function leads to type-checker errors.Reproduction
Using a Python typechecker (Pyright in my case), attempt to use a correctly-defined callback with a SDXL pipeline:
The type-checker will error on
callback_on_step_end
:This can be worked around using
# type: ignore
, which is what I'm doing.Logs
No response
System Info
N/A
Who can help?
No response