diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Make saving the full model optional for textual inversion

Open allo- opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. The resulting .bin file from the textual inversion script can be loaded with a few lines of code into the standard model. Saving a full model only to have an additional token is a waste of space (and possibly VRAM and CPU/GPU time).

Describe the solution you'd like Add a flag to only optionally run these lines:

https://github.com/huggingface/diffusers/blob/d3f1a4c0f03fb84ec45b9491ca77cf99c36936f8/examples/textual_inversion/textual_inversion.py#L556-L567

Describe alternatives you've considered One can comment them oneself or use an own training script.

allo- avatar Oct 06 '22 19:10 allo-

Hi, thanks for the issue! Would you like to open a PR to add an argument to specify not to save the whole model ?

patil-suraj avatar Oct 07 '22 09:10 patil-suraj

Yes.

I've got some code to load learned embeddings to continue training as well. I wonder if I should put it into the same pull requests. It's basically the load function from the textual inversion notebook, I think.

allo- avatar Oct 07 '22 09:10 allo-

Let's do one PR at a time, let's add the option to not save the whole model.

patil-suraj avatar Oct 07 '22 09:10 patil-suraj

Later then. I also still have the use_auth_token code in my copy of the script and so on and should merge and test it with diffusers git before.

allo- avatar Oct 07 '22 10:10 allo-

Does repo.push_to_hub push the full model or the embeddings only?

allo- avatar Oct 08 '22 16:10 allo-

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Nov 06 '22 15:11 github-actions[bot]

Closing here and leaving the pull request open.

allo- avatar Nov 06 '22 15:11 allo-