1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-29 07:22:12 +03:00

safety checker

This commit is contained in:
Aryan
2025-06-11 16:46:11 +02:00
parent 2d0174063c
commit a1cb44f09c
2 changed files with 16 additions and 16 deletions

View File

@@ -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

View File

@@ -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