Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

106 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SD Forge Negative Prompt in Prompt

This is an Extension for Forge Classic / Neo, which implements NegPip, allowing you to give words a negative emphasis inside the positive prompt field to suppress a concept, or vice versa.

Important

Only SD1 and SDXL are supported
🔥 New: Now supports Anima & Krea 2

How to Use

  • add (foo:-1.0) in the positive prompt to remove a concept
  • add (bar:-1.0) in the negative prompt to enforce a concept

Krea 2

The built-in prompt weighting has practically no effect on Krea 2. This extension adds NegPiP-style weighting support: negative weights such as (word:-1.0) can suppress concepts, just like NegPiP on the other models. Positive weights such as (word:1.5) are also applied, but they may be much less visible than negative weights because Krea 2 tends to normalize away simple magnitude changes.

This experimental branch (neo-krea2-emphasis) additionally offers a much stronger mode: enable the NegPiP V-Scaling (Krea 2) accordion on the txt2img / img2img page, and the prompt weight directly scales how much each token contributes inside the model, making both positive and negative weights clearly visible. The Strength slider runs from the normal behavior (0) to the raw prompt weight (1); values up to 2 strengthen the magnitude using a sign-preserving power curve, so weights never flip from emphasis to suppression or vice versa. Since this changes the image considerably, use it only when you need it; the strength is recorded in the infotext as NegPiP V-Scaling while it is on. With the accordion off, this branch behaves exactly like the main neo-krea2 branch.

  • The extension activates whenever any non-unit weight is present in the prompts, not just negative weights; the activation is recorded as NegPiP: True in the infotext
  • Krea 2 has no chunking and BREAK is not treated specially, same as without this extension; note that the prompt parser internally marks BREAK with a weight of -1, so a bare BREAK behaves like (BREAK:-1.0) while the extension is active

Note

The Krea 2 support is based on ComfyUI-krea2-negpip. Following that implementation, weighted prompts are tokenized with the chat template applied once around the entire prompt, rather than once per weighted segment like the built-in emphasis does, and weight magnitudes are applied on the text encoder output by interpolating each weighted token between a neutral (empty) encoding and its actual encoding. Since Krea 2 uses normalization heavily, positive weights mostly affect the remaining directional difference and can look subtle, while negative weights additionally flip the token direction in attention values and tend to be much more noticeable. As V-Scaling rises from 0 to 1, the encoder-side interpolation fades out continuously (large extrapolated weights can drift the token embedding away from its meaning), while the attention values (V) take over the magnitude using sign(weight) × abs(weight) ** Strength. V is the only tensor in the attention that Krea 2's normalization does not touch, so the token keeps its meaning while its contribution scales, and weights gain gradation on both sides, e.g. (word:-2.0) suppresses more strongly than (word:-1.0). The scaled values are only read by the image tokens; the text tokens keep reading the original sign mask, so the text stream stays intact even at large weights (mirroring how NegPiP works in cross-attention models). Weighted prompts render differently from extension-off.

Examples

Base (aqua hair:-1.0)
in Positive Prompt
(aqua hair:1.5)
in Negative Prompt
  • Full Prompts
masterpiece, best quality, high quality, 1girl, solo, hatsune miku, vocaloid, casual, looking at viewer, smile, simple background, white background,
anime screenshot, anime coloring, screencap, flat color, masterpiece, best quality, very aesthetic, absurdres, aesthetic, detailed, beautiful color, amazing quality, highres, safe
Negative prompt: (signature), worst quality, bad quality, low quality, text, name, watermark, (hdr, cinematic, high contrast), logo, username, bad anatomy, bad proportions, extra limbs, extra digit, extra legs, extra legs and arms, disfigured, missing arms, too many fingers, fused fingers, missing fingers, unclear eyes, censored

About

Negative Prompt in Prompt for Forge Classic / Neo

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages