stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Feature Request]: Allow setting the initial parameters of a new embedding, to correspond with a previous embedding (make a copy of it).

Open FullTablet opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

Say there are two artists/objects with a very similar (but still distinct) art styles / appearances.

First, one creates an embedding for one of the artists/objects, then one trains it for a few dozens of hours, achieving the expected results.

Then, one wants another embedding for the second artist/object. Since it is similar to the previous artists, one would normally want to begin training from the spot the previous embedding ended, instead of starting from a vanilla initialization, in order to save time.

Currently, if you write the name of the first embedding in the "Initialization text" entry of the "Create Embedding" menu, it results in an embedding which, when used in a prompt, produces a vanilla result, rather than the result produced by the first trained embedding; training such embedding also begins from scratch (usually noise, since the vanilla model doesn't recognize the first embedding as a word) instead.

Currently, a workaround is, instead of using the "Create Embedding" menu, one copies the .pt file of the first embedding, and then renames the copy so it has the name of the new embedding. The problem is that this also inappropriately copies the metadata of the first embedding (such as the training steps count, or the name of the embedding as it is written in the contents of the file), and that might cause problems later on.

This feature could be implemented as an option to copy a previous embedding, but with a new name and appropriate metadata. Alternatively, the behavior of setting the "Initialization Text" of a new embedding to the name of a previous embedding could be changed, so it does what is intended as described in this feature request.

Proposed workflow

  1. Go to Train -> Create embedding tab.
  2. Below the usual fields (Name / Initialization Text / Numbers of vectors per token / Overwrite old embedding?) and "Create Embedding" button. There is another field named "Embedding to copy", which lists all currently loaded embedding, and then a button that says "Copy Embedding"

OR

Change the behavior of the "Initialization Text" parameter. So setting it as the name of an old embedding copies its parameters to the new embedding.

Additional information

No response

FullTablet avatar Oct 24 '22 13:10 FullTablet

It's a good idea. I've wanted to change the names of embeddings as well (because I had picked random experimental names) and this is a better option than just renaming. Makes them more future-proof as you say.

mayofiddler avatar Oct 26 '22 14:10 mayofiddler