r/learnmachinelearning • u/Durvesh-Dev • 5h ago
[P] Added Hugging Face Trainer + Lightning support to Efficio — resumable, time-budgeted training on free Colab/Kaggle GPUs
We maintain Efficio, an open-source PyTorch library for getting more out of free GPU hours (Colab/Kaggle) — auto-checkpointing, a time budget that saves and stops before your session gets killed, and resume across platforms.
Until now it only worked with plain PyTorch training loops. 0.3.0 adds callbacks for transformers.Trainer and PyTorch Lightning:
from efficio.adapters import HFTrainerCallback
efficio_cb = HFTrainerCallback(budget="2h", storage="hf://you/your-repo")
trainer = Trainer(model=model, args=args, train_dataset=ds, callbacks=[efficio_cb])
trainer.train (resume_from_checkpoint=efficio_cb.resume_from(trainer))- Budget-based stop + resume, going through the Trainer's/Lightning's own checkpoint mechanism (not a side file), so weights/optimizer/scheduler/RNG come back correctly.
- Cross-platform resume (Kaggle 2x T4 → Colab 1x T4), checkpoint storage on HF Hub or Drive.
- Tested on a real Colab T4 (mid-epoch budget stop + resume).
- Current limit: single-process only — torchrun/ddp raises for now, multi-GPU is next on the roadmap.
pip install "efficio[hf]" or pip install "efficio[lightning]"
GitHub: github.com/HuNTer8272/Efficio — feedback/issues welcome, especially from anyone hitting Colab/Kaggle limits mid-Trainer-run.