feat(models): BaseVLA spine + 6 component bases + name_mapping (basevla-spine lift #1 Day 3)#144
Merged
Merged
Conversation
… Day 3) Day 3 of features/03_export/basevla-spine_plan.md. Pure addition — zero behavior change to existing exporters/runtime. Foundation for Days 4-9 per-model decompositions. New files (10 total, ~830 LOC including docstrings + tests): - src/reflex/models/base_vla.py (~320 LOC) — BaseVLA ABC with 6 slots (vision/llm/vlm/projectors/heads/text per S-2). REQUIRED_SLOTS + OPTIONAL_SLOTS subclass contract with construction-time validation (raises on missing required, undeclared slot, unknown slot name, required/optional overlap). from_config(spec) resolves type-tagged dicts through component registries. prepare_inference_weights() aggregates components' prepare_triton outputs (lift #3 substrate). load_state_dict() applies NAME_MAPPING + routes by slot prefix. - src/reflex/models/_name_mapping.py (~95 LOC) — Per-VLA name_mapping walker per decision S-1 (faithful FluxVLA port, NOT per-component). First-match-wins prefix substitution; strict mode catches HF layout drift early; empty src_prefix rejected. - src/reflex/models/{vision,llm,vlm,projectors,heads,text}/__init__.py (~50 LOC each) — 6 component base ABCs. Each declares abstract forward() with VLA-specific signature + concrete prepare_triton(prefix) no-op default per S-2 (bundles lift #3 interface into spine refactor to avoid per-component retrofit later). - src/reflex/models/__init__.py — re-exports BaseVLA + ALL_SLOTS + apply_name_mapping. - tests/test_models_abstract.py (~270 LOC) — 18 contract tests: ABC enforcement (direct instantiation TypeError × 6 component bases + BaseVLA + partially-implemented subclass), slot validation (5 cases incl. unknown-slot + required/optional overlap), from_config dispatch (3 cases), prepare_inference_weights aggregation (3 cases), apply_name_mapping walker (5 cases incl. strict mode + immutability). Validation (per the lift #4 PR-review-pass discipline): - syntax: all 10 files parse clean via ast.parse - AST orphan-imports sweep: zero suspect names referenced without import - live import test: BaseVLA + all 7 component bases + all 7 component registries import cleanly with no circular deps (verified locally via `PYTHONPATH=src python -c "from reflex.models import BaseVLA..."`) - pytest: deferred to CI (local venv has unrelated logfire/otel breakage) Per S-3: subclasses register via @VLAS.register / @VISION_BACKBONES.register etc. — hybrid decorator + explicit. The registries themselves landed in Day 2 (PR #141). Per S-5: JSON-Schema validation defers to Phase 2 — V1 catches typos at instantiation via clear TypeError + diagnostic messages listing the ALL_SLOTS set or REQUIRED_SLOTS. Next: Day 4 — decompose pi0 as the canary (proves the spine works on the smallest real VLA before pi05/smolvla/gr00t decomposition). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Lift #1 Day 3 per
features/03_export/basevla-spine_plan.md. Foundation for the BaseVLA spine refactor. Pure addition — zero behavior change to existing exporters/runtime.Implements the abstract spine + 6 component base classes + per-VLA name_mapping walker. Days 4-9 decompose each existing exporter onto this spine with per-model parity gates.
What this lands (~830 LOC including tests)
src/reflex/models/base_vla.py(~320 LOC) —BaseVLAABC with 6 slots (per decision S-2: vision/llm/vlm/projectors/heads/text). REQUIRED_SLOTS + OPTIONAL_SLOTS contract validated at construction (raises on missing required, undeclared slot pass, unknown slot name, required/optional overlap).from_config(spec)resolves type-tagged dicts through component registries.prepare_inference_weights()aggregates components' prepare_triton outputs (lift Expand doctor checklist to detect ROS2 distro + workspace state #3 substrate).load_state_dict()applies NAME_MAPPING + routes by slot prefix.src/reflex/models/_name_mapping.py(~95 LOC) — Per-VLA name_mapping walker per decision S-1 (faithful FluxVLA port, NOT per-component). First-match-wins prefix substitution; strict mode catches HF layout drift early.src/reflex/models/{vision,llm,vlm,projectors,heads,text}/__init__.py(~50 LOC each) — 6 component base ABCs. Each declares abstractforward()+ concreteprepare_triton(prefix)no-op default per decision S-2 (bundles lift Expand doctor checklist to detect ROS2 distro + workspace state #3 interface into spine refactor to avoid per-component retrofit).tests/test_models_abstract.py(~270 LOC, 18 tests) — ABC enforcement, slot validation (5 cases), from_config dispatch (3 cases), prepare_inference_weights aggregation (3 cases), apply_name_mapping walker (5 cases including strict mode + immutability).Decisions referenced
BaseVLA.NAME_MAPPINGclass var +apply_name_mappingwalker.vlm_backbone(GR00T's Eagle) +text_encoder(DreamZero's T5). Validated viaALL_SLOTSconstant.TypeError+ diagnostic messages.Pre-merge validation (per the lift #4 review-pass discipline)
ast.parsesyntax check on all 10 new filesPYTHONPATH=src python -c "from reflex.models import BaseVLA..."succeeds with no circular depsIndependent of in-flight work
src/reflex/models/smolvla.py(unused) orsrc/reflex/models/adapt.py(its own test). Day 6 will addmodels/vlas/smolvla.py(different path).Next: Day 4
Decompose pi0 as the spine canary — proves the design works on a real VLA before pi0.5/smolvla/gr00t decomposition. Will be a separate PR.
🤖 Generated with Claude Code