Spaces:
Running
on
Zero
Running
on
Zero
fix sam2
Browse files- 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 = '
|
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 |
-
|
|
|
|
|
|
|
|
|
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())
|