-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Make ControlNet SD Training Script torch.compile compatible
#6525
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
Make ControlNet SD Training Script torch.compile compatible
#6525
Conversation
Signed-off-by: Suvaditya Mukherjee <[email protected]>
Signed-off-by: Suvaditya Mukherjee <[email protected]>
Signed-off-by: Suvaditya Mukherjee <[email protected]>
sayakpaul
left a comment
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.
Thank you! Let's maybe wait for #6511 to get merged. Then we can ship this!
torch.compile compatibletorch.compile compatible
|
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. |
| logger.info("Initializing controlnet weights from unet") | ||
| controlnet = ControlNetModel.from_unet(unet) | ||
|
|
||
| # Taken from [Sayak Paul's Diffusers PR #6511](https://github.com/huggingface/diffusers/pull/6511/files) |
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 it. Not a problem. But I appreciate the thoughtfulness.
|
|
||
| # Get the text embedding for conditioning | ||
| encoder_hidden_states = text_encoder(batch["input_ids"])[0] | ||
| encoder_hidden_states = text_encoder(batch["input_ids"], return_dict=False)[0] |
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.
Nit: For ControlNet training on SD, it won't matter (same for SDXL) as we never train the text encoder during ControlNet training. But keeping it this way doesn't hurt things. So, I am okay with it.
sayakpaul
left a comment
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.
Thank you!
…gface#6525) * update: make controlnet script torch compile compatible Signed-off-by: Suvaditya Mukherjee <[email protected]> * update: correct earlier mistakes for compilation Signed-off-by: Suvaditya Mukherjee <[email protected]> * update: fix code style issues Signed-off-by: Suvaditya Mukherjee <[email protected]> --------- Signed-off-by: Suvaditya Mukherjee <[email protected]>
What does this PR do?
Partially fixes #6503 concerning ControlNet's Training Script. Followed along with #6483 and #6511.
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@sayakpaul @patrickvonplaten