What this thread does
The problem
Separate memory pressure, invalid inputs, GPU binary support and checkpoint loading in direct PyTorch scripts. These four families are evidenced, not ranked.
Versions and licence, checked 2026-10-20
| Scope | Official source fetched today | Meaning |
|---|---|---|
| Documentation baseline | PyTorch 2.14 | Not a claim about your installed release |
| Loading change | Serialization notes identify 2.6 | Weights-only default without an explicit pickle module |
| Legacy example | Previous releases list torch 2.7.1 / CUDA 12.6 | Conditional diagnostic below |
| Licence | Project terms permit redistribution with conditions | Read bundled terms too; no paid service compared |
Commands are proposed, not run here.
python -m torch.utils.collect_env
nvidia-smi
Which branch to pick
| Symptom | First check | Repair direction |
|---|---|---|
| OOM | Tensor memory versus cache and other processes | Reduce live tensors/workload |
| Device assert | First failing operation | Validate labels/indices |
| No kernel image | GPU capability and binary architectures | Compatible binary/extension |
| Weights-only failure | Contents and provenance | State dictionary/reviewed allowlist |
CUDA out of memory
The exact prefix torch.OutOfMemoryError: CUDA out of memory. appears in MrMarvel's issue #178057 (checked 2026-10-20). It reports failure despite apparently free capacity, not a universal allocator fix.
An allocation cannot be satisfied. Live tensors, retained graphs, other processes and fragmentation need different responses. Measure inside the failing workload:
print(torch.cuda.memory_summary())
print(torch.cuda.memory_allocated(), torch.cuda.memory_reserved())
Reduce the DataLoader batch size; rerun the failing batch. Replace graph-retaining losses.append(loss) with losses.append(loss.item()). For inference only:
model.eval()
with torch.inference_mode():
output = model(batch)
Do not expect torch.cuda.empty_cache() to free referenced tensors or tune allocator flags without measurements. CUDA memory notes and FAQ on retained references checked 2026-10-20.
CUDA error: device-side assert triggered
The exact message RuntimeError: CUDA error: device-side assert triggered occurs in Atharva_Mishra's LSTM report. Maintainer ptrblck explains out-of-range targets as one cause (checked 2026-10-20).
Restart the process/notebook kernel after an assert. Locate the first failing operation:
CUDA_LAUNCH_BLOCKING=1 python train.py
For class-index cross entropy, validate CPU targets before transfer, excluding an intentional ignore index:
valid = labels_cpu != criterion.ignore_index
assert labels_cpu.dtype == torch.long
assert ((labels_cpu[valid] >= 0) &
(labels_cpu[valid] < num_classes)).all()
Correct mappings across splits; for embedding failures check token IDs against embedding size. Do not blindly subtract one, clamp corrupt inputs or trust the last asynchronous frame. Execution notes and CrossEntropyLoss target rules checked 2026-10-20.
No kernel image is available
The exact prefix AcceleratorError: CUDA error: no kernel image is available for execution on the device occurs in Wizard's P100 report (checked 2026-10-20). A torch or extension kernel lacks a suitable GPU implementation. CUDA availability alone is insufficient.
python -c 'import torch; print(torch.__version__, torch.version.cuda); print(torch.cuda.get_device_capability()); print(torch.cuda.get_arch_list()); print(torch.ones(1, device="cuda") + 1)'
Compare capability and compiled architectures, accounting for CUDA compatibility. If basic torch works but an extension fails, install/rebuild that extension for this GPU and torch environment.
For P100/Pascal specifically, ptrblck recommends a compatible CUDA 12.6 build. Test this documented historical wheel separately after checking Python, driver and app requirements:
python -m venv .venv-p100-check
.venv-p100-check/bin/python -m pip install torch==2.7.1 --index-url https://download.pytorch.org/whl/cu126
.venv-p100-check/bin/python -c 'import torch; print(torch.ones(1, device="cuda") + 1)'
Do not apply this legacy pin indiscriminately or assume a local toolkit rewrites a binary. NVIDIA kernel-image definition and official wheel commands checked 2026-10-20; example untested.
torch.load weights-only failure
The exact prefix _pickle.UnpicklingError: Weights only load failed. appears in official serialization notes (checked 2026-10-20). Objects outside the restricted loader's allowlist can fail after the default change.
For a trusted plain state dictionary and matching model:
state = torch.load("checkpoint.pt", map_location="cpu", weights_only=True)
model.load_state_dict(state)
For unsupported globals, inspect before allowlisting:
print(torch.serialization.get_unsafe_globals_in_checkpoint("checkpoint.pt"))
Import only reviewed, trusted classes; wrap loading in torch.serialization.safe_globals([ReviewedClass]). Static inspection can miss dynamically built types. Explicit weights_only=False is documented for trusted legacy full modules but can execute arbitrary code. Do not use it on untrusted downloads or disable the safeguard globally. torch.load CPU mapping checked 2026-10-20.
Community evidence and recommendation
The label-range and architecture reports include maintainer answers. cngmid's Lightning issue #21757 additionally reports a wrapper restoring a checkpoint without forwarding the loading option (checked 2026-10-20). Inspect wrapper integration before editing torch internals.
A prompt to give your agent
Read the linked official source and matching report before suggesting commands; do not guess from the error. Record installed torch, wheel runtime, GPU capability and first failing operation. Choose one branch, propose the smallest patch and rerun the failing batch/load in isolation. Verify checkpoint provenance before unpickling changes. Report checks actually run.
Limits
No GPU code, install, checkpoint or fix was run. As of November 2026, the fetched install selector labels stable as 2.7.0 while the cited docs use 2.14; the latest GitHub release is 2.15.0, released 2026-10-28 (checked 2026-11-17). The legacy pin is diagnostic, not a production recommendation. Evidence mixes older/current reports; no 2026 frequency ranking was verified. All four prefixes were found; unseen suffixes, vendor assertion strings and extension kernels remain unverified.
Started from a post by @MrMarvel, packaged by the editor. Original post