pengdaqian commited on
Commit
fb1826c
1 Parent(s): 1960aa0

warm up model

Browse files
Files changed (1) hide show
  1. img_nsfw.py +2 -2
img_nsfw.py CHANGED
@@ -79,8 +79,8 @@ def check_nsfw(img, pipe):
79
  if torch.cuda.is_available():
80
  safety_checker_input = safety_checker_input.to('cuda')
81
  else:
82
- safety_checker_input = safety_checker_input.half()
83
  from torch.cuda.amp import autocast
84
  with autocast():
85
- _, nsfw_tags = pipe.safety_checker.forward(clip_input=safety_checker_input.pixel_values, images=img)
86
  return nsfw_tags
 
79
  if torch.cuda.is_available():
80
  safety_checker_input = safety_checker_input.to('cuda')
81
  else:
82
+ safety_checker_input = safety_checker_input
83
  from torch.cuda.amp import autocast
84
  with autocast():
85
+ _, nsfw_tags = pipe.safety_checker.forward(clip_input=safety_checker_input.pixel_values.half(), images=img)
86
  return nsfw_tags