Spaces:
Running
on
A10G
Running
on
A10G
RohitGandikota
commited on
Commit
·
0130cd3
1
Parent(s):
926c7ec
fixing cuda issues
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ class Demo:
|
|
48 |
self.generating = False
|
49 |
self.device = 'cuda'
|
50 |
self.weight_dtype = torch.float16
|
51 |
-
self.pipe = StableDiffusionXLPipeline.from_pretrained('stabilityai/stable-diffusion-xl-base-1.0', torch_dtype=self.weight_dtype).to(
|
52 |
self.pipe.enable_xformers_memory_efficient_attention()
|
53 |
with gr.Blocks() as demo:
|
54 |
self.layout()
|
@@ -268,7 +268,6 @@ class Demo:
|
|
268 |
generator = torch.manual_seed(seed)
|
269 |
|
270 |
model_path = model_map[model_name]
|
271 |
-
self.pipe = self.pipe.to(self.device)
|
272 |
unet = self.pipe.unet
|
273 |
network_type = "c3lier"
|
274 |
if 'full' in model_path:
|
@@ -311,7 +310,6 @@ class Demo:
|
|
311 |
del unet, network
|
312 |
unet = None
|
313 |
network = None
|
314 |
-
self.pipe = self.pipe.to('cpu')
|
315 |
torch.cuda.empty_cache()
|
316 |
|
317 |
return edited_image, original_image
|
|
|
48 |
self.generating = False
|
49 |
self.device = 'cuda'
|
50 |
self.weight_dtype = torch.float16
|
51 |
+
self.pipe = StableDiffusionXLPipeline.from_pretrained('stabilityai/stable-diffusion-xl-base-1.0', torch_dtype=self.weight_dtype).to(self.device)
|
52 |
self.pipe.enable_xformers_memory_efficient_attention()
|
53 |
with gr.Blocks() as demo:
|
54 |
self.layout()
|
|
|
268 |
generator = torch.manual_seed(seed)
|
269 |
|
270 |
model_path = model_map[model_name]
|
|
|
271 |
unet = self.pipe.unet
|
272 |
network_type = "c3lier"
|
273 |
if 'full' in model_path:
|
|
|
310 |
del unet, network
|
311 |
unet = None
|
312 |
network = None
|
|
|
313 |
torch.cuda.empty_cache()
|
314 |
|
315 |
return edited_image, original_image
|