-
Notifications
You must be signed in to change notification settings - Fork 215
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
Text2ImagePipeline heterogenous compile #1768
Text2ImagePipeline heterogenous compile #1768
Conversation
…::reshape to Text2ImagePipeline::reshape
…ompile flow This makes the following flow work for Stable Diffusion XL: ov::genai::Text2ImagePipeline pipe(models_path); pipe.reshape(1, width, height, pipe.get_generation_config().guidance_scale); pipe.compile(text_encoder_device, unet_device, vae_decoder_device); This commit fixes a couple errors that were present. 1. The original StableDiffusionXLPipeline constructor used in this case called StableDiffusionPipeline(pipeline_type, root_dir), which itself made a call to initialize_generation_config(). I think the idea here is that StableDiffusionXLPipeline's implementation should be called, but since at this point the vtables haven't been completed, StableDiffusionPipeline's implementation is called, and an exception was thrown since it doesn't support the "StableDiffusionXLPipeline" class_name. This is kind of deeper problem which probably requires more in-depth refactor.. but for now I resolved this issue by avoiding that specific construction flow. 2. StableDiffusionXLPipeline's reshape implementation originally used batch_size_multiplier (typically set to 2) to reshape the text encoders. But in fact these should be fixes at 1.
…geneous sample to use it
samples/cpp/image_generation/heterogeneous_stable_diffusion.cpp
Outdated
Show resolved
Hide resolved
samples/python/image_generation/heterogeneous_stable_diffusion.py
Outdated
Show resolved
Hide resolved
@ilya-lavrenov -- Thanks for the review! I pushed changes to address your comments. |
src/cpp/include/openvino/genai/image_generation/text2image_pipeline.hpp
Outdated
Show resolved
Hide resolved
samples/python/image_generation/heterogeneous_stable_diffusion.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Ilya Lavrenov <[email protected]>
Co-authored-by: Ilya Lavrenov <[email protected]>
…eline.hpp Co-authored-by: Ilya Lavrenov <[email protected]>
…tween reshape() and infer()
I'm trying to figure out how this pyi generation works... In my case, I don't see the .pyi getting generated. Looking at the CMakeLists.txt, it seems like it only enables this if Seems like |
samples/python/image_generation/heterogeneous_stable_diffusion.py
Outdated
Show resolved
Hide resolved
build_jenkins |
To simplify creation of a heterogenous stable diffusion txt2image pipeline, this adds a new API to
Text2ImagePipeline
class:(Need some feedback here.. especially on if we technically need 3 sets of properties.. one per device?)
This API greatly simplifies heterogenous pipeline setup to this:
And so now with these changes, heterogenous stable diffusion sample can support all variants of stable diffusion (SD1.5, LCM, XL, SD3, etc.) with the same code. With the old method (creating sub-components and assembling pipeline object), it would have been difficult to achieve this.
With that said, this PR is tested and working with the following pipelines (with NPU running denoise):
TODO:
Add python bindings for the new APIUpdate python heterogenous sampleFUTURE WORK (outside the scope of this PR):