Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,16 +18,15 @@ pipe = pipe.to(device)
|
|
18 |
pipe.enable_xformers_memory_efficient_attention()
|
19 |
torch.cuda.empty_cache()
|
20 |
|
21 |
-
|
22 |
-
refiner = refiner.to(device)
|
23 |
-
#refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
|
24 |
-
refiner.enable_xformers_memory_efficient_attention()
|
25 |
-
torch.cuda.empty_cache()
|
26 |
|
27 |
def genie (prompt, negative_prompt, scale, steps, seed):
|
28 |
torch.cuda.empty_cache()
|
29 |
generator = torch.Generator(device=device).manual_seed(seed)
|
30 |
int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, guidance_scale=scale, num_images_per_prompt=1, generator=generator, width=768, height=768, output_type="latent").images
|
|
|
|
|
|
|
31 |
torch.cuda.empty_cache()
|
32 |
image = refiner(prompt=prompt, image=int_image).images[0]
|
33 |
return image
|
|
|
18 |
pipe.enable_xformers_memory_efficient_attention()
|
19 |
torch.cuda.empty_cache()
|
20 |
|
21 |
+
|
|
|
|
|
|
|
|
|
22 |
|
23 |
def genie (prompt, negative_prompt, scale, steps, seed):
|
24 |
torch.cuda.empty_cache()
|
25 |
generator = torch.Generator(device=device).manual_seed(seed)
|
26 |
int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, guidance_scale=scale, num_images_per_prompt=1, generator=generator, width=768, height=768, output_type="latent").images
|
27 |
+
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
28 |
+
refiner = refiner.to(device)
|
29 |
+
refiner.enable_xformers_memory_efficient_attention()
|
30 |
torch.cuda.empty_cache()
|
31 |
image = refiner(prompt=prompt, image=int_image).images[0]
|
32 |
return image
|