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 controlnet training #551

Merged
merged 10 commits into from
Jun 17, 2023
Merged

add controlnet training #551

merged 10 commits into from
Jun 17, 2023

Conversation

ddPn08
Copy link
Contributor

@ddPn08 ddPn08 commented May 31, 2023

Add ControlNet training code.
As soon as all the tests are finished, I will write the details and open it.

@@ -1787,6 +2103,8 @@ def backward(ctx, do):

def replace_unet_modules(unet: diffusers.models.unet_2d_condition.UNet2DConditionModel, mem_eff_attn, xformers):
# unet is not used currently, but it is here for future use
unet.enable_xformers_memory_efficient_attention()
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be fixed.

@kohya-ss
Copy link
Owner

Thank you for this! I think this is what everyone wanted!

However, I have two concerns.

I am aware that this pull request requires Diffusers to be upgraded to the latest version. Am I correct? The Diffusers version upgrade will have a large impact, and it will be necessary to fix them as well.

Also, there is an original implementation of ControlNet in the repository: tools/original_control_net.py. The generation script depends on the original ControlNet and need to be rewritten.

Since I think that Diffusers will need to be upgraded sooner or later, I will consider fixing the other modifications after the pull request is merged.

As for ControlNet, I think the implementation in this repository is simpler than the one in Diffusers, so I think it would be an idea to use this implementation. However, if we upgrade Diffusers, we could switch the generation script from own ControlNet implementation to the Diffusers implementation. Therefore, I think it would be best if you implement it in a way that is easy to implement.

@sdbds
Copy link
Contributor

sdbds commented May 31, 2023

Can we use original ControlNet repository's preprocesser to generate
conditioning data for conditioning_data_dir ?
I think this is very convenient, and it also allows for updates when new preprocessors are added to Controlnet in the future.

@ddPn08
Copy link
Contributor Author

ddPn08 commented Jun 1, 2023

If you plan to upgrade the version of diffusers, I'll use ControlNet implemented with diffusers as it is.
And I realized that before this PR, I needed a PR to bump the version of diffusers.

@ddPn08
Copy link
Contributor Author

ddPn08 commented Jun 1, 2023

https://github.com/ddPn08/sd-scripts/tree/diffusers_0_16
I have implemented a branch to support diffusers@0.16.1.
I haven't decided what to do next.

@ddPn08
Copy link
Contributor Author

ddPn08 commented Jun 2, 2023

I will make it open once I write the documentation.

@kohya-ss
Copy link
Owner

kohya-ss commented Jun 3, 2023

Cool! Thanks!

I am considering implementing U-Net proprietary as I mentioned before. That way the repository would not be dependent on a specific version of Diffusers. I am thinking that it might be better to do that first.

So the point at which merges become available may be a little later. I will also consider creating a new branch to work on that and merging this PR into it.

@kohya-ss
Copy link
Owner

I'm almost done preparing for the Diffusers upgrade in the original-u-net branch, so I'll be able to merge this PR.

However, some modifications are duplicated in this PR and the branch, and due to code reorganization related to datasets, please note that I will modify the code after the PR is merged.

@ddPn08
Copy link
Contributor Author

ddPn08 commented Jun 16, 2023

I got it. I open this PR.

@ddPn08 ddPn08 marked this pull request as ready for review June 16, 2023 02:40
@kohya-ss
Copy link
Owner

Thank you! I will merge this when I have time!

@kohya-ss kohya-ss changed the base branch from dev to original-u-net June 17, 2023 12:49
@kohya-ss kohya-ss merged commit 2b4229f into kohya-ss:original-u-net Jun 17, 2023
wkpark pushed a commit to wkpark/sd-scripts that referenced this pull request Feb 27, 2024
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