MidnightRunner commited on
Commit
e7c6646
·
verified ·
1 Parent(s): 96ecb27

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md CHANGED
@@ -83,4 +83,37 @@ Check [PyTorch's torch.load docs](https://pytorch.org/docs/stable/generated/torc
83
  print(" Keys:", list(checkpoint.keys()))
84
  EOF
85
  done
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  ```
 
83
  print(" Keys:", list(checkpoint.keys()))
84
  EOF
85
  done
86
+ ```
87
+ **⚠️ Update subcore.py in `ComfyUI/custom_nodes/comfyui-impact-pack/modules`**
88
+ ```bash
89
+ # HOTFIX: https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/754
90
+ # importing YOLO breaking original torch.load capabilities
91
+ def torch_wrapper(*args, **kwargs):
92
+ # Support for torch.load(..., weights_only=...)
93
+ if 'weights_only' in kwargs:
94
+ weights_only = kwargs.pop('weights_only')
95
+ else:
96
+ weights_only = None
97
+
98
+ try:
99
+ import torch.serialization
100
+ # Whitelist both getattr (needed for Detect.forward) and builtins.set (your checkpoint’s set)
101
+ torch.serialization.add_safe_globals([getattr, set])
102
+ except Exception as e:
103
+ logging.warning(f"[Impact Subpack] Could not register safe globals: {e}")
104
+
105
+ if hasattr(torch.serialization, 'safe_globals'):
106
+ if weights_only is not None:
107
+ kwargs['weights_only'] = weights_only
108
+ return orig_torch_load(*args, **kwargs)
109
+ else:
110
+ # Legacy PyTorch fallback
111
+ if weights_only is not None:
112
+ kwargs['weights_only'] = weights_only
113
+ else:
114
+ logging.warning("[Impact Subpack] Your PyTorch version is outdated — falling back to full model load.")
115
+ kwargs['weights_only'] = False
116
+ return orig_torch_load(*args, **kwargs)
117
+
118
+ torch.load = torch_wrapper
119
  ```