hysts HF staff commited on
Commit
0816898
1 Parent(s): 6a6f2a6
Files changed (1) hide show
  1. model.py +3 -0
model.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import tempfile
2
 
3
  import numpy as np
@@ -78,6 +79,8 @@ class Model:
78
  return
79
  self.model = load_model(model_name, device=self.device)
80
  self.model_name = model_name
 
 
81
 
82
  def to_glb(self, latent: torch.Tensor) -> str:
83
  ply_path = tempfile.NamedTemporaryFile(suffix='.ply',
 
1
+ import gc
2
  import tempfile
3
 
4
  import numpy as np
 
79
  return
80
  self.model = load_model(model_name, device=self.device)
81
  self.model_name = model_name
82
+ gc.collect()
83
+ torch.cuda.empty_cache()
84
 
85
  def to_glb(self, latent: torch.Tensor) -> str:
86
  ply_path = tempfile.NamedTemporaryFile(suffix='.ply',