harp-dev commited on
Commit
cbafa30
·
verified ·
1 Parent(s): a8759fd

Load legacy checkpoints when Lightning passes weights_only=None.

Browse files
Files changed (1) hide show
  1. app.py +3 -1
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
- kwargs.setdefault("weights_only", False)
 
 
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