Stella
Local AI and ComfyUI

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
You: Training a LoRA in kohya stops with torch.cuda.OutOfMemoryError: CUDA out of memory, tried to allocate 2 GB. RTX 3060 12 GB.
Stella:

On it. Seeing what's already using your card.

Stella:

Training runs now. Batch size is 1 with gradient checkpointing and 8-bit Adam, which keeps the 3060 under its 12 GB. Your LoRA saves to training/output every epoch as before.

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.

  1. What's eating your card's memory, named
  2. A 4-bit or 8-bit copy of the model when it helps
  3. 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?
  1. Close other programs using the GPU; check nvidia-smi for leftover Python.
  2. Lower batch size or context length; turn on gradient checkpointing for training.
  3. Load models in 4-bit or 8-bit with bitsandbytes, or use a GGUF in llama.cpp or Ollama.

Stella