AdamOswald1 commited on
Commit
8a20a1a
·
1 Parent(s): 2ead1b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -25
app.py CHANGED
@@ -8,8 +8,6 @@ import time
8
  import psutil
9
  import random
10
 
11
- CUDA_LAUNCH_BLOCKING=1
12
-
13
  start_time = time.time()
14
  is_colab = utils.is_google_colab()
15
  state = None
@@ -88,19 +86,10 @@ else:
88
  torch_dtype=torch.get_default_dtype(),
89
  scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
90
  )
91
-
92
- if torch.cuda.is_available():
93
- pipe = pipe.to("cuda")
94
- pipe.enable_xformers_memory_efficient_attention()
95
 
96
- def to_cuda(torch, pipe):
97
- try:
98
  if torch.cuda.is_available():
99
  pipe = pipe.to("cuda")
100
  pipe.enable_xformers_memory_efficient_attention()
101
- return True
102
- except:
103
- return False
104
 
105
  device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
106
 
@@ -188,16 +177,9 @@ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width,
188
  # pipe = pipe.to("cpu")
189
  # pipe = current_model.pipe_t2i
190
 
191
- to_cuda(torch, pipe)
192
-
193
- def to_cuda(torch, pipe):
194
- try:
195
  if torch.cuda.is_available():
196
  pipe = pipe.to("cuda")
197
  pipe.enable_xformers_memory_efficient_attention()
198
- return True
199
- except:
200
- return False
201
  last_mode = "txt2img"
202
 
203
  prompt = current_model.prefix + prompt
@@ -244,16 +226,9 @@ def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance
244
  # pipe = pipe.to("cpu")
245
  # pipe = current_model.pipe_i2i
246
 
247
- to_cuda(torch, pipe)
248
-
249
- def to_cuda(torch, pipe):
250
- try:
251
  if torch.cuda.is_available():
252
  pipe = pipe.to("cuda")
253
  pipe.enable_xformers_memory_efficient_attention()
254
- return True
255
- except:
256
- return False
257
  last_mode = "img2img"
258
 
259
  prompt = current_model.prefix + prompt
 
8
  import psutil
9
  import random
10
 
 
 
11
  start_time = time.time()
12
  is_colab = utils.is_google_colab()
13
  state = None
 
86
  torch_dtype=torch.get_default_dtype(),
87
  scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
88
  )
 
 
 
 
89
 
 
 
90
  if torch.cuda.is_available():
91
  pipe = pipe.to("cuda")
92
  pipe.enable_xformers_memory_efficient_attention()
 
 
 
93
 
94
  device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
95
 
 
177
  # pipe = pipe.to("cpu")
178
  # pipe = current_model.pipe_t2i
179
 
 
 
 
 
180
  if torch.cuda.is_available():
181
  pipe = pipe.to("cuda")
182
  pipe.enable_xformers_memory_efficient_attention()
 
 
 
183
  last_mode = "txt2img"
184
 
185
  prompt = current_model.prefix + prompt
 
226
  # pipe = pipe.to("cpu")
227
  # pipe = current_model.pipe_i2i
228
 
 
 
 
 
229
  if torch.cuda.is_available():
230
  pipe = pipe.to("cuda")
231
  pipe.enable_xformers_memory_efficient_attention()
 
 
 
232
  last_mode = "img2img"
233
 
234
  prompt = current_model.prefix + prompt