Commit Graph
4 Commits
Author SHA1 Message Date
google-labs-jules[bot] f482ab1fbd Fix normalization bug and improve model compatibility in A1111PromptNode
1. Fix Normalization Bug:
   - The previous implementation normalized each token immediately after scaling, effectively cancelling the emphasis weight.
   - Updated logic to calculate global mean before scaling and restore it after scaling all tokens, correctly implementing A1111's 'EmphasisOriginal' behavior.

2. Improve Model Compatibility:
   - Modified token handling to preserve all keys in the `tokens` dictionary (e.g., `t5xxl` for Flux/SD3) instead of reconstructing a partial dictionary. This prevents silent failures for non-SDXL/SD1.5 models.
   - Added a safeguard in `_apply_direct_scaling_sdxl` to check if the embedding dimension matches the expected SDXL size (2048). If not (e.g., SD3), it falls back to generic scaling and logs a warning instead of producing incorrect output.

3. Note on hooks.py:
   - The `hooks.py` file remains unused as per current implementation status (placeholder for future sampler integration).
2026-01-13 03:52:54 +00:00
google-labs-jules[bot] 956e6846ef Fix normalization bug in A1111PromptNode
The previous implementation of normalization in `_apply_direct_scaling` applied normalization per-token immediately after scaling. This effectively cancelled out the applied weight, rendering the emphasis feature non-functional when normalization was enabled.

This change fixes the logic to:
1. Calculate the global mean of the conditioning tensor before scaling.
2. Apply weights to all tokens.
3. Normalize the entire tensor to restore the original global mean.

This correctly implements A1111-style 'EmphasisOriginal' behavior where relative weights are preserved while maintaining global magnitude.
2026-01-13 03:32:46 +00:00
imi 311df21215 maybe good baseline 2026-01-11 07:14:34 +01:00
imi 61684f46da init 2026-01-10 19:21:18 +01:00