Skip to content

Save base model in ControlNet training scripts when saving trained model or pushing to hub #3115

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

Closed
pcuenca opened this issue Apr 15, 2023 · 5 comments
Assignees

Comments

@pcuenca
Copy link
Member

pcuenca commented Apr 15, 2023

This came up in the PR to provide ControlNet support to Apple's ml-stable-diffusion: apple/ml-stable-diffusion#153. I've also seen people training ControlNet models for Stable Diffusion v2 and v2.1, so it could be useful to save this as a metadata field for users of the trained models.

This would be similar to the base_model recently added to the textual inversion training script: huggingface/notebooks@944dc4b, but could maybe go inside the config.json of the saved model.

@williamberman @sayakpaul @yiyixuxu @patrickvonplaten do you think this could be useful? If so, I can submit a PR for both the PyTorch and the Flax training scripts.

@sayakpaul
Copy link
Member

I think it would make sense to add that to the YAML metadata like we do in the DreamBooth training as well:

@patrickvonplaten
Copy link
Contributor

We could definitely add such a flag to the training script @pcuenca - I'd say be default we only save controlnet, but having an option to save the whole model along-side makes a lot of sense!

@pcuenca
Copy link
Member Author

pcuenca commented Apr 20, 2023

Thanks, @sayakpaul and @patrickvonplaten, I'll prepare a PR then! I thought we just needed the metadata info, didn't think about saving the whole model to the same repo.

Actually the metadata field already appears in some models, for example here: https://huggingface.co/lllyasviel/control_v11f1p_sd15_depth/blob/main/README.md?code=true#L3, but couldn't find it being automatically added in either the training or conversion scripts.

@pcuenca pcuenca self-assigned this Apr 20, 2023
@atiorh
Copy link

atiorh commented Apr 24, 2023

Thank you all! We currently assume a runwayml/stable-diffusion-v1-5 base model and warn the users who attempt to export ControlNet models to Core ML using another model version. I will update the behavior once the base model attribute is made available in the model metadata.

@pcuenca
Copy link
Member Author

pcuenca commented Apr 27, 2023

Closing as fixed by #3229.

@pcuenca pcuenca closed this as completed Apr 27, 2023
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

No branches or pull requests

4 participants