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

How are file names interpreted? #10

Closed RainehDaze closed 1 year ago

RainehDaze commented 1 year ago

Interesting little thing I observed when I was looking at DreamArtist-generated embeddings: both the positive (embedding-XXXX.pt) and negative (embedding-XXXX-neg.pt) files are read and loaded. I'm not quite sure what gets done with the negatives.

Zyin055 commented 1 year ago

Looking over the code I think the behavior is undefined for that case. It depends on the order in which the files are read, and whether or not it reads the X.pt or X-neg.pt file first. What would be a good way to handle that case? should it just ignore "-neg.pt" files?

RainehDaze commented 1 year ago

Ignoring them would probably be best; these are technically just two entirely separate embeddings, which can have different numbers of vectors per embedding (they just train at the same time).

Zyin055 commented 1 year ago

I don't have the DreamArtist extension installed so let me know if that update fixes the issue and ignores the -neg.pt files. I just manually renamed some to end with -neg.pt for testing on my side.

RainehDaze commented 1 year ago

Looks good, skips the appropriate files. Only thing that'd help with DreamArtist embeddings more is the ability to specify the loss file manually--it's got a different name than the textual inversion one, so it has to be renamed for graphing. xD

Zyin055 commented 1 year ago

Can you upload a screenshot of what the training folder looks like with the differently named .csv file?

RainehDaze commented 1 year ago

image Same structure, it's just called prompt_tuning_loss.csv instead.

Zyin055 commented 1 year ago

As long as it has the same data format, that update should load it.

RainehDaze commented 1 year ago

image

Yup, that works (although, as usual, the loss over time tells me pretty much nothing--are the blue and purple the trend over time or something? And why so short? xD)

Zyin055 commented 1 year ago

The colored lines require more data points to work properly. You'd need to increase the rate at which the loss is saved in the A1111 settings, I set mine to 1.