From a1cb44f09c4918ce7136d101670dff7181b14a4f Mon Sep 17 00:00:00 2001 From: Aryan Date: Wed, 11 Jun 2025 16:46:11 +0200 Subject: [PATCH] safety checker --- .../cosmos/pipeline_cosmos2_text2image.py | 16 ++++++++-------- .../cosmos/pipeline_cosmos2_video2world.py | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py b/src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py index 1d00c12ffa..4349e3a23e 100644 --- a/src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py +++ b/src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py @@ -171,8 +171,8 @@ class Cosmos2TextToImagePipeline(DiffusionPipeline): ): super().__init__() - # if safety_checker is None: - # safety_checker = CosmosSafetyChecker() + if safety_checker is None: + safety_checker = CosmosSafetyChecker() self.register_modules( vae=vae, @@ -474,12 +474,12 @@ class Cosmos2TextToImagePipeline(DiffusionPipeline): indicating whether the corresponding generated image contains "not-safe-for-work" (nsfw) content. """ - # if self.safety_checker is None: - # raise ValueError( - # f"You have disabled the safety checker for {self.__class__}. This is in violation of the " - # "[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). " - # f"Please ensure that you are compliant with the license agreement." - # ) + if self.safety_checker is None: + raise ValueError( + f"You have disabled the safety checker for {self.__class__}. This is in violation of the " + "[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). " + f"Please ensure that you are compliant with the license agreement." + ) if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)): callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs diff --git a/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py b/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py index e33612d066..f2a70c14b9 100644 --- a/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py +++ b/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py @@ -190,8 +190,8 @@ class Cosmos2VideoToWorldPipeline(DiffusionPipeline): ): super().__init__() - # if safety_checker is None: - # safety_checker = CosmosSafetyChecker() + if safety_checker is None: + safety_checker = CosmosSafetyChecker() self.register_modules( vae=vae, @@ -561,12 +561,12 @@ class Cosmos2VideoToWorldPipeline(DiffusionPipeline): indicating whether the corresponding generated image contains "not-safe-for-work" (nsfw) content. """ - # if self.safety_checker is None: - # raise ValueError( - # f"You have disabled the safety checker for {self.__class__}. This is in violation of the " - # "[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). " - # f"Please ensure that you are compliant with the license agreement." - # ) + if self.safety_checker is None: + raise ValueError( + f"You have disabled the safety checker for {self.__class__}. This is in violation of the " + "[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). " + f"Please ensure that you are compliant with the license agreement." + ) if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)): callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs