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

Text inversion (.bin) not producing correct results #252

Closed
trufty opened this issue Sep 10, 2022 · 6 comments
Closed

Text inversion (.bin) not producing correct results #252

trufty opened this issue Sep 10, 2022 · 6 comments

Comments

@trufty
Copy link
Contributor

trufty commented Sep 10, 2022

Hey there!

My custom trained text-inversion embed does not appear to be generating the correct result here. I have tested this embed file and can confirm it works with the hugging face repo inference script (where it was trained).
https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion

I re-named the embed file from learned_embeds.bin to eCheddar.bin and enter eCheddar into the prompt, but I do not get anything close to the correct result.

The other public embeds on this hugging face page seem to work though, so I'm at a loss ¯\_(ツ)_/¯
https://huggingface.co/sd-concepts-library

Attached my trained embed file for reference. It's a cat embedding
eCheddar.zip



Also the readme only mentions using .pt files for text inversion embeds, however this mentions we can now use .bin embeds as well.
#151

@EnzoAndree
Copy link

Maybe you must rename the file to eCheddar.pt and enter eCheddar into the prompt

@rabidcopy
Copy link

rabidcopy commented Sep 10, 2022

Renaming learned_embeds.bin to .pt doesn't work. It'll throw this error.

Error loading emedding test.pt
Traceback (most recent call last):
  File "/home/dude/Documents/WebUI/stable-diffusion/stable-diffusion-webui/modules/sd_hijack.py", line 93, in load_textual_inversion_embeddings
    process_file(os.path.join(dirname, fn), fn)
  File "/home/dude/Documents/WebUI/stable-diffusion/stable-diffusion-webui/modules/sd_hijack.py", line 76, in process_file
    param_dict = data['string_to_param']
KeyError: 'string_to_param' 

Embeddings produced with https://github.com/rinongal/textual_inversion work fine.

@trufty
Copy link
Contributor Author

trufty commented Sep 10, 2022

Maybe you must rename the file to eCheddar.pt and enter eCheddar into the prompt

I did except im not using any .pt files. Just .bin like mentioned in the op ticket #151:

I re-named the embed file from learned_embeds.bin to eCheddar.bin and enter eCheddar into the prompt

@trufty
Copy link
Contributor Author

trufty commented Sep 10, 2022

@rabidcopy That repo saves the embeds as .pt, but .bin works just fine too. It's just my latest trained .bin embedding file that is not working. In any case the Hugging face repo embed files should work too.

Currently retraining it with a shorter placeholder_token to see if that is the cause.

@trufty
Copy link
Contributor Author

trufty commented Sep 10, 2022

Well, looks like removing the - symbol from the placeholder token fixed the issue.

So make sure the trained placeholder name does not contain symbols, or the tokenizer will split up the name and ruin your prompt. 🤦‍♂️

@trufty trufty closed this as completed Sep 10, 2022
@trufty
Copy link
Contributor Author

trufty commented Sep 10, 2022

@AUTOMATIC1111 Oh almost forgot, but you might still want to update the readme like I mentioned at the end of my first post

lonestriker pushed a commit to lonestriker/stable-diffusion-webui that referenced this issue Oct 19, 2022
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

3 participants