Skip to content

Commit a1cb44f

Browse files
committed
safety checker
1 parent 2d01740 commit a1cb44f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ def __init__(
171171
):
172172
super().__init__()
173173

174-
# if safety_checker is None:
175-
# safety_checker = CosmosSafetyChecker()
174+
if safety_checker is None:
175+
safety_checker = CosmosSafetyChecker()
176176

177177
self.register_modules(
178178
vae=vae,
@@ -474,12 +474,12 @@ def __call__(
474474
indicating whether the corresponding generated image contains "not-safe-for-work" (nsfw) content.
475475
"""
476476

477-
# if self.safety_checker is None:
478-
# raise ValueError(
479-
# f"You have disabled the safety checker for {self.__class__}. This is in violation of the "
480-
# "[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). "
481-
# f"Please ensure that you are compliant with the license agreement."
482-
# )
477+
if self.safety_checker is None:
478+
raise ValueError(
479+
f"You have disabled the safety checker for {self.__class__}. This is in violation of the "
480+
"[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). "
481+
f"Please ensure that you are compliant with the license agreement."
482+
)
483483

484484
if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)):
485485
callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs

src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ def __init__(
190190
):
191191
super().__init__()
192192

193-
# if safety_checker is None:
194-
# safety_checker = CosmosSafetyChecker()
193+
if safety_checker is None:
194+
safety_checker = CosmosSafetyChecker()
195195

196196
self.register_modules(
197197
vae=vae,
@@ -561,12 +561,12 @@ def __call__(
561561
indicating whether the corresponding generated image contains "not-safe-for-work" (nsfw) content.
562562
"""
563563

564-
# if self.safety_checker is None:
565-
# raise ValueError(
566-
# f"You have disabled the safety checker for {self.__class__}. This is in violation of the "
567-
# "[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). "
568-
# f"Please ensure that you are compliant with the license agreement."
569-
# )
564+
if self.safety_checker is None:
565+
raise ValueError(
566+
f"You have disabled the safety checker for {self.__class__}. This is in violation of the "
567+
"[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). "
568+
f"Please ensure that you are compliant with the license agreement."
569+
)
570570

571571
if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)):
572572
callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs

0 commit comments

Comments
 (0)