FIX YOLO Model Compatibility in ComfyUI

YOLO Model Compatibility in New ComfyUI // Impact Pack Edition
A Quick Guide to Patching PyTorch's New Security Changes for YOLOv8+
If you're using YOLO models with ComfyUI + the Impact Pack, especially anything that includes Ultralytics detailers (like bounding box/segmentation detection), you'll probably run into a nasty UnpicklingError or "weights only load failed" message.
That’s not your fault — it's because PyTorch 2.6+ introduced a new weights_only=True default when loading model checkpoints to tighten security. But YOLO checkpoints require access to getattr, which isn't safe-listed by default.
ComfyUI currently doesn’t automatically handle this, so if you’re trying to use UltralyticsDetectorProvider and YOLO checkpoints from HuggingFace or local sources — you gotta patch it manually.
❌ The Problem
When loading a YOLOv8 or YOLOv10 model via the Impact Subpack, you might hit this:
_pickle.UnpicklingError: Weights only load failed. GLOBAL getattr was not an allowed global by default.Even worse, ComfyUI may just ignore your model silently — especially if it's passed through the UltralyticsDetectorProvider.
🔥 The Fix (Impact Subpack Patch)
You'll need to edit the Python file that wraps torch.load() in the Impact Subpack. Here's how to patch it:
Open your
subcore.pyor whatever file is wrapping YOLO loading logic in:ComfyUI/custom_nodes/comfyui-impact-subpack/modules/Find the
torch_wrapper()function, or define it right before you load your model.Inject this precision patch into your
Impact Subpackmodule to restore YOLO checkpoint compatibility:Or go full beast mode with:
📦 Fully Patched
subcore.py✅ Tested with: ComfyUI 0.3.27, Ultralytics v8/v10, PyTorch ≥ 2.6, MPS, xFormers, and remote/local YOLO checkpoints.
Profit. You can now load models like:
yolo_model = YOLO("path/to/your_model.pt")And they'll behave as intended... Plug it in. Power it up. Get back to the goddamn art.
🧠 Why This Happens
PyTorch >2.6+ prioritizes security during deserialization.
Ultralytics YOLO uses
getattrinside their checkpoint loading.getattris not considered safe by default (could lead to arbitrary code exec if abused).ComfyUI doesn’t yet wrap this safely — so we fix it manually.
✅ Tested Setup
ComfyUI 0.3.27
Ultralytics YOLOv8/v10 checkpoints
Impact Pack & Subpack (latest)
PyTorch 2.8 dev branch
macOS with MPS and xformers enabled
💬 Feedback & Support
If you’d rather grab a pre‑patched module or run into any issues, open an issue on the Impact Pack repo or drop a note on my GitHub:
Repo: https://github.com/1darkmatter/comfyui-app-ultralytics-fix
This kind of patch shouldn’t be necessary forever — ideally ComfyUI or the Impact Pack will add internal support for secure global injection. But for now, this patch will unbreak your workflow and get your detectors running without compromising the security model of modern PyTorch.
Feel free to comment if you want a pre-patched module or hotfix version.
// Got Questions or Feedback?
Feel free to reach out!
Created by Magnabos.co | Creative Artist
🔥 Stay modded, stay dangerous.