Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Molmo on Trainium

A serving port of Ai2's MolmoAct2-BimanualYAM to AWS Trainium.

🌐 Reactor · 📚 Docs · 🛠️ Client SDKs · 📖 Cookbook


This repository serves Ai2's MolmoAct2-BimanualYAM checkpoint on an AWS Trainium3 NeuronCore. The weights are the upstream ones, unchanged. The model is compiled to NeuronCore graphs with torch.compile(backend="neuron") and stays loaded between calls.

What it is

The policy takes three synchronized RGB camera views (top, left, right), a 14-value bimanual joint state, and a natural-language task. It returns one chunk of 30 absolute joint poses (14 values each) in robot scale per call. Inference is continuous-action only (enable_depth_reasoning=False, 10 flow-matching steps). One session runs one call at a time.

The package in molmoact/ has two parts. molmoact_hf/ is the MolmoAct2 model code, copied unchanged from the checkpoint (see License & attribution). molmoact_rt/ is our code: the inference engine in engine.py, which runs either on CPU or compiled for Trainium, and the two processes Reactor serves. The app process (app.py) receives the robot's cameras and state and needs no accelerator. The model process (server.py) keeps the engine loaded on the NeuronCore. See docs/serving.md.

Inputs and outputs

field shape / type notes
images 3 × RGB fixed order [top, left, right]
state 14 floats left joints 0 to 5, left gripper, right joints 0 to 5, right gripper
task string natural-language instruction
action [30, 14] 30-step absolute-joint chunk, robot scale; norm_tag = yam_dual_molmoact2

The same engine also serves the Franka single-arm allenai/MolmoAct2-LIBERO checkpoint (norm_tag=libero, 8-D proprio, 2 cameras, [10, 7] delta-EEF); see client/sim/libero_eval.py.

Engine modes

reference runs the model in fp32 on CPU, with no Neuron dependencies, and takes about 2 to 4 s per call. We use it as the baseline for correctness.

neuron runs the compiled graphs on Trainium with bf16 matrix multiplications. Once warm, a call takes 383 ms at the median and 408 ms at p99. The first call compiles the graphs, which takes about 60 s; later calls reuse the compiled graphs. This mode depends on TorchNeuron (the neuron device and torch.compile(backend="neuron")), which is a public beta in AWS Neuron SDK 2.33 and later. The reference mode and the simulation scripts do not use it.

Given the same flow-matching noise, the neuron chunk differs from the reference chunk by at most 0.0113, below the 0.02 tolerance we set for bf16. The two are close but not bit-identical.

These numbers were measured on one NeuronCore of a trn3.48xlarge instance. On the public container this repository builds on, the same instance gives a largest difference of 0.0084 and 365 ms per call at the median in the simulated YAM loop. See docs/benchmarking.md.

Deploy on Reactor and try it

Reactor serves the model on an AWS Trainium3 NeuronCore and gives you an endpoint to connect to. You need a Reactor account and Docker, because the image is built on your machine.

1. Install the tools. The Reactor CLI, the Hugging Face CLI and uv, which runs the example client. Use version 1.x of the Hugging Face CLI: version 2 does not work with transformers==5.3.0, which the model needs.

curl -fsSL https://reactor.inc/install | bash
pip install "huggingface_hub>=1.3,<2"

2. Log in. This opens your browser; over SSH, add --no-browser. On a machine without a keychain, such as a headless Linux server, it asks for an API key instead.

reactor auth login

3. Create the project. A project is named <org>/<name>; reactor whoami shows your organization. The CLI and the example client both read the name from REACTOR_PROJECT, and model.name in molmoact/reactor.yaml must match it, so the last line writes it there.

export REACTOR_PROJECT=<your-org>/molmo-trainium
reactor project create "$REACTOR_PROJECT"
sed -i.bak "s|^  name: molmo-trainium$|  name: $REACTOR_PROJECT|" molmoact/reactor.yaml && rm molmoact/reactor.yaml.bak

4. Download the weights. Downloading them means accepting the terms on the model's Hugging Face page.

cd molmoact
hf download allenai/MolmoAct2-BimanualYAM --local-dir weights

5. Deploy. This builds the image with your local Docker, pushes it and ./weights to Reactor, and starts the model on Trainium3 in the project's production environment. It waits until the model is running. The first build downloads the AWS Neuron base image, about 10 GB. --build-local is required: Reactor's own builder only accepts base images from Docker Hub, and this one comes from the Amazon ECR Public Gallery. The build installs molmoact/requirements.txt, which already pins the torch and torchvision builds that match the container.

reactor deploy production --build-local --weights ./weights --gpu AWS_TRAINIUM_3

6. Run the example client. From the repository root, with your API key:

cd ..
export REACTOR_API_KEY=<your API key>
uv run client/policy_client.py

client/policy_client.py connects with the Reactor Python SDK, sends the three sample images, sample state and sample task that come with the checkpoint, and asks for three action chunks. For each one it prints the chunk's shape, (30, 14), how long it took, and the first row of joint targets. Pass --task "..." to change the instruction, or --images <dir> to send your own sample_top_rgb.png, sample_left_rgb.png and sample_right_rgb.png.

