Comfy-Org / Comfy-Org/ComfyUI

[Bug/Feature request] Parsing embeddings and optional identifier

Open
#1,354 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

Text like below fail to parse properly:
1. `embedding:bad_pictures,embedding:easynegative`
2. `embedding:bad_pictures,(embedding:easynegative:1),embedding:who`

For`#2`, the `word` in `word.startswith(self.embedding_identifier)` at `sd1_clip.py` is `,embedding:who`, so it's not seen as an embedding at all and gets tokenized.

You could resolve these by putting parenthesis around them like `(embedding:easynegative:1)`, but that becomes tedious for lots of embeddings. It also becomes tedious to have to write `embedding:` all the time.

I wasn't sure how you would want to solve this. In the meantime, I have a fix in my custom node
https://github.com/shiimizu/ComfyUI_smZNodes/blob/0560f05afffca6e36004b127db0589d50a4ad808/smZNodes.py#L192-L241. I used a regex to match the text against a list of available embeddings and made the `embedding:` identifier optional.

If you want, I can make a pull request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.