Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ torch_dtype = torch.bfloat16
|
|
| 53 |
|
| 54 |
checkpoint = "microsoft/Phi-3.5-mini-instruct"
|
| 55 |
#vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
| 56 |
-
vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16)
|
| 57 |
|
| 58 |
pipe = StableDiffusion3Pipeline.from_pretrained("ford442/stable-diffusion-3.5-medium-bf16", torch_dtype=torch.bfloat16)
|
| 59 |
#pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium", token=hftoken, torch_dtype=torch.float32, device_map='balanced')
|
|
@@ -139,15 +139,16 @@ def infer(
|
|
| 139 |
print('-- filtered prompt --')
|
| 140 |
print(enhanced_prompt)
|
| 141 |
print('-- generating image --')
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
|
|
|
| 151 |
print('-- got image --')
|
| 152 |
image_path = f"sd35m_{seed}.png"
|
| 153 |
sd_image.save(image_path,optimize=False,compress_level=0)
|
|
|
|
| 53 |
|
| 54 |
checkpoint = "microsoft/Phi-3.5-mini-instruct"
|
| 55 |
#vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
| 56 |
+
#vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16)
|
| 57 |
|
| 58 |
pipe = StableDiffusion3Pipeline.from_pretrained("ford442/stable-diffusion-3.5-medium-bf16", torch_dtype=torch.bfloat16)
|
| 59 |
#pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium", token=hftoken, torch_dtype=torch.float32, device_map='balanced')
|
|
|
|
| 139 |
print('-- filtered prompt --')
|
| 140 |
print(enhanced_prompt)
|
| 141 |
print('-- generating image --')
|
| 142 |
+
with torch.no_grad():
|
| 143 |
+
sd_image = pipe(
|
| 144 |
+
prompt=enhanced_prompt, # This conversion is fine
|
| 145 |
+
negative_prompt=negative_prompt,
|
| 146 |
+
guidance_scale=guidance_scale,
|
| 147 |
+
num_inference_steps=num_inference_steps,
|
| 148 |
+
width=width,
|
| 149 |
+
height=height,
|
| 150 |
+
generator=generator
|
| 151 |
+
).images[0]
|
| 152 |
print('-- got image --')
|
| 153 |
image_path = f"sd35m_{seed}.png"
|
| 154 |
sd_image.save(image_path,optimize=False,compress_level=0)
|