-
Notifications
You must be signed in to change notification settings - Fork 2.7k
make step_callback work again in generate() call #2957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@Kyle0654 the signature of |
|
thanks, |
this depends on the small change in invoke-ai#2957
The signature changed when we did the |
this depends on the small change in invoke-ai#2957
This PR fixes #2951 and restores the step_callback argument in the refactored generate() method. Note that this issue states that "something is still wrong because steps and step are zero." However, I think this is confusion over the call signature of the callback, which since the diffusers merge has been `callback(state:PipelineIntermediateState)` This is the test script that I used to determine that `step` is being passed correctly: ``` from pathlib import Path from invokeai.backend import ModelManager, PipelineIntermediateState from invokeai.backend.globals import global_config_dir from invokeai.backend.generator import Txt2Img def my_callback(state:PipelineIntermediateState, total_steps:int): print(f'callback(step={state.step}/{total_steps})') def main(): manager = ModelManager(Path(global_config_dir()) / "models.yaml") model = manager.get_model('stable-diffusion-1.5') print ('=== TXT2IMG TEST ===') steps=30 output = next(Txt2Img(model).generate(prompt='banana sushi', iterations=None, steps=steps, step_callback=lambda x: my_callback(x,steps) ) ) print(f'image={output.image}, seed={output.seed}, steps={output.params.steps}') if __name__=='__main__': main() ```
a6201bf to
5087f30
Compare
- 8693246 add image_to_dataURL util - 0c26110 make fast latents method static - this method doesn't really need `self` and should be able to be called without instantiating `Generator` - 2360bfb fix schema gen for GraphExecutionState - `GraphExecutionState` uses `default_factory` in its fields; the result is the OpenAPI schema marks those fields as optional, which propagates to the generated API client, which means we need a lot of unnecessary type guards to use this data type. the [simple fix](pydantic/pydantic#4577) is to add config to explicitly say all class properties are required. looks this this will be resolved in a future pydantic release - 3cd7319 fix step callback and fast latent generation on nodes. have this working in UI. depends on the small change in #2957
This PR fixes #2951 and restores the step_callback argument in the refactored generate() method. Note that this issue states that "something is still wrong because steps and step are zero." However, I think this is confusion over the call signature of the callback, which since the diffusers merge has been
callback(state:PipelineIntermediateState)This is the test script that I used to determine that
stepis being passed correctly: