From 1151ee936e1b33cf6c30c3fd83f0b858fe777cfb Mon Sep 17 00:00:00 2001 From: dafahaha Date: Thu, 17 Sep 2026 10:17:45 +0800 Subject: [PATCH] fix(guiders): fix undefined attribute in TangentialClassifierFreeGuidance.is_conditional TangentialClassifierFreeGuidance.is_conditional reads self._num_outputs_prepared, which is not defined anywhere in the class or base class. The correct attribute name is self._count_prepared, which is set in BaseGuidance.__init__ and incremented in prepare_inputs. All other guiders use this correct attribute. This bug causes AttributeError when accessing is_conditional (and by extension is_unconditional, which is defined as not self.is_conditional). Fixes #14794 --- src/diffusers/guiders/tangential_classifier_free_guidance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diffusers/guiders/tangential_classifier_free_guidance.py b/src/diffusers/guiders/tangential_classifier_free_guidance.py index 497cdc3c463d..bbdcf8d15b29 100644 --- a/src/diffusers/guiders/tangential_classifier_free_guidance.py +++ b/src/diffusers/guiders/tangential_classifier_free_guidance.py @@ -1,4 +1,4 @@ -# Copyright 2026 The HuggingFace Team. All rights reserved. +# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -101,7 +101,7 @@ def forward(self, pred_cond: torch.Tensor, pred_uncond: torch.Tensor | None = No @property def is_conditional(self) -> bool: - return self._num_outputs_prepared == 1 + return self._count_prepared == 1 @property def num_conditions(self) -> int: