nsfwalex commited on
Commit
aada3b3
1 Parent(s): 65a5401

Update inference_manager.py

Browse files
Files changed (1) hide show
  1. inference_manager.py +2 -1
inference_manager.py CHANGED
@@ -476,6 +476,8 @@ class ModelManager:
476
 
477
  @spaces.GPU(duration=40)
478
  def generate_with_faceid(self, model_id, inference_params, progress=gr.Progress(track_tqdm=True)):
 
 
479
  model = self.models.get(model_id)
480
  if not model:
481
  raise Exception(f"invalid model_id {model_id}")
@@ -507,7 +509,6 @@ class ModelManager:
507
  faceid_all_embeds = []
508
  for image in images:
509
  face = image#cv2.imread(image)
510
- print(image)
511
  faces = self.app.get(face)
512
  faceid_embed = torch.from_numpy(faces[0].normed_embedding).unsqueeze(0)
513
  faceid_all_embeds.append(faceid_embed)
 
476
 
477
  @spaces.GPU(duration=40)
478
  def generate_with_faceid(self, model_id, inference_params, progress=gr.Progress(track_tqdm=True)):
479
+ # Clear GPU memory
480
+ torch.cuda.empty_cache()
481
  model = self.models.get(model_id)
482
  if not model:
483
  raise Exception(f"invalid model_id {model_id}")
 
509
  faceid_all_embeds = []
510
  for image in images:
511
  face = image#cv2.imread(image)
 
512
  faces = self.app.get(face)
513
  faceid_embed = torch.from_numpy(faces[0].normed_embedding).unsqueeze(0)
514
  faceid_all_embeds.append(faceid_embed)