Kai422kx commited on
Commit
0bc2276
·
1 Parent(s): b5aae13

clean cache

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -7,7 +7,7 @@ import gradio as gr
7
  import uuid
8
  import glob
9
  import re
10
-
11
  import spaces
12
 
13
  subprocess.run(shlex.split("pip install wheel/diff_gaussian_rasterization-0.0.0-cp310-cp310-linux_x86_64.whl --force-reinstall"))
@@ -70,10 +70,18 @@ def process(inputfiles, input_path='demo'):
70
  cmd(f"python utils/rearrange.py --output_dir={output_path}")
71
  output_path = f'{output_path}_rearranged'
72
 
 
 
 
 
73
  print(output_path)
74
  cmd(f"python train_gui.py -s {output_path} -m {output_path} --iter 2000")
75
  cmd(f"python render.py -s {output_path} -m {output_path} --iter 2000 --get_video")
76
 
 
 
 
 
77
  output_video_path = f"{output_path}/rendered.mp4"
78
  output_ply_path = f"{output_path}/point_cloud/iteration_2000/point_cloud.ply"
79
  return output_video_path, output_ply_path, output_ply_path
 
7
  import uuid
8
  import glob
9
  import re
10
+ import torch
11
  import spaces
12
 
13
  subprocess.run(shlex.split("pip install wheel/diff_gaussian_rasterization-0.0.0-cp310-cp310-linux_x86_64.whl --force-reinstall"))
 
70
  cmd(f"python utils/rearrange.py --output_dir={output_path}")
71
  output_path = f'{output_path}_rearranged'
72
 
73
+ # Clean up CUDA memory
74
+ gc.collect()
75
+ if torch.cuda.is_available():
76
+ torch.cuda.empty_cache()
77
  print(output_path)
78
  cmd(f"python train_gui.py -s {output_path} -m {output_path} --iter 2000")
79
  cmd(f"python render.py -s {output_path} -m {output_path} --iter 2000 --get_video")
80
 
81
+ gc.collect()
82
+ if torch.cuda.is_available():
83
+ torch.cuda.empty_cache()
84
+
85
  output_video_path = f"{output_path}/rendered.mp4"
86
  output_ply_path = f"{output_path}/point_cloud/iteration_2000/point_cloud.ply"
87
  return output_video_path, output_ply_path, output_ply_path