Update README.md
Browse files
README.md
CHANGED
|
@@ -47,4 +47,24 @@ Since getattr is classified as a dangerous pickle function, any segmentation mod
|
|
| 47 |
|
| 48 |
All models were created and saved using the official Ultralytics library, so it’s safe to use files downloaded from a trusted source.
|
| 49 |
|
| 50 |
-
See also: https://huggingface.co/docs/hub/security-pickle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
All models were created and saved using the official Ultralytics library, so it’s safe to use files downloaded from a trusted source.
|
| 49 |
|
| 50 |
+
See also: https://huggingface.co/docs/hub/security-pickle
|
| 51 |
+
|
| 52 |
+
**Note on Loading Weights**
|
| 53 |
+
If you encounter an error like:
|
| 54 |
+
```bash
|
| 55 |
+
Weights-only load failed. Unsupported global: builtins.set
|
| 56 |
+
```
|
| 57 |
+
This happens because PyTorch (for safety) blocks loading some objects by default.
|
| 58 |
+
To fix it safely, add this code before loading:
|
| 59 |
+
```bash
|
| 60 |
+
python
|
| 61 |
+
```
|
| 62 |
+
```bash
|
| 63 |
+
import torch
|
| 64 |
+
torch.serialization.add_safe_globals([set])
|
| 65 |
+
```
|
| 66 |
+
This whitelists set and allows safe loading with weights_only=True.
|
| 67 |
+
|
| 68 |
+
Otherwise, never disable weights_only unless you 100% trust the file.
|
| 69 |
+
|
| 70 |
+
Check (PyTorch's torch.load docs)[https://pytorch.org/docs/stable/generated/torch.load.html] for more info.
|