← 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.
Tools
Related articles
torch.cuda.OutOfMemoryError: How to Fix GPU Out of Memory in PyTorchFix RuntimeError: CUDA error device-side assert triggered in PyTorchFix Hugging Face CUDA Out of Memory When Loading Transformer ModelsFix PyTorch RuntimeError: Expected All Tensors to Be on the Same DeviceFix PyTorch RuntimeError: Expected Scalar Type Long but Found Float