feat: MolmoAct2 processors - #234
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds NumPy-based MolmoAct2 inference processors to the runtime (preprocess: observation → prompt/images; model-input assembly: tokens/images → graph inputs; postprocess: outputs → actions), and extends stats (de)normalization to support a per-dimension boolean mask so only selected dimensions are transformed.
Changes:
- Introduce MolmoAct2 preprocessor, image patchifier, model-input assembler, and postprocessor, and register them in the component factory.
- Add masked-dimension support to
StatsNormalizer/StatsDenormalizerand corresponding unit tests. - Add new unit tests for MolmoAct2 preprocessing/model-input assembly/postprocessing pipeline.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/inference/preprocessors/test_stats_normalizer.py | Adds a masked-dimension normalization test for StatsNormalizer. |
| tests/unit/inference/preprocessors/test_molmoact2.py | New unit tests for MolmoAct2 preprocessor/image processor/model-input assembly + manifest pipeline. |
| tests/unit/inference/postprocessors/test_stats_denormalizer.py | Adds a masked-dimension denormalization test for StatsDenormalizer. |
| tests/unit/inference/postprocessors/test_molmoact2.py | New unit tests for MolmoAct2 postprocessor and registry instantiation. |
| src/physicalai/inference/preprocessors/stats_normalizer.py | Applies optional mask after normalization so unmasked dims pass through unchanged. |
| src/physicalai/inference/preprocessors/molmoact2.py | New MolmoAct2 observation preprocessor (task normalization, state discretization, image packing/resizing, optional joint transform, optional masked normalization). |
| src/physicalai/inference/preprocessors/molmoact2_inputs.py | New MolmoAct2 model-input assembler: expands `< |
| src/physicalai/inference/preprocessors/molmoact2_image.py | New NumPy image patchification + pooling index generation for MolmoAct2. |
| src/physicalai/inference/preprocessors/init.py | Exposes MolmoAct2 preprocessor and model-input assembler. |
| src/physicalai/inference/postprocessors/stats_denormalizer.py | Applies optional mask after denormalization so unmasked dims pass through unchanged. |
| src/physicalai/inference/postprocessors/molmoact2.py | New MolmoAct2 postprocessor (clamp, masked denormalize, optional inverse joint transform). |
| src/physicalai/inference/postprocessors/init.py | Exposes MolmoAct2 postprocessor. |
| src/physicalai/inference/component_factory.py | Registers MolmoAct2 processors in the component registry. |
| pyproject.toml | Minor dependency-list whitespace change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
would it be an idea to re-structure src/physicalai/inference/postprocessors directory as it is getting a bit cluttered? Maybe a subpackage per-model? Something like init.py could expose the classes: from physicalai.inference.preprocessors.molmoact2.inputs import MolmoAct2Inputs
from physicalai.inference.preprocessors.molmoact2.processor import MolmoAct2Preprocessor
__all__ = ["MolmoAct2Inputs", "MolmoAct2Preprocessor"]so relative imports would still work? |
bcac132
Summary
Corresponding PR to introduce numpy processors
open-edge-platform/physical-ai-studio#809
Other changes: we've adjusted the stats normalization to include the new mask parameter.