Spaces:
Running on Zero
Running on Zero
Load legacy checkpoints when Lightning passes weights_only=None.
Browse files
app.py
CHANGED
|
@@ -7,7 +7,9 @@ try: # torch>=2.6 flipped torch.load(weights_only) to True; legacy ckpts need F
|
|
| 7 |
_torch_load_orig = _torch.load
|
| 8 |
|
| 9 |
def _torch_load_compat(*args, **kwargs):
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
return _torch_load_orig(*args, **kwargs)
|
| 12 |
|
| 13 |
_torch_load_compat.__harp_compat__ = True
|
|
|
|
| 7 |
_torch_load_orig = _torch.load
|
| 8 |
|
| 9 |
def _torch_load_compat(*args, **kwargs):
|
| 10 |
+
# Lightning passes weights_only=None, which torch reads as True
|
| 11 |
+
if kwargs.get("weights_only") is None:
|
| 12 |
+
kwargs["weights_only"] = False
|
| 13 |
return _torch_load_orig(*args, **kwargs)
|
| 14 |
|
| 15 |
_torch_load_compat.__harp_compat__ = True
|