Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions trident/patch_encoder_models/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def _get_weights_path(self) -> str:
else, use the path from the registry.
"""
if self.weights_path:
self.ensure_valid_weights_path(self.weights_path)
# self.ensure_valid_weights_path(self.weights_path)
return self.weights_path
else:
weights_path = get_weights_path('patch', self.enc_name)
self.ensure_valid_weights_path(weights_path)
# self.ensure_valid_weights_path(weights_path)
return weights_path

def forward(self, x: torch.Tensor) -> torch.Tensor:
Expand Down Expand Up @@ -214,7 +214,8 @@ def _build(self, inference_aug=False, with_proj=False, out_norm=False, return_gl
weights_path = self._get_weights_path()

if weights_path:
raise NotImplementedError("MUSK doesn't support local model loading. PR welcome!")
model = timm.create_model("musk_large_patch16_384")
utils.load_model_and_may_interpolate("hf_hub:xiangjx/musk", model, 'model|module', '', local_dir=weights_path)
else:
self.ensure_has_internet(self.enc_name)
try:
Expand Down Expand Up @@ -410,7 +411,7 @@ def _build(self):
weights_path = self._get_weights_path()

if weights_path:
raise NotImplementedError("Hibou-Large doesn't support local model loading. PR welcome!")
model = AutoModel.from_pretrained(weights_path, trust_remote_code=True, local_files_only=True)
else:
self.ensure_has_internet(self.enc_name)
try:
Expand Down
4 changes: 2 additions & 2 deletions trident/patch_encoder_models/local_ckpts.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"hoptimus0": "",
"hoptimus1": "",
"phikon_v2": "",
"hibou_l": "",
"hibou_l": "D:/trident_cache/huggingface/hub/models--histai--hibou-L/snapshots/31a3b9fee16554c8552cb643d311733bce8faf7c",
"kaiko-vitb8": "",
"kaiko-vitb16": "",
"kaiko-vits8": "",
"kaiko-vits16": "",
"kaiko-vitl14": "",
"lunit-vits8": "",
"conch_v15": "",
"musk": "",
"musk": "D:/trident_cache/huggingface/hub/models--xiangjx--musk",
"custom_encoder": ""
}