Free Colab and Kaggle GPUs are great until the session dies at epoch 38 and you lose hours of training. I got tired of that, so I built Efficio, an open-source library that makes PyTorch training on free GPUs faster and resumable.

The problem

Free tiers disconnect, hit quotas and restart without warning. Saving a checkpoint to the local disk doesn't help when the disk disappears with the session.

What Efficio does

  • Saves checkpoints in the background, so training doesn't pause.
  • Stores them on Hugging Face or Google Drive instead of the VM's disk.
  • Resumes exactly where you stopped, even mid-epoch and even on a different platform. I tested a run started on Kaggle and finished on Colab.
  • Stops cleanly before your time budget runs out, saving a checkpoint first.
  • Can shut the Colab runtime down after the final checkpoint is safely uploaded, so you don't burn quota idling.

Quickstart

!pip install -q efficio import efficio, torch run = efficio.Run(budget="2h") # save and stop 10 minutes before 2 h model, optimizer = run.prepare(model, optimizer) # resumes from the last checkpoint for x, y in run.loop(train_loader, epochs=20): # batches arrive on the GPU with run.autocast(): # fp16 on a T4, bf16 on newer GPUs loss = torch.nn.functional.cross_entropy(model(x), y) run.backward(loss) run.step() run.report() # time split, GPU use and tips 

Run the same cell again after a disconnect and it picks up from the last checkpoint.

Start on Kaggle, finish on Colab

Install with the Hugging Face extra:

pip install "efficio[hub]" 
# Kaggle (GPU on, Internet on, HF_TOKEN secret attached) run = efficio.Run(budget="11h30m", storage="hf://your-username/my-run") model, optimizer = run.prepare(model, optimizer) for x, y in run.loop(train_loader, epochs=50): ... run.report() # stopped by the budget; the stop checkpoint is uploaded first # Later on Colab (HF_TOKEN secret with notebook access) run = efficio.Run(budget="3h", storage="hf://your-username/my-run") model, optimizer = run.prepare(model, optimizer) # downloads the latest checkpoint, resumes for x, y in run.loop(train_loader, epochs=50): ... run.report() 

Prefer Google Drive? Mount it yourself on Colab and use storage="/content/drive/MyDrive/my-run".

Smaller checkpoints, same result

There are three checkpoint modes: exact (full size, the baseline), light and smallest. On a T4 GPU, compared with exact:

Mode AdamW transformer ResNet-18 (SGD)
light 2.0x smaller 1.6x smaller
smallest 2.9x smaller 2.6x smaller
run = efficio.Run(budget="2h", checkpoint_mode="light") # or "exact" / "smallest" 

Saving only the trainable weights (for example, LoRA fine-tuning) cut a checkpoint from 44.23 MB to 1.61 MB. I checked each mode by resuming and comparing the final loss against a noise baseline, so "smaller" doesn't mean "worse".

Try it

It's early (version 0.2.0), so feedback and issues are very welcome. Next up: Lightning/HF Trainer callbacks, LoRA checkpoints and automatic OOM recovery.