Zyin055 / Inspect-Embedding-Training

Python script to analyze textual inversion embedding files used with AI image generators
MIT License
102 stars 11 forks source link

Inspect an existing embedding file #16

Closed Rudy34160 closed 1 year ago

Rudy34160 commented 1 year ago

I wanted to try this: If all you want to do is inspect an existing embedding file that you downloaded from the internet, you can use --file EmbeddingName with the EmbeddingName.pt file next to the script.

Doesn't matter for the source of the embedding, but it doesn't seem to work with "embedding.bin": These file types don't work like "embeddings.pt" files? Or would it be necessary to use a different script depending on the type of file to be analyzed?

Zyin055 commented 1 year ago

I've only used A1111 to train embeddings so I've only gotten .pt files out of it. Does renaming the .bin file to .pt work?

Rudy34160 commented 1 year ago

> I've only used A1111 to train embeddings so I've only gotten .pt files out of it. Does renaming the .bin file to .pt work?

No. By example, I try with this embedding https://civitai.com/models/8235/lili-reinhart, and rename the .bin file to .pt : Script don't work. Both types of files seem to work under A1111, but their construction must be different I guess. I thought I could try parsing the .bins to understand a bit more about the parameters to use to get a good embedding.

Zyin055 commented 1 year ago

Just updated the script to accept .bin embedding file format. The .bin embedding you supplied didn't have any additional metadata attached to it, just the raw vector values (tensors). This lets you get the strength/magnitude, but not other stuff like step count or model it was trained on. Try it out and let me know if it works for you.

Rudy34160 commented 1 year ago

It works perfectly. It seems that the .bin files do not allow reading the embedding build data. Thanks for the updated script!