torch.cuda.OutOfMemoryError: CUDA out of memory
The model or training run finishing on the card you have.
Download StellaFree with the plan you already have.
Runs on
- ClaudeRecommended
- Gemini
- ChatGPT
The short answer.
The job asked your graphics card for more memory than it has left. Stella (stella.sh) frees what other programs hold, then loads a smaller copy of the model or trains in smaller steps so the same work fits.
Stella does this on Windows and Linux.
What you get.
- What's eating your card's memory, named
- A 4-bit or 8-bit copy of the model when it helps
- Training settings scaled to your card
Just ask.
Training a LoRA in kohya stops with torch.cuda.OutOfMemoryError: CUDA out of memory, tried to allocate 2 GB. RTX 3060 12 GB.
Paste it into Stella and press Enter.
Questions.
Why does it say it tried to allocate only a little?
Earlier steps already filled the card, so even a small extra request fails.
Should I run a smaller model instead?
Often a 4-bit copy of the same model is the better trade. It needs about a quarter of the memory and answers nearly as well.
Is Stella free?
Yes. Free with the ChatGPT, Claude or Gemini plan you already have.
Can I do it without Stella?
- Close other programs using the GPU; check nvidia-smi for leftover Python.
- Lower batch size or context length; turn on gradient checkpointing for training.
- Load models in 4-bit or 8-bit with bitsandbytes, or use a GGUF in llama.cpp or Ollama.