Skip to content

fix(pi0): avoid 3x peak RAM in PiGemma construction#3326

Open
AjAnubolu wants to merge 2 commits intohuggingface:mainfrom
AjAnubolu:fix/3251-pi-gemma-double-construction
Open

fix(pi0): avoid 3x peak RAM in PiGemma construction#3326
AjAnubolu wants to merge 2 commits intohuggingface:mainfrom
AjAnubolu:fix/3251-pi-gemma-double-construction

Conversation

@AjAnubolu
Copy link
Copy Markdown

Summary

PI0/PI05/PI0FAST construction allocates GemmaModel three times (parents build it, subclasses immediately discard and replace it), pushing peak RSS to ~3x the final model size and OOMing 32 GB machines. Wraps each super().__init__() in accelerate.init_empty_weights() so discarded submodules cost zero RAM, then rebuilds only the kept ones on real device.

Closes #3251. Diagnostic traces in #3254.

@github-actions github-actions bot added the policies Items related to robot policies label Apr 8, 2026
@pkooij pkooij self-requested a review April 16, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

policies Items related to robot policies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PI0/PI05/PI0FAST: memory usage regression due to double model construction in pi_gemma.py

2 participants