Skip to content
 
 

Latest commit

 

History

128 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Experimental Krea 2 NegPiP / Prompt Weighting for Forge Neo

A personal, AI-assisted fork that experiments with NegPiP and prompt weighting for Krea 2 (Krea2) in Forge Neo. It may help when prompt weights such as (word:1.5) or (word:-1.0) have little or no visible effect.

This fork adds experimental Krea 2 support to the original sd-forge-negpip. It also retains NegPiP support for SD1, SDXL, and Anima.

Note

This is not an official Krea 2 implementation. It was developed largely with AI assistance for my own use and is shared in case it helps someone with the same problem. If the upstream extension adds Krea 2 support, prefer that.

Features

  • Negative prompt weights inside the positive prompt, even when using Krea 2 at CFG 1
  • Optional V-Scaling for more noticeable positive and negative Krea 2 prompt weights
  • NegPiP behavior for SD1, SDXL, and Anima inherited from the original extension
  • Forge Neo integration for txt2img and img2img

Installation

In Forge Neo, open Extensions → Install from URL and enter:

https://github.com/flyfront/sd-forge-negpip

No branch name is required: neo-krea2-emphasis is the default branch. Install the extension and restart the web UI.

Branch Krea 2 behavior Intended use
neo-krea2 NegPiP; positive weights are usually subtle Original NegPiP-style suppression
neo-krea2-emphasis (this branch, default) NegPiP plus optional V-Scaling More noticeable positive and negative prompt weighting

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
  • For Krea 2, open NegPiP V-Scaling (Krea 2) and use a positive weight such as (word:1.5) for stronger emphasis

Krea 2 Prompt Weighting

Forge Neo's built-in prompt weighting has practically no effect on Krea 2. This experimental fork adds NegPiP-style weighting: 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.

The default branch (neo-krea2-emphasis) additionally offers an optional 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 more noticeable. 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
  • When Krea 2 Reference is active with a reference image, the positive prompt uses Forge Neo's image-aware conditioning path and NegPiP weighting is disabled for that positive prompt. Negative-prompt NegPiP remains available. The console reports NegPiP Positive Disabled (Krea 2 Reference active) in this case

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

Note

These example images and prompts are inherited from the upstream extension and were not generated with Krea 2. They demonstrate the original NegPiP behavior; Krea 2 results, especially with positive weights, may differ.

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

Fork of sd-forge-negpip: experimental Krea 2 prompt weighting / NegPiP for Forge Neo (personal, AI-assisted)

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages