SwarmUI icon indicating copy to clipboard operation
SwarmUI copied to clipboard

Feature: Visual indicator of where a prompt is split for CLIP

Open bWm-nubby opened this issue 1 year ago • 0 comments

Feature Idea

My idea is to add a visual indicator to show where a prompt will be split for CLIP processing. Normally, this occurs every 75 tokens afaik but sometimes that can cause a single tag, or sentence for natural language to be separated into different batches which results in different results than intended. For example in a prompt where "red hair" occupies tokens 75 and 76, the split occurs between the two words meaning the first batch has "red" and the second batch has "hair" which means you likely won't get the red hair that you wanted. Adding a "<break>" before "red" will of course solve this problem, but it is difficult to know where the prompt is being split unless you are typing the prompt from scratch and watching the token counter while you do so. When copy/pasting a prompt or editing an existing prompt that is longer than 75 tokens the user currently has to guess where the prompt is being split.

Other

The first thought I had was to use alternating text colors for each batch but then I realized that could potentially create accessibility issues for people with different types of color blindness so adding the ability to customize the colors used outside of editing a theme may be needed if this approach is taken. My next thought was to display a character or two that wouldn't normally be used in a prompt at the breakpoint such as "||", of course this would be a visual indicator only and not actually included in the text. Either way there should probably also be an option to toggle the feature on/off for users who don't want it.

bWm-nubby avatar Dec 01 '24 10:12 bWm-nubby