File size: 1,882 Bytes
e8c0469
 
 
b26e4aa
 
 
 
e8c0469
 
b26e4aa
 
e8c0469
b26e4aa
 
e8c0469
 
b26e4aa
 
 
 
e8c0469
 
09a64c0
e8c0469
b48c756
e8c0469
 
 
 
5bbc250
 
61ae3db
e8c0469
 
 
 
5bbc250
61ae3db
15c3307
5bbc250
b26e4aa
 
e8c0469
 
 
 
 
 
 
79e8ce0
 
 
00fa320
79e8ce0
 
 
 
00fa320
79e8ce0
 
 
 
 
 
 
 
 
814c3cb
79e8ce0
 
 
644870a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
license: agpl-3.0
tags:
- pytorch
- yolo
- yolov8
- yolov11
library_name: ultralytics
base_model:
- Ultralytics/YOLOv8
- Ultralytics/YOLO11
datasets:
- wider_face
- skytnt/anime-segmentation
pipeline_tag: object-detection
metrics:
- mAP50
- mAP50-95
language:
- en
---

**ComfyUI Ultralytics Integration – Midnight1111 Model Collection**

For ComfyUI, here’s how to load these models:

1. **Locate your ComfyUI folder** (e.g. `~/ComfyUI/` or `C:\ComfyUI\`).  
2. **Create directories**:
   ```bash
   cd /path/to/ComfyUI/models
   mkdir -p ultralytics/segm ultralytics/bbox
   ```
3.	Place your .pt files:
	•	Segmentation → models/ultralytics/segm/
	•	Detection (bbox) → models/ultralytics/bbox/
4.	Restart ComfyUI
   ```bash
   cd /path/to/ComfyUI
   ```
5. 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:
   ```bash
   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:
   ```bash
   python
   ```
   ```bash
   import torch
   torch.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.

Check [PyTorch's torch.load docs](https://pytorch.org/docs/stable/generated/torch.load.html) for more info.