PierrunoYT 6Morpheus6 commited on
Commit
700533c
·
verified ·
1 Parent(s): f3776a9

clear cache (#1)

Browse files

- clear cache (39092efb8eaaa023e127f4fdd1244b958ed79763)


Co-authored-by: Morpheus <[email protected]>

Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import spaces
2
  from snac import SNAC
3
  import torch
@@ -173,6 +174,10 @@ def generate_speech(text, model_choice, temperature, top_p, repetition_penalty,
173
  audio_samples = redistribute_codes(code_list, snac_model)
174
 
175
  progress(1.0, "✅ Completed!")
 
 
 
 
176
  return (24000, audio_samples)
177
  except Exception as e:
178
  print(f"Error generating speech: {e}")
 
1
+ import gc
2
  import spaces
3
  from snac import SNAC
4
  import torch
 
174
  audio_samples = redistribute_codes(code_list, snac_model)
175
 
176
  progress(1.0, "✅ Completed!")
177
+
178
+ gc.collect()
179
+ torch.cuda.empty_cache()
180
+
181
  return (24000, audio_samples)
182
  except Exception as e:
183
  print(f"Error generating speech: {e}")