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

Continue training Textual-Inversion embedding receives KeyError when filename doesn't equal embedding name.

Open TkskKurumi opened this issue 3 years ago • 0 comments

Description Hi, experts.

Thanks a lot for your amazing works I'm training Textual-Inversion embdding in "Train" tag. The embedding is named pseudo_token_1. When I pause the training by pressing ^C in terminal, move the pseudo_token_1-2000.pt for 2000 step history embedding save file to root-directory/embeddings, and restart traning, it raises KeyError in textual_inversion.py:240.

Noticing that the .pt file has trailing -step, I'm suspecting its using filename for dict get, but using real embedding name for dict set. Maybe the inconsitency of token name and filename causes this issue. Would you check this out?

Yes, there is a simple work-around, just rename the .pt file.

Thanks.

To Reproduce (I think reproduction instruction is clear enough in Description section)

  • Train an Textual-Inversion embedding, and stop halfway.
  • Move <token_name>-<step>.pt to root/embeddings dir
  • Restart training.

Expected behavior There should not be KeyError when expected.

Screenshots image

Environments

  • OS: Windows
  • Browser: Chrome

TkskKurumi avatar Oct 18 '22 03:10 TkskKurumi