InvokeAI/invokeai/backend/generator
Lincoln Stein f329fddab9 make step_callback work again in generate() call
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()
```
2023-03-24 09:32:47 +11:00
..
__init__.py remove factory pattern 2023-03-10 19:33:04 -05:00
base.py make step_callback work again in generate() call 2023-03-24 09:32:47 +11:00
embiggen.py all vestiges of ldm.invoke removed 2023-03-03 01:02:00 -05:00
img2img.py Fix bug #2931 2023-03-13 08:11:09 -05:00
inpaint.py fix(inpaint): Seam painting being broken 2023-03-15 00:00:08 +13:00
txt2img2img.py Fix bug #2931 2023-03-13 08:11:09 -05:00
txt2img.py Fix bug #2931 2023-03-13 08:11:09 -05:00