huzey commited on
Commit
0daddbf
1 Parent(s): a9ab6e3
Files changed (1) hide show
  1. backbone.py +6 -2
backbone.py CHANGED
@@ -40,7 +40,7 @@ class SAM2(nn.Module):
40
  f.write(r.content)
41
  sam2_checkpoint = filename
42
 
43
- device = 'cuda' if torch.cuda.is_available() else 'cpu'
44
  sam2_model = build_sam2(model_cfg, sam2_checkpoint, device=device)
45
 
46
  image_encoder = sam2_model.image_encoder
@@ -835,7 +835,11 @@ RES_DICT["ImageNet(vit_base)"] = (672, 672)
835
  def download_all_models():
836
  for model_name in MODEL_DICT:
837
  print(f"Downloading {model_name}")
838
- model = MODEL_DICT[model_name]()
 
 
 
 
839
 
840
  def get_all_model_names():
841
  return list(MODEL_DICT.keys())
 
40
  f.write(r.content)
41
  sam2_checkpoint = filename
42
 
43
+ device = 'cpu'
44
  sam2_model = build_sam2(model_cfg, sam2_checkpoint, device=device)
45
 
46
  image_encoder = sam2_model.image_encoder
 
835
  def download_all_models():
836
  for model_name in MODEL_DICT:
837
  print(f"Downloading {model_name}")
838
+ try:
839
+ model = MODEL_DICT[model_name]()
840
+ except Exception as e:
841
+ print(f"Error downloading {model_name}: {e}")
842
+ continue
843
 
844
  def get_all_model_names():
845
  return list(MODEL_DICT.keys())