Update app.py
Browse files
app.py
CHANGED
@@ -17,19 +17,19 @@ if torch.cuda.is_available():
|
|
17 |
pipe.enable_xformers_memory_efficient_attention()
|
18 |
pipe = pipe.to(device)
|
19 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
20 |
-
|
21 |
|
22 |
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True, torch_dtype=torch.float16, variant="fp16")
|
23 |
refiner.enable_xformers_memory_efficient_attention()
|
24 |
refiner = refiner.to(device)
|
25 |
refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
|
26 |
-
|
27 |
|
28 |
upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
|
29 |
upscaler.enable_xformers_memory_efficient_attention()
|
30 |
upscaler = upscaler.to(device)
|
31 |
upscaler.unet = torch.compile(upscaler.unet, mode="reduce-overhead", fullgraph=True)
|
32 |
-
|
33 |
else:
|
34 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", use_safetensors=True)
|
35 |
pipe = pipe.to(device)
|
|
|
17 |
pipe.enable_xformers_memory_efficient_attention()
|
18 |
pipe = pipe.to(device)
|
19 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
20 |
+
torch.cuda.empty_cache()
|
21 |
|
22 |
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True, torch_dtype=torch.float16, variant="fp16")
|
23 |
refiner.enable_xformers_memory_efficient_attention()
|
24 |
refiner = refiner.to(device)
|
25 |
refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
|
26 |
+
torch.cuda.empty_cache()
|
27 |
|
28 |
upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
|
29 |
upscaler.enable_xformers_memory_efficient_attention()
|
30 |
upscaler = upscaler.to(device)
|
31 |
upscaler.unet = torch.compile(upscaler.unet, mode="reduce-overhead", fullgraph=True)
|
32 |
+
torch.cuda.empty_cache()
|
33 |
else:
|
34 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", use_safetensors=True)
|
35 |
pipe = pipe.to(device)
|