genevera commited on
Commit
0c0d5ca
1 Parent(s): 1a8a5f1

dont use xformers if cuda isnt available

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -228,7 +228,9 @@ def greet(audio, steps=25, scheduler="ddpm"):
228
  scheduler=use_sched,
229
  safety_checker=None,
230
  ).to(device)
231
- pipeline.enable_xformers_memory_efficient_attention()
 
 
232
 
233
  # print(f"taking {steps} steps using the {scheduler} scheduler")
234
  image = pipeline(
 
228
  scheduler=use_sched,
229
  safety_checker=None,
230
  ).to(device)
231
+ pipeline.enable_attention_slicing()
232
+ if torch.cuda.is_available():
233
+ pipeline.enable_xformers_memory_efficient_attention()
234
 
235
  # print(f"taking {steps} steps using the {scheduler} scheduler")
236
  image = pipeline(