Spaces:
Running
Running
Trying to add CPU support
Browse files
app.py
CHANGED
@@ -86,7 +86,7 @@ if SAFETY_CHECKER:
|
|
86 |
|
87 |
safety_checker = StableDiffusionSafetyChecker.from_pretrained(
|
88 |
"CompVis/stable-diffusion-safety-checker"
|
89 |
-
).to(
|
90 |
feature_extractor = CLIPFeatureExtractor.from_pretrained(
|
91 |
"openai/clip-vit-base-patch32"
|
92 |
)
|
@@ -126,7 +126,7 @@ def generate_image(prompt, ckpt, aspect_ratio, mode):
|
|
126 |
# Ensure sampler uses "trailing" timesteps.
|
127 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
|
128 |
|
129 |
-
pipe.unet.load_state_dict(load_file(hf_hub_download(repo, checkpoint), device=
|
130 |
results = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=0, width=width, height=height )
|
131 |
|
132 |
if SAFETY_CHECKER:
|
|
|
86 |
|
87 |
safety_checker = StableDiffusionSafetyChecker.from_pretrained(
|
88 |
"CompVis/stable-diffusion-safety-checker"
|
89 |
+
).to(device)
|
90 |
feature_extractor = CLIPFeatureExtractor.from_pretrained(
|
91 |
"openai/clip-vit-base-patch32"
|
92 |
)
|
|
|
126 |
# Ensure sampler uses "trailing" timesteps.
|
127 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
|
128 |
|
129 |
+
pipe.unet.load_state_dict(load_file(hf_hub_download(repo, checkpoint), device=device)
|
130 |
results = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=0, width=width, height=height )
|
131 |
|
132 |
if SAFETY_CHECKER:
|