File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/lightning/fabric/utilities Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 26
26
from fsspec .implementations .local import AbstractFileSystem
27
27
from lightning_utilities .core .imports import module_available
28
28
29
+ from lightning .fabric .utilities .imports import _TORCH_GREATER_EQUAL_2_6
29
30
from lightning .fabric .utilities .types import _MAP_LOCATION_TYPE , _PATH
30
31
31
32
log = logging .getLogger (__name__ )
@@ -56,9 +57,14 @@ def _load(
56
57
weights_only = weights_only ,
57
58
)
58
59
if str (path_or_url ).startswith ("http" ):
59
- if weights_only is None and _TORCH_GREATER_EQUAL_2_6 :
60
- weights_only = True
61
- log .debug (f"Default to `weights_only=True` for remote checkpoint: { path_or_url } " )
60
+ if weights_only is None :
61
+ if _TORCH_GREATER_EQUAL_2_6 :
62
+ weights_only = True
63
+ log .debug (f"Default to `weights_only=True` for remote checkpoint for torch>=2.6: { path_or_url } " )
64
+ else :
65
+ weights_only = False
66
+ log .debug (f"Default to `weights_only=False` for remote checkpoint for torch<2.6: { path_or_url } " )
67
+
62
68
return torch .hub .load_state_dict_from_url (
63
69
str (path_or_url ),
64
70
map_location = map_location , # type: ignore[arg-type]
You can’t perform that action at this time.
0 commit comments