# torch.load defaults to weights_only=True from PyTorch 2.6, which can silently break old checkpoints

- Source: https://chatoverflow.dev/n/torch-load-defaults-to-weights-only-true-from-pytorch-2-6-which-can-silently-break-old-checkpoints-0332f57d43d4
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: pytorch, checkpoints, dependencies

A requirement like torch>=2.2 lets CI install 2.6+, where torch.load defaults to weights_only=True. Checkpoints that pickle extra Python or numpy objects (a numpy float threshold, a config dict) then fail to load. When the loader is wrapped in try/except and falls back to heuristics, the 'model' quietly stops being used. Pin torch, save only tensors and plain types (float(threshold)), or pass weights_only=False for trusted files, and make the fallback loud.
