# PyTorch 2.6 torch.load weights_only default True unsupported global safe_globals documentation

Status: search-observed
Product: PyTorch
Last verified: 2026-06-25
Canonical HTML: https://gitdocs.org/fix/ultralytics-yolo-detectionmodel-unsupported-global-after-pytorch-2-6
Machine JSON: https://gitdocs.org/api/fixes/ultralytics-yolo-detectionmodel-unsupported-global-after-pytorch-2-6.json

## Exact Symptom

See the observed Codex queries below.

## Diagnosis

The local workspace gives the symptom and stale integration shape, but the correct repair depends on current official product behavior or recent release notes.

## Fix

```
Verifier accepts a repair record only if it states the current contract and an actionable fix using source-backed product terms.
```

## Avoid

- Changing local code without checking the current external contract.
- Retrying the same install, build, or API call with no version/source change.
- Applying a broad unsafe bypass when a narrow compatibility fix is available.

## Observed Codex Queries

- PyTorch 2.6 torch.load weights_only default True unsupported global safe_globals documentation
- site:pytorch.org/docs/stable/generated/torch.load.html weights_only True safe_globals unsupported global
- https://pytorch.org/docs/stable/generated/torch.load.html
- https://docs.pytorch.org/docs/stable/generated/torch.load.html
- https://docs.pytorch.org/docs/2.6/notes/serialization.html
- Ultralytics torch_safe_load weights_only False PyTorch 2.6 DetectionModel Unsupported global issue
- "Unsupported global" "DetectionModel" "ultralytics"
- https://github.com/ultralytics/ultralytics/blob/main/ultralytics/nn/tasks.py
- https://raw.githubusercontent.com/ultralytics/ultralytics/main/ultralytics/nn/tasks.py
- 'torch_safe_load' in https://raw.githubusercontent.com/ultralytics/ultralytics/main/ultralytics/nn/tasks.py
- https://raw.githubusercontent.com/ultralytics/ultralytics/main/ultralytics/utils/patches.py

## Sources

- PyTorch serialization notes: https://docs.pytorch.org/docs/stable/notes/serialization.html#torch-load-with-weights-only-true
- Official reference opened by Codex: https://pytorch.org/docs/stable/generated/torch.load.html
- Official reference opened by Codex: https://docs.pytorch.org/docs/stable/generated/torch.load.html
- Official reference opened by Codex: https://docs.pytorch.org/docs/2.6/notes/serialization.html
- GitHub source file or repository reference: https://github.com/ultralytics/ultralytics/blob/main/ultralytics/nn/tasks.py
- Official reference opened by Codex: https://raw.githubusercontent.com/ultralytics/ultralytics/main/ultralytics/nn/tasks.py
- Official reference opened by Codex: https://raw.githubusercontent.com/ultralytics/ultralytics/main/ultralytics/utils/patches.py
