-
Notifications
You must be signed in to change notification settings - Fork 236
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 ControlNet Pipeline #585
Conversation
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rebase to latest?
e22fb1d
to
56da112
Compare
Done |
cf5d5a4
to
e87c4ed
Compare
from diffusers.utils.torch_utils import is_compiled_module | ||
from ....utils import speed_metrics, HabanaProfile | ||
from ..pipeline_utils import GaudiDiffusionPipeline | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use #611 as guideline to port this file. also move the pipeline_controlnet.py under pipelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there should be things that are not necessary anymore. I'm going to try to point them out below.
|
||
# Workaround for Synapse 1.11 for full bf16 | ||
if bf16_full_eval: | ||
unet.conv_in.float() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove line141-142
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@libinta We don't need this anymore?
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, please check https://github.com/huggingface/optimum-habana/blob/main/tests/test_diffusers.py to add test case for regression protection
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many comments related to #611 that should be quick to address.
Can you also run the following to make sure the code format is right please?
pip install --upgrade ruff
make style
from diffusers.utils.torch_utils import is_compiled_module | ||
from ....utils import speed_metrics, HabanaProfile | ||
from ..pipeline_utils import GaudiDiffusionPipeline | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there should be things that are not necessary anymore. I'm going to try to point them out below.
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
200c908
to
e0dab26
Compare
@nngokhale Can you integrate the new ControlNet example into the existing Stable Diffusion example please? It will be much easier to maintain as there is a lot of duplicated code. |
|
Style fixed |
Added tests for ControlNet pipeline. |
All comments / issues have been resolved, please review. |
Fix scheduler.step call to latest
Add hpu graph for controlnet Fix Code style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments.
Can you also run make style
please?
Do you have any throughput number to share?
optimum/habana/diffusers/pipelines/controlnet/pipeline_controlnet.py
Outdated
Show resolved
Hide resolved
Resolved latest comments, ran 'make style'. Here are my throughput numbers: For 512x512, 1 prompt, 50 inf steps, 20 generations per prompt, 4 samples per batch, BF16 + HPU Graphs, on Gaudi2 HL-SMI: hl-1.13.0-rc-fw-47.0.0.0, Habana Driver: 1.13.0-ee32e42, Installed Habana Torch plug-in: 1.13.0.463, Installed Optimum-Habana: 1.10.0.dev0 GaudiStableDiffusionControlNetPipeline with lllyasviel/sd-controlnet-canny and runwayml/stable-diffusion-v1-5 For comparison |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What does this PR do?
Adds ControlNet pipeline.
The port is based on GaudiStableDiffusionPipeline.
Fixes # (issue)
Before submitting