Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature Request]: Embedding Selection & Organization #3443

Closed
1 task done
Thunderwagon opened this issue Oct 22, 2022 · 3 comments
Closed
1 task done

[Feature Request]: Embedding Selection & Organization #3443

Thunderwagon opened this issue Oct 22, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Thunderwagon
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

Hello,

So my request has 2 parts, the first is the ability to organize embeddings in a directory or sub directory structure so that I can keep track of originating model, style, characters etc. The second part is that I'd love to see an embedding selection menu in the gui so that I can simply select the embedding I want to add via a menu, preferrably a menu that could also make use of a preview thumbnail saved with the embedding, so that it automatically adds the embedding to the prompt in the correct way.

Proposed workflow

  1. create prompt
  2. open embedding selection
  3. select the embedding you want based off thumbnail preview
  4. automatically adds the embedding correctly to the current prompt

Additional information

Love the framework, thanks for your hard work.

@R-N
Copy link
Contributor

R-N commented Oct 28, 2022

+1
Embedding selection would be very helpful for embedding training, for trying the logged models.

After having trained models logged, I'd pick ones that seem good, then try them out one by one. Just that 1 generated preview isn't enough because I'd like to see how they do with various prompts. This is easy for hypernetwork thanks to quicksettings. Embeddings, however, are always and only loaded on boot, all of them, while the embeddings I want to try are for the same subject, so the same subject prompt. I don't know how they'd behave, which one will get chosen, so I had to reboot the webui everytime.

@R-N
Copy link
Contributor

R-N commented Oct 31, 2022

I may be able to work on it, but I'm new to this so only simple builtin components, no previews. There are issues though

AFAIK gradio only supports multiple selection wth CheckboxGroup. However, there can be tons of embeddings so using CheckboxGroup will clutter the UI. It can be hidden by Collapse but once you open it it'll still clutter the UI. It also won't be quicksettings-friendly.

Multiselect dropdown like Streamlit would be very nice. The feature has been requested to gradio but no one's working on it yet.

Any ideas? Maybe there are repo of gradio extensions(?) that can help.

@R-N
Copy link
Contributor

R-N commented Nov 3, 2022

Okay I was trying to make it, well, sort of, it's actually a blacklist instead. Anyway I found out that embeddings are loaded and used by their filename instead of the embedding name set when training them. It's not the case for image embeddings though. But anyway, with this being the case, I don't really need a blacklist/whitelist since all of them will be unique due to filename being used as key. Maybe it should support subfolders though.

name = os.path.splitext(filename)[0]

data = []

if os.path.splitext(filename.upper())[-1] in ['.PNG', '.WEBP', '.JXL', '.AVIF']:
    embed_image = Image.open(path)
    if hasattr(embed_image, 'text') and 'sd-ti-embedding' in embed_image.text:
        data = embedding_from_b64(embed_image.text['sd-ti-embedding'])
        name = data.get('name', name)
    else:
        data = extract_image_data_embed(embed_image)
        name = data.get('name', name)
else:
    data = torch.load(path, map_location="cpu")

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants