Skip to content

Commit b141a17

Browse files
authored
Use the force_filename parameter with hf_hub_download() (#93)
1 parent 6b60ba3 commit b141a17

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

samgeo/text_sam.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""The LangSAM model for segmenting objects from satellite images using text prompts.
1+
"""The LangSAM model for segmenting objects from satellite images using text prompts.
22
The source code is adapted from the https://github.com/luca-medeiros/lang-segment-anything repository.
33
Credits to Luca Medeiros for the original implementation.
44
"""
@@ -65,11 +65,11 @@ def load_model_hf(
6565
torch.nn.Module: The loaded model.
6666
"""
6767

68-
cache_config_file = hf_hub_download(repo_id=repo_id, filename=ckpt_config_filename)
68+
cache_config_file = hf_hub_download(repo_id=repo_id, filename=ckpt_config_filename, force_filename=ckpt_config_filename)
6969
args = SLConfig.fromfile(cache_config_file)
7070
model = build_model(args)
7171
model.to(device)
72-
cache_file = hf_hub_download(repo_id=repo_id, filename=filename)
72+
cache_file = hf_hub_download(repo_id=repo_id, filename=filename, force_filename=filename)
7373
checkpoint = torch.load(cache_file, map_location="cpu")
7474
model.load_state_dict(clean_state_dict(checkpoint["model"]), strict=False)
7575
model.eval()

0 commit comments

Comments
 (0)