← Hubs
GPU / CUDA Out of Memory & Device Errors
Your training run dies with a CUDA OOM, a device-side assert, or a tensor stuck on the wrong device. These are the specific PyTorch and Hugging Face errors that cause it, in the order they usually show up, plus a calculator to estimate VRAM before you hit the wall again.
Match your error message
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate ...torch.cuda.OutOfMemoryError: How to Fix GPU Out of Memory in PyTorch →RuntimeError: CUDA error: device-side assert triggeredFix CUDA Error: Device-Side Assert Triggered in PyTorch →torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 86.00 MiB. GPU 0 has a total capacity of 7.91 GiBFix Hugging Face CUDA Out of Memory at Model Load →RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!Fix PyTorch 'Expected All Tensors to Be on the Same Device' →RuntimeError: expected scalar type Long but found FloatPyTorch: Expected Scalar Type Long but Found Float →
Tools