Skip to content

Conversation

@wbruna
Copy link
Contributor

@wbruna wbruna commented Dec 14, 2025

The documentation and examples for many distilled models, such as SDXL Turbo and Z-Image Turbo, specify a CFG scale of 0. So add a few warnings to nudge the user in the right direction.

Edit: removed the cfg cap, as per @stduhpf suggestion.

@stduhpf
Copy link
Contributor

stduhpf commented Dec 14, 2025

the Diffusers implementation treats any value lesser than 1 the same as 1

Actually, that's not really it. The diffusers implementation uses CFG literally like it was proposed in the original paper (https://arxiv.org/abs/2207.12598v1), with CFG=0 meaning pure conditioned and CFG=-1 meaning unconditioned. It's effectively just an offset of -1 compared to every other implementation.

@wbruna
Copy link
Contributor Author

wbruna commented Dec 14, 2025

That's... unfortunate. So maybe a stronger warning would be better instead.

This was motivated by a Koboldcpp issue (LostRuins/koboldcpp#1880), which mentioned specifically the Z-Image Turbo page. But I believe most GUIs follow the "1 means pure conditioned" convention instead?

@stduhpf
Copy link
Contributor

stduhpf commented Dec 14, 2025

I'm all for warning the user just in case they set it to such a value by mistake, but in my opinion, overriding the values set by the user is not good behavior.

The user might have set CFG to 0 on purpose to test unconditioned behavior of the model. Or set it to a negative number to see what the negative prompt does.

I say, let the user play with weird parameters values if he wants to, as long as it's not causing crashes.

@wbruna wbruna changed the title fix: avoid and warn about cfg-scale less than 1 feat: give feedback about cfg values smaller than 1 Dec 14, 2025
@leejet
Copy link
Owner

leejet commented Dec 15, 2025

I think having so many log warnings in the code about the cfg_scale value is a bit annoying. Perhaps it would be sufficient to warn only when cfg_scale < 1.f, since that’s when it may lead to unexpected results.

@wbruna wbruna marked this pull request as draft December 15, 2025 21:01
@wbruna wbruna marked this pull request as ready for review December 17, 2025 14:03
@wbruna wbruna marked this pull request as draft December 17, 2025 14:03
@wbruna wbruna marked this pull request as ready for review December 17, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants