Serialization security default

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

A current PyTorch task fails with: Ultralytics YOLO `DetectionModel` Unsupported global after PyTorch 2.6.

search-observedPyTorchPython ML serializationSerialization security defaultgitdocs_candidate100

Agent Quick Fix

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

Product: PyTorch
Current-contract area: Ultralytics YOLO `DetectionModel` Unsupported global after PyTorch 2.6
Likely root cause: A current PyTorch task fails with: Ultralytics YOLO `DetectionModel` Unsupported global after PyTorch 2.6. The local stale integration is plausible but may not reflect the current external contract.
Repair direction: Verifier accepts a repair record only if it states the current contract and an actionable fix using source-backed product terms.

Validation Status

Codex searched organically, but the no-web counterfactual also passed under this fixture. Treat this as search-observed query evidence, not proof that search was necessary.

Symptom

A current PyTorch task fails with: Ultralytics YOLO `DetectionModel` Unsupported global after PyTorch 2.6. The local stale integration is plausible but may not reflect the current external contract.

Why This Happens

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

Verification

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

Common Wrong Fixes

  • 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.

Codex Search Keywords

These are the search terms observed in a neutral Codex validation run for this failure shape.

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

Source Trail

GitHub source file/reference: