Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 673b0ab

Browse files
committedAug 22, 2022
update safety model id
1 parent a6e2f3b commit 673b0ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎scripts/txt2img.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from transformers import AutoFeatureExtractor
2121

2222
# 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)
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)
2626

2727
def chunk(it, size):
2828
it = iter(it)
@@ -272,7 +272,7 @@ def main():
272272
safety_checker_input = safety_feature_extractor(numpy_to_pil(x_image), return_tensors="pt")
273273
x_checked_image, has_nsfw_concept = safety_checker(images=x_image, clip_input=safety_checker_input.pixel_values)
274274

275-
x_checked_image_torch = torch.from_numpy(x_checked_image).permute(0, 3, 2, 1)
275+
x_checked_image_torch = torch.from_numpy(x_checked_image).permute(0, 3, 1, 2)
276276

277277
if not opt.skip_save:
278278
for x_sample in x_checked_image_torch:

0 commit comments

Comments
 (0)
Failed to load comments.