Skip to content
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

add image to image vae compile demo #406

Merged
merged 2 commits into from
Dec 11, 2023
Merged

add image to image vae compile demo #406

merged 2 commits into from
Dec 11, 2023

Conversation

strint
Copy link
Collaborator

@strint strint commented Dec 7, 2023

Performance:

torch +compiled unet +compiled controlnet +compiled vae compiled total speedup
Denoising loop (iter/s) 15.76 23.5 27.05 27.03 171.5%
End2End pipeline (iter/s) 1.64 1.95 2.9 3.50 213%
End2End pipeline (s) 0.595 0.507 0.354 0.284 210%
  • StableDiffusionControlNetImg2ImgPipeline
  • device: RTX 3090
  • width * hight: 512*512
  • steps: 7(Denoising step is 5)

Run:

python examples/image_to_image_controlnet.py --compile_unet true --compile_ctrlnet true --compile_vae true

#pipe.vae = oneflow_compile(pipe.vae)
# ImageToImage has encoder and decoder, so we need to compile them seperately.
pipe.vae.encoder = oneflow_compile(pipe.vae.encoder)
pipe.vae.decoder = oneflow_compile(pipe.vae.decoder)
Copy link
Collaborator Author

@strint strint Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compile the encoder and decoder separately

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an automatic way to detect and report the cause of inappropriately compiling encoder and decoder together?

Copy link
Collaborator Author

@strint strint Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an automatic way to detect and report the cause of inappropriately compiling encoder and decoder together?

Yes, we are working on it in another PR: directly compile the full vae.


if args.compile_vae:
from onediff.infer_compiler import oneflow_compile
#pipe.vae = oneflow_compile(pipe.vae)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related work takes my time: #394

But it's not trivial to compile the encode and decode in one graph.

@strint strint merged commit 9e0cf96 into main Dec 11, 2023
4 checks passed
@strint strint deleted the controlnet_i2i_demo branch December 11, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants