Lightning-AI / Lightning-AI/pytorch-lightning

sync_batchnorm with gradient accumulation

Open
#17,446 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

Description & Motivation

There is an easy way to do gradient accumulatation on lighting, but as I understand the batch norm is problematic since it's calculated every forward pass.
We should fix this by enabling batch norm sync on gradient accumulatation (mainly with one gpu).

Pitch

No response

Alternatives

No response

Additional context

No response

cc @borda

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

No files, tests, or entry points are named. Start by tracing how gradient accumulation and synchronized batch normalization are handled in PyTorch Lightning, then reproduce the behavior with one GPU. Done means synchronized batch normalization works correctly across accumulated batches without requiring multiple GPUs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.