#14907·diffusers

CFG 切断回调保留单个嵌入行,因此当 num_images_per_prompt > 1 或有多个提示时会发生断点

作者: JoeyTan21创建于 2026年9月29日更新于 2026年9月29日

The four official CFG cutoff callbacks in `src/diffusers/callbacks.py` (`SDCFGCutoffCallback`, `SDXLCFGCutoffCallback`, `SDXLControlnetCFGCutoffCallback`, `SD3CFGCutoffCallback`) disable CFG at the cutoff step by setting `pipeline._guidance_scale = 0.0` and slicing the conditioning tensors with `[-1:]` (# "-1" denotes the embeddings for conditional text tokens).

内容来源: huggingface/diffusers