Skip to content

guiders/tangential_classifier_free_guidance: fix AttributeError in is_conditional property#13764

Open
Dev-X25874 wants to merge 1 commit into
huggingface:mainfrom
Dev-X25874:fix/tcfg-is-conditional-attribute-error
Open

guiders/tangential_classifier_free_guidance: fix AttributeError in is_conditional property#13764
Dev-X25874 wants to merge 1 commit into
huggingface:mainfrom
Dev-X25874:fix/tcfg-is-conditional-attribute-error

Conversation

@Dev-X25874
Copy link
Copy Markdown
Contributor

@Dev-X25874 Dev-X25874 commented May 19, 2026

What does this PR do?

Fixes a bug in TangentialClassifierFreeGuidance.is_conditional where the property
referenced a non-existent attribute self._num_outputs_prepared, causing an
AttributeError at runtime whenever is_conditional is accessed.

The base class BaseGuidance (guider_utils.py) defines and increments
self._count_prepared to track how many forward passes have been prepared per step.
Every other guider in the module (ClassifierFreeGuidance, MagnitudeAwareGuidance,
AdaptiveProjectedGuidance, FrequencyDecoupledGuidance, AutoGuidance, etc.) correctly
reads self._count_prepared == 1 in their is_conditional property.
TangentialClassifierFreeGuidance alone used self._num_outputs_prepared, which is
defined nowhere in the class hierarchy.

The fix is a single-token substitution: _num_outputs_prepared_count_prepared.

Fixes # (issue)

Before submitting

Who can review?

@sayakpaul @yiyixuxu

@github-actions github-actions Bot added size/S PR with diff < 50 LOC guiders and removed size/S PR with diff < 50 LOC labels May 19, 2026
@sayakpaul sayakpaul requested a review from yiyixuxu May 19, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant