"vscode:/vscode.git/clone" did not exist on "e141a93e0107de466f5e1c2f33dae5621d3ddd21"
Unverified Commit 210a07b1 authored by Yusuke Suzuki's avatar Yusuke Suzuki Committed by GitHub
Browse files

fix exception around NSFW filter on flax stable diffusion (#5675)

parent 0a0ebc7c
......@@ -410,13 +410,13 @@ class FlaxStableDiffusionPipeline(FlaxDiffusionPipeline):
images_uint8_casted = np.asarray(images_uint8_casted).reshape(num_devices * batch_size, height, width, 3)
images_uint8_casted, has_nsfw_concept = self._run_safety_checker(images_uint8_casted, safety_params, jit)
images = np.asarray(images)
images = np.asarray(images).copy()
# block images
if any(has_nsfw_concept):
for i, is_nsfw in enumerate(has_nsfw_concept):
if is_nsfw:
images[i] = np.asarray(images_uint8_casted[i])
images[i, 0] = np.asarray(images_uint8_casted[i])
images = images.reshape(num_devices, batch_size, height, width, 3)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment