From 3a4501394c2887a38a84f941a4821a760e68db21 Mon Sep 17 00:00:00 2001 From: Tai An Date: Thu, 4 Jun 2026 12:20:30 -0700 Subject: [PATCH] fix(cosmos2_5_predict): guard text safety check with isinstance like video path The video safety branch guards with isinstance(self.safety_checker, CosmosSafetyChecker), but the text safety branch only checks 'is not None'. When safety_checker is a non-None object that is not a CosmosSafetyChecker, the text path raises AttributeError on check_text_safety. Align the two guards so the text path degrades gracefully like the video path. --- src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py b/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py index 581711205814..d23c4b42306d 100644 --- a/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py +++ b/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py @@ -664,7 +664,7 @@ def __call__( device = self._execution_device - if self.safety_checker is not None: + if isinstance(self.safety_checker, CosmosSafetyChecker): self.safety_checker.to(device) if prompt is not None: prompt_list = [prompt] if isinstance(prompt, str) else prompt