TangentialClassifierFreeGuidance.is_conditional reads an attribute that does not exist
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从 src/diffusers/guiders/tangential_classifier_free_guidance.py 开始,将其 is_conditional 属性与其他 guider 实现和 BaseGuidance 进行比较。检查 modular_pipelines/stable_diffusion_xl/denoise.py 中的 is_unconditional 路径和 guess-mode 读取。完成标准是两个属性都能在不出现 AttributeError 的情况下工作,并且相关的 guider 行为已由测试覆盖。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
TangentialClassifierFreeGuidance.is_conditional reads self._num_outputs_prepared, which is not defined on the class, on BaseGuidance, or anywhere else in the package. Accessing it raises AttributeError, and so does is_unconditional, since BaseGuidance defines that as not self.is_conditional.
BaseGuidance.__init__ sets self._count_prepared, and prepare_inputs increments it. Every other guider reads that attribute. This one appears to be the only exception:
adaptive_projected_guidance.py return self._count_prepared == 1
adaptive_projected_guidance_mix.py return self._count_prepared == 1
auto_guidance.py return self._count_prepared == 1
classifier_free_guidance.py return self._count_prepared == 1
classifier_free_zero_star_guidance.py return self._count_prepared == 1
frequency_decoupled_guidance.py return self._count_prepared == 1
magnitude_aware_guidance.py return self._count_prepared == 1
perturbed_attention_guidance.py return self._count_prepared == 1 or self._count_prepared == 3
skip_layer_guidance.py return self._count_prepared == 1 or self._count_prepared == 3
smoothed_energy_guidance.py return self._count_prepared == 1 or self._count_prepared == 3
tangential_classifier_free_guidance.py return self._num_outputs_prepared == 1 <-- undefined
grep -rn "_num_outputs_prepared" src/ returns that single line and no assignment.
The reported error is misleading, which is what makes this awkward to diagnose. Python surfaces a failure inside a property as the property itself being missing, so the message names is_conditional rather than the attribute that is actually absent.
The property is reachable rather than dead code. BaseGuidance.is_unconditional routes through it, and modular_pipelines/stable_diffusion_xl/denoise.py reads components.guider.is_conditional in the guess-mode branch.
Reproduction
No GPU, model download or authentication required.
from diffusers.guiders import ClassifierFreeGuidance, TangentialClassifierFreeGuidance
print(ClassifierFreeGuidance(guidance_scale=7.5).is_conditional) # False
t = TangentialClassifierFreeGuidance(guidance_scale=7.5)
print(hasattr(t, "_count_prepared")) # True
print(hasattr(t, "_num_outputs_prepared")) # False
t.is_conditional # AttributeError
t.is_unconditional # AttributeError
Logs
AttributeError: 'TangentialClassifierFreeGuidance' object has no attribute 'is_conditional'
Prior attempts
Two pull requests fixed this correctly and are now closed, in both cases by their own authors rather than by a maintainer or a review decision:
- #13434 (2026-04-08, closed 2026-04-27 by the author) also covered a
NameErrorinFrequencyDecoupledGuidance. That second bug no longer reproduces onmain, so only this one remains. - #13764 (2026-05-19, closed 2026-07-21 by the author) received no comments at all.
I mention this because it seems more useful than filing a third identical patch unprompted. Given that guiders are marked experimental, is this worth fixing, or is the module parked for now? If you would like it fixed I am happy to open a PR changing the attribute to _count_prepared, with a test that covers is_conditional and is_unconditional for every guider so the next one cannot drift the same way.
System Info
- diffusers 0.41.0.dev0,
mainat ae2e4c7 - torch 2.14.0, Python 3.11, macOS (Apple Silicon)
- Reproduced on CPU, no accelerator involved
Who can help?
@DN6 @asomoza
- 主要语言
- Python
- 星标
- 34.6k
- 派生
- 7.4k
- 平均合并
- 4 天 13 小时
- 30 天内合并 PR
- 49
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
huggingface/diffusers 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
huggingface/diffusers#14888 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
huggingface/diffusers#14881 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
huggingface/diffusers#14864 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
huggingface/diffusers#14837 ·
维护者通常 1 天内回复
-
bug needs-code-example needs-env-info pipelines
难度 1/5 1 小时以内 新手友好度 86/100
huggingface/diffusers#14780 · 1 条评论 ·
维护者通常 1 天内回复
查看 huggingface/diffusers 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
BasedHardware/omi#20271 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 92/100
openai/openai-cookbook#3153 ·
维护者通常 1 天内回复
-
cvss-severity:high devguard l3montree-cybersecurity/devguard/devguard pkg:golang/github.com/l3montree-dev/devguard risk:low state:open
难度 2/5 1-3 小时 新手友好度 65/100
l3montree-dev/devguard#3146 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 76/100
open-webui/open-webui#31849 · 2 条评论 ·
维护者通常 1 天内回复