feat(pi0): add train_expert_only and freeze_vision_encoder flags to pi0 and pi0.5 #2727
+56
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title
Add
train_expert_onlyandfreeze_vision_encoderflags to PI0 and PI0.5Type / Scope
Summary / Motivation
Adds two config options for pi0/0.5 for finetuning purposes:
freeze_vision_encoder(only freeze vision encoder) andtrain_expert_only(freeze entire VLM, only train action expert and projection layers). This addresses #2153.Related issues
What changed
freeze_vision_encoderandtrain_expert_onlyconfig options toPI0ConfigandPI05Config_set_requires_grad()toPaliGemmaWithExpertModelin both pi0 and pi0.5 to freeze params based on configtrain()override to keep frozen modules in eval mode during trainingBoth options default to
Falsefor backwards compatibility.How was this tested
xvlaandsmolvlafreezing)pytest tests/policies/pi0_pi05/test_pi0.py tests/policies/pi0_pi05/test_pi05.py -vHow to run locally (reviewer)
pytest tests/policies/pi0_pi05/test_pi0.py tests/policies/pi0_pi05/test_pi05.py -vChecklist (required before merge)
pre-commit run -a)pytest)Reviewer notes
Hello! This is my first contribution to LeRobot and additionally, one of my first open source contributions. I appreciate and welcome your guidance, and I apologize if there were any best practices not followed.
Happy to make any changes, thanks in advance for the feedback!