Twelve2five commited on
Commit
f21c9d9
·
verified ·
1 Parent(s): f55ecaa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -258,6 +258,15 @@ def load_dataset():
258
 
259
  return hf_dataset
260
 
 
 
 
 
 
 
 
 
 
261
  def train_model(progress=gr.Progress()):
262
  # Clean memory before starting
263
  clean_memory()
@@ -373,13 +382,4 @@ if __name__ == "__main__":
373
 
374
  # Create and launch the UI
375
  demo = create_ui()
376
- demo.launch()
377
-
378
- # Memory cleaning function
379
- def clean_memory():
380
- gc.collect()
381
- if torch.cuda.is_available():
382
- for i in range(torch.cuda.device_count()):
383
- with torch.cuda.device(f'cuda:{i}'):
384
- torch.cuda.empty_cache()
385
- torch.cuda.reset_peak_memory_stats()
 
258
 
259
  return hf_dataset
260
 
261
+ # Memory cleaning function
262
+ def clean_memory():
263
+ gc.collect()
264
+ if torch.cuda.is_available():
265
+ for i in range(torch.cuda.device_count()):
266
+ with torch.cuda.device(f'cuda:{i}'):
267
+ torch.cuda.empty_cache()
268
+ torch.cuda.reset_peak_memory_stats()
269
+
270
  def train_model(progress=gr.Progress()):
271
  # Clean memory before starting
272
  clean_memory()
 
382
 
383
  # Create and launch the UI
384
  demo = create_ui()
385
+ demo.launch()