-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Add option to store TI embeddings in png chunks, and load from same. #2037
Conversation
Actually thinking this is too risky, upon reviewing the ongoing pytorch attempts to mitigate the risks of pickle. |
will rework to directly pass the embedding without torch.load |
Okay, Zero-🥒, now serialises to and from a safe json representation for embedding in the images without a torch.load of untrusted files, added a little styling to the embedded-images, they all go in a separate folder, standard images are left untouched. I've left the original above-below captioning method in under |
Why does image embedding try to use loaded name, while .pt embedding doesn't? |
The .pt doesn't use the name field because not all embeddings are guaranteed to have them, only ones trained in this repository, and to allow users to rename the file to whatever tokens they want to trigger the embedding. The image embeddings should always contain a name field, already advertise their trained name in the image itself, and are more prone to having their original filenames destroyed by image hosts. |
But then that won't allow multiple image embeddings that happened to be trained with same name. And it's not like the original filename matters, or does it? The user can set the filename like the .pt ones. |
@dfaker this is an awesome feature. I have a question. My best embedding during training didn't turn out a good image. How do I make a new image embedding with a better image? It would be cool if there was a checkbox option, perhaps on the txt2img page or settings, that could generate new embeddings along with the generated images? Then you could pick the one that best represents the embedding? |
@Jonseed there's actually a script for that: https://github.com/dfaker/embedding-to-png-script I do like the honesty of using the training images though. |
Cool! I'll check that out. Yeah, the prompt I used to generate preview images during training just wasn't that great to begin with. |
…json_api Revert "Add openpose json to API response"
Making the preview pngs themselves sharable embeddings.
So images like this:
Can go straight into your embeddings folder...maybe wait until you've done a little more training before sharing them in general though.
Initially concerned about torch.load doing unsafe pickling but it seems as if it's restricted on the type of classes it'll deserialise to str, I'm not sure if we're happy that's protection enough.