Patrick Esser commited on
Commit
6a0fc9c
β€’
1 Parent(s): b187a22

update safety model id

Browse files

Former-commit-id: 673b0ab3a303fa539f950db00525f2e2bb0ce60e

Files changed (1) hide show
  1. scripts/txt2img.py +4 -4
scripts/txt2img.py CHANGED
@@ -20,9 +20,9 @@ from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionS
20
  from transformers import AutoFeatureExtractor
21
 
22
  # load safety model
23
- safety_model_id = "CompVis/stable-diffusion-v-1-3"
24
- safety_feature_extractor = AutoFeatureExtractor.from_pretrained(safety_model_id, use_auth_token=True)
25
- safety_checker = StableDiffusionSafetyChecker.from_pretrained(safety_model_id, use_auth_token=True)
26
 
27
  def chunk(it, size):
28
  it = iter(it)
@@ -272,7 +272,7 @@ def main():
272
  safety_checker_input = safety_feature_extractor(numpy_to_pil(x_image), return_tensors="pt")
273
  x_checked_image, has_nsfw_concept = safety_checker(images=x_image, clip_input=safety_checker_input.pixel_values)
274
 
275
- x_checked_image_torch = torch.from_numpy(x_checked_image).permute(0, 3, 2, 1)
276
 
277
  if not opt.skip_save:
278
  for x_sample in x_checked_image_torch:
 
20
  from transformers import AutoFeatureExtractor
21
 
22
  # load safety model
23
+ safety_model_id = "CompVis/stable-diffusion-safety-checker"
24
+ safety_feature_extractor = AutoFeatureExtractor.from_pretrained(safety_model_id)
25
+ safety_checker = StableDiffusionSafetyChecker.from_pretrained(safety_model_id)
26
 
27
  def chunk(it, size):
28
  it = iter(it)
 
272
  safety_checker_input = safety_feature_extractor(numpy_to_pil(x_image), return_tensors="pt")
273
  x_checked_image, has_nsfw_concept = safety_checker(images=x_image, clip_input=safety_checker_input.pixel_values)
274
 
275
+ x_checked_image_torch = torch.from_numpy(x_checked_image).permute(0, 3, 1, 2)
276
 
277
  if not opt.skip_save:
278
  for x_sample in x_checked_image_torch: