liuyizhang commited on
Commit
7957dbb
1 Parent(s): ed7763f

update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -60,7 +60,7 @@ def load_model_hf(model_config_path, repo_id, filename, device='cpu'):
60
  args.device = device
61
 
62
  cache_file = hf_hub_download(repo_id=repo_id, filename=filename)
63
- checkpoint = torch.load(cache_file, map_location='cpu')
64
  log = model.load_state_dict(clean_state_dict(checkpoint['model']), strict=False)
65
  print("Model loaded from {} \n => {}".format(cache_file, log))
66
  _ = model.eval()
@@ -227,6 +227,7 @@ def run_grounded_sam(image_path, text_prompt, task_type, inpaint_prompt, box_thr
227
  except:
228
  warnings.warn("Failed to load custom C++ ops. Running on CPU mode Only in groundingdino!")
229
 
 
230
  boxes_filt, pred_phrases = get_grounding_output(
231
  groundingdino_model, image, text_prompt, box_threshold, text_threshold, device=groundingdino_device
232
  )
 
60
  args.device = device
61
 
62
  cache_file = hf_hub_download(repo_id=repo_id, filename=filename)
63
+ checkpoint = torch.load(cache_file, map_location=device)
64
  log = model.load_state_dict(clean_state_dict(checkpoint['model']), strict=False)
65
  print("Model loaded from {} \n => {}".format(cache_file, log))
66
  _ = model.eval()
 
227
  except:
228
  warnings.warn("Failed to load custom C++ ops. Running on CPU mode Only in groundingdino!")
229
 
230
+ groundingdino_device = 'cpu'
231
  boxes_filt, pred_phrases = get_grounding_output(
232
  groundingdino_model, image, text_prompt, box_threshold, text_threshold, device=groundingdino_device
233
  )