Skip to content

Commit 2f750c0

Browse files
committed
default weights_only=True for load fns
1 parent fa0d31e commit 2f750c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

timm/models/_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def load_state_dict(
4545
checkpoint_path: str,
4646
use_ema: bool = True,
4747
device: Union[str, torch.device] = 'cpu',
48-
weights_only: bool = False,
48+
weights_only: bool = True,
4949
) -> Dict[str, Any]:
5050
"""Load state dictionary from checkpoint file.
5151
@@ -95,7 +95,7 @@ def load_checkpoint(
9595
strict: bool = True,
9696
remap: bool = False,
9797
filter_fn: Optional[Callable] = None,
98-
weights_only: bool = False,
98+
weights_only: bool = True,
9999
) -> Any:
100100
"""Load checkpoint into model.
101101

timm/models/_hub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def load_model_config_from_path(
213213
def load_state_dict_from_hf(
214214
model_id: str,
215215
filename: str = HF_WEIGHTS_NAME,
216-
weights_only: bool = False,
216+
weights_only: bool = True,
217217
cache_dir: Optional[Union[str, Path]] = None,
218218
):
219219
assert has_hf_hub(True)
@@ -265,7 +265,7 @@ def load_state_dict_from_hf(
265265

266266
def load_state_dict_from_path(
267267
path: str,
268-
weights_only: bool = False,
268+
weights_only: bool = True,
269269
):
270270
found_file = None
271271
for fname in _PREFERRED_FILES:

0 commit comments

Comments
 (0)