7. Stop the model when you are done, so it stops using Trainium:

reactor scale production --desired 0

reactor logs production --follow streams the model's logs, and reactor status production shows whether it is running.

The image is built on AWS's public TorchNeuron container. TorchNeuron is the native PyTorch backend for Trainium: it provides the neuron device and torch.compile(backend="neuron") that the engine uses, and it supports Trainium3 since AWS Neuron SDK 2.33. The exact tag is build.base_image in molmoact/reactor.yaml. The older pytorch-inference-neuronx containers use the archived PyTorch/XLA backend, which has no neuron device and does not run on Trainium3.

What a client sends and receives

To connect your own robot, use any of the Reactor client SDKs and follow policy_client.py. These are the tracks, state fields, messages and event a client exchanges with the model:

Direction Name Content
Video tracks (in) top, left, right The three RGB cameras.
State (in) task_description The task instruction. An empty task never produces actions.
State (in) state_json {"state": [14 floats], "capture_us": int, "seq": int}: left arm joints 0 to 5 in radians, left gripper (0 closed, 1 open), right arm joints 0 to 5, right gripper.
State (in) executed_step_json {"step": int}. Each increase asks for one new chunk; it must start at 0 or above and always go up.
Message (out) action_prediction action: 30 rows of 14 absolute targets, in the same order as the state.
Message (out) prediction_failed code (timeout, busy, rejected or invalid_input) and reason. The model retries shortly.
Event (in) reset Drops the camera history and the step count; the next chunk waits for fresh frames on all three cameras.

The robot can also attach the state to each video frame as metadata, giving the three frames of one observation the same capture time. The model then uses state_json only when frames carry no state. It waits until all three cameras have a new frame captured within 75 ms of each other (max_view_skew_ms in config.yml).

Use it

from molmoact_rt.engine import MolmoAct2Engine

engine = MolmoAct2Engine("<weights-dir>", mode="reference")  # or mode="neuron" on a Neuron host
engine.load()

action = engine.predict(
    images=[top, left, right],          # 3 × HxWx3 uint8, fixed order
    state=state_14,                     # 14 floats
    task="pick up the red block and hand it over",
)                                       # -> [30, 14] absolute-joint chunk

Run this from the molmoact/ directory so molmoact_rt is importable.

Evaluation

Bimanual YAM on Trainium

The bimanual YAM checkpoint controls a simulated YAM in closed loop: each frame the simulator renders goes to the model, and the returned [30, 14] chunk moves the arms. Each call takes 383 ms at the median. The simulated scene uses synthetic textures that look different from the real cameras the policy was trained on, so task success there is low. The run checks that the port is wired correctly and measures its latency; it says nothing about real-world task success. docs/benchmarking.md has the details.

LIBERO on GPU

The same engine also runs the single-arm Franka checkpoint, allenai/MolmoAct2-LIBERO, in closed loop in the LIBERO simulator. In a run on GPU it completes 98.6% of the spatial suite and 100% of the object suite. The grid shows one successful episode per task from both suites:

MolmoAct2-LIBERO on GPU, one successful episode per task in the LIBERO spatial and object suites

Video of the full grid, 20 episodes

Development

cd molmoact
make lint

Contributing

See CONTRIBUTING.md. Commits are signed off (DCO).

License & attribution

The code in this repository is licensed under Apache-2.0 (see LICENSE and NOTICE). Copyright (c) 2026 Reactor Technologies, Inc.

The checkpoints are not included. Download the bimanual YAM weights (allenai/MolmoAct2-BimanualYAM) and the LIBERO weights (allenai/MolmoAct2-LIBERO) from their Hugging Face pages, under the terms published there. The code license does not cover them.

Third-party components keep their own licenses:

  • MolmoAct2 by Ai2, Apache-2.0 (MolmoAct2: Action Reasoning Models for Real-world Deployment, arXiv:2605.02881). molmoact/molmoact_hf/ holds the six model-code files from allenai/MolmoAct2-BimanualYAM at commit 8dcbed66f2380e4393189c303ea72488eb9e63c2, unchanged and with their original headers. Only molmoact/molmoact_hf/__init__.py is ours: it registers those classes with Transformers, so loading the model never runs code from a downloaded snapshot.
  • LIBERO (repo, MIT, arXiv:2306.03310), robosuite (MIT) and MuJoCo (Apache-2.0). client/sim/libero_eval.py installs them as dependencies; they are not included here.
  • The AWS Neuron SDK and Deep Learning Containers. The image is built on a public AWS Neuron container (public.ecr.aws/neuron/...) from the Amazon ECR Public Gallery. That container and the Neuron SDK in it (torch-neuronx, neuronx-cc, nki) are © Amazon.com, Inc. or its affiliates, distributed by Amazon under its own license terms, and are not relicensed here. See NOTICE.

About

No description, website, or topics provided.

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages