ComfyUI Ultralytics Integration – Midnight1111 Model Collection
For ComfyUI, here’s how to load these models:
- Locate your ComfyUI folder (e.g.
~/ComfyUI/ or C:\ComfyUI\).
- Create directories:
1cd /path/to/ComfyUI/models
2mkdir -p ultralytics/segm ultralytics/bbox
- Place your .pt files:
• Segmentation → models/ultralytics/segm/
• Detection (bbox) → models/ultralytics/bbox/
- Restart ComfyUI
- In the UI:
Add Node → Model → Ultralytics → choose segm/… or bbox/….
Connect an Image Loader → Ultralytics node → Previewer
Unsafe files
Since getattr is classified as a dangerous pickle function, any segmentation model that uses it is classified as unsafe.
All models were created and saved using the official Ultralytics library, so it’s safe to use files downloaded from a trusted source.
See also: https://huggingface.co/docs/hub/security-pickle
Note on Loading Weights
If you encounter an error like:
Weights-only load failed. Unsupported global: builtins.set
This happens because PyTorch (for safety) blocks loading some objects by default.
To fix it safely, add this code before loading:
1import torch
2torch.serialization.add_safe_globals([set])
This whitelists set and allows safe loading with weights_only=True.
Otherwise, never disable weights_only unless you 100% trust the file.