KaiChen1998 commited on
Commit
a4e6839
·
1 Parent(s): 0a2ac2e

add torch cuda empty cache for oom

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -308,7 +308,11 @@ def http_bot(state, temperature, top_p, max_new_tokens, speaker):
308
 
309
  id = str(uuid.uuid4())
310
  os.makedirs("./demo_audio", exist_ok=True)
311
- synthesis(content_unit, style_centroid_embedding, hps, net_g, f"./demo_audio/{id}_temp_audio.wav")
 
 
 
 
312
  temp_file = f"./demo_audio/{id}_temp_audio.wav"
313
  except Exception as e:
314
  os.system("nvidia-smi")
 
308
 
309
  id = str(uuid.uuid4())
310
  os.makedirs("./demo_audio", exist_ok=True)
311
+ try:
312
+ synthesis(content_unit, style_centroid_embedding, hps, net_g, f"./demo_audio/{id}_temp_audio.wav")
313
+ except:
314
+ torch.cuda.empty_cache()
315
+ synthesis(content_unit, style_centroid_embedding, hps, net_g, f"./demo_audio/{id}_temp_audio.wav")
316
  temp_file = f"./demo_audio/{id}_temp_audio.wav"
317
  except Exception as e:
318
  os.system("nvidia-smi")