Lightning-AI / Lightning-AI/pytorch-lightning

Memory blows up when training large models on all TPU cores

Open
#12,525 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accelerator: tpu checkpointing
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

## 🐛 Bug

I am training on 8 TPU cores but the memory blows up when the epoch ends.

### To Reproduce

Try training a bert large on 8 TPU cores

### Expected behavior

Second epoch should get started

### Environment

Kaggle TPU

- PyTorch Lightning Version (e.g., 1.5.0):
- PyTorch Version (e.g., 1.10):
- Python version (e.g., 3.9):
- OS (e.g., Linux): Linux
- CUDA/cuDNN version:
- GPU models and configuration:
- How you installed PyTorch (`conda`, `pip`, source):
- If compiling from source, the output of `torch.__config__.show()`:
- Any other relevant information:

### Additional context
I will try to use GPU instead of TPUs

cc @kaushikb11 @rohitgr7 @awaelchli @ananthsub @ninginthecloud

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing BERT-large training on 8 TPU cores in the Kaggle TPU environment and observe memory at the epoch boundary before the second epoch. Record the missing PyTorch Lightning, PyTorch, and installation details, then trace the TPU training path and epoch-end handling. Done means the second epoch starts without the memory blow-up and the regression is covered by a reproducible test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.