---
myst:
  html_meta:
    description: "End-to-end tutorial for serving the FLUX.3 Action DROID robot policy with vLLM Omni Neuron on Trn2, covering environment setup (manual or DLC installation), model download, the deploy configurations of the base, gd and sd variants, the OpenPI WebSocket endpoint, and a plan latency measurement for the gd variant."
    keywords: "vLLM Omni, Neuron, FLUX.3 Action, flux-3-action-droid, robot policy, vision-language-action, DROID, OpenPI, WebSocket, online serving, BF16, tensor parallelism, context parallelism, CFG parallelism, tutorial, Trn2, Trainium"
    content_type: "procedural-tutorial"
    date-modified: "2026-11-20"
---

# Tutorial: Deploy FLUX.3 Action with vLLM Omni Neuron

This tutorial walks through deploying the FLUX.3 Action robot policy with the vLLM Omni
Neuron plugin. It covers environment setup, model download, deploy configuration, and
online serving over the OpenPI WebSocket. FLUX.3 Action comes in three BF16 policy
variants, all served by this plugin from one repository,
[black-forest-labs/flux-3-action-droid](https://huggingface.co/black-forest-labs/flux-3-action-droid).
The `base` policy is at the repository root, and the `gd` and `sd` variants are under
`variants/`. See the [model card](../models/flux3-action.md).

`variants/` also holds the FP8 variants `fp8r`, `gd-fp8r` and `sd-fp8r`. The deploy configs
in this tutorial cover the three BF16 variants.

FLUX.3 Action is trained on the DROID manipulation dataset. Each request, called a *plan*
in this tutorial, carries one observation. An observation holds a wrist camera view, two
exterior camera views, the joint and gripper state, and a language instruction. For each
plan, the policy denoises a short video latent together with a chunk of 32 future actions.
It returns the actions as a `(32, 8)` array: 7 joint positions and the gripper for each
action.

The policy runs a Qwen3-VL-4B-Instruct text encoder, the video VAE encoder of
[flux-3-action-base](https://huggingface.co/black-forest-labs/flux-3-action-base), and a
flow-matching DiT. Serving is **online**: `vllm serve` exposes the policy on the vLLM Omni
OpenPI WebSocket, `/v1/realtime/robot/openpi`. An OpenPI policy client connects when it
passes the full endpoint URL as its `host`, as [Step 5](#step-5-send-an-observation) shows.
There is no offline entry script. BF16 is the precision throughout.

| Variant | Sampler | Deploy config | Cores |
|---------|---------|---------------|-------|
| `base` | 4 steps, guidance 4.0 (video) and 1.0 (action) | `flux3_action_base_tp4cfg2.yaml` | 8 (TP4 × CFG2) |
| `gd` (guidance-distilled) | 4 steps, no guidance | `flux3_action_gd_tp4cp2.yaml` | 8 (TP4 × CP2) |
| `sd` (step-distilled) | 1 step, no guidance | `flux3_action_sd_tp4cp2.yaml` | 8 (TP4 × CP2) |

The table lists the 8-core deploy config of each variant. This tutorial serves `gd` on
TP4 × CP2. [Step 3](#step-3-choose-the-deploy-configuration) lists all seven deploy configs.

**Prerequisites:**

- One SSH-accessible `trn2.48xlarge` instance. Step 1 prepares it. FLUX.3 Action is not
  yet validated on Trn3.
- A Hugging Face account that has accepted the licenses of the gated
  `black-forest-labs/flux-3-action-droid` and `black-forest-labs/flux-3-action-base`
  repositories.
- About 25 GB of storage for the [Step 2](#step-2-download-the-model) downloads (the sum of
  their file sizes on Hugging Face), plus compilation caches.

## Step 1: Set up your environment

Complete the [setup guide](../getting-started/setup-guide.md), choosing manual or
DLC installation. It configures the dependencies, device access, and persistent
caches, then verifies the environment. For the DLC flow, add `-p 127.0.0.1:8091:8091`
to the setup guide's `docker run` command. The server listens on that port.

Run these commands in an SSH session on the instance host, using its DLC container
`vllm-omni-neuron`. For manual installation, run the commands in the activated
environment and replace `/workspace` with `$VLLM_OMNI_HOME`. Omit the
`sudo docker exec` prefix, and set its `-e` variables with `export` instead.

Log in with a Hugging Face access token, so that `hf` can download the gated repositories:

```bash
sudo docker exec -it vllm-omni-neuron hf auth login
```

## Step 2: Download the model

Download the policy files of one variant into a local directory.
[Step 4](#step-4-start-the-server) serves that directory. When `vllm serve` gets the Hugging
Face model ID instead, vLLM Omni downloads the whole policy repository: six policies, about
63 GB (the sum of its file sizes on Hugging Face).

```bash
sudo docker exec vllm-omni-neuron hf download black-forest-labs/flux-3-action-droid \
    config.json variants/gd/config.json variants/gd/model.safetensors \
    --local-dir /workspace/huggingface/flux-3-action-droid
```

The served directory needs the root `config.json`. The pipeline reads a variant other than
`base` from `variants/<variant>` under it. For `base`, download `config.json` and
`model.safetensors` from the repository root instead. For `sd`, replace `gd` with `sd` in
the paths.

The variant's `config.json` holds its sampler settings. The repository's `config.native.json`
holds the same sampler settings, so the command downloads `config.json` only.

The deploy configs name the video VAE and the text encoder by their Hugging Face IDs. These
commands download them into the Hugging Face cache under `/workspace/huggingface`:

```bash
sudo docker exec vllm-omni-neuron hf download black-forest-labs/flux-3-action-base \
    video_vae.safetensors
sudo docker exec vllm-omni-neuron hf download Qwen/Qwen3-VL-4B-Instruct
```

:::{note}
The video VAE and text encoder downloads are optional. Without them, the server downloads
`video_vae.safetensors` and the text encoder repository into the same cache on its first
start. The policy weights take 13.9 GB, the video VAE 2.5 GB and the text encoder 8.9 GB
(file sizes on Hugging Face).
:::

## Step 3: Choose the deploy configuration

The parallelism layout, the policy variant and the OpenPI metadata live in a deploy-config
YAML, not on the command line. Each file in
[`examples/flux3_action/`](https://github.com/aws-neuron/vllm-omni-neuron/blob/main/examples/flux3_action/)
is a complete deploy config for one variant and layout. `vllm serve` reads it with
`--deploy-config`. The `gd` TP4 × CP2 config, with comments added, is:

```yaml
# examples/flux3_action/flux3_action_gd_tp4cp2.yaml, annotated
pipeline: flux3_action
async_chunk: false

stages:
  - stage_id: 0
    max_num_seqs: 1                # one plan at a time
    runtime:
      devices: "0-7"               # 8 logical NeuronCores on 2 chips
    engine_args:
      model_class_name: Flux3ActionPipeline  # resolved to NeuronFlux3ActionPipeline by the plugin
      dtype: bfloat16
      parallel_config:
        tensor_parallel_size: 4    # TP: shards the DiT and the text encoder
        ring_degree: 2             # CP degree: splits the joint sequence over 2 TP groups
      model_config:
        variant: gd                # base = repository root, else variants/<variant>
        text_encoder_path: Qwen/Qwen3-VL-4B-Instruct
        video_vae_path: black-forest-labs/flux-3-action-base
        policy_server_config:      # sent to each OpenPI client on connect
          image_resolution: [360, 640]
          n_external_cameras: 2
          needs_wrist_camera: true
          needs_stereo_camera: false
          needs_session_id: false
          action_space: joint_position
          action_horizon: 32
          action_dim: 8
```

- **`ring_degree`** (not `sequence_parallel_size`) sets the context-parallel (CP) degree.
  CP splits the rows of the joint text, video and action sequence over `ring_degree` TP
  groups. See the [context parallelism design doc](../design/context_parallelism.md).
- **`cfg_parallel_size: 2`** appears only in the `base` TP4 × CFG2 config. CFG parallelism
  runs the conditional and unconditional passes of each step on separate TP groups. `gd`
  and `sd` run one pass per step.
- **`policy_server_config`** is required for the OpenPI endpoint. Without it, the server
  logs `Rejecting robot OpenPI WebSocket: policy serving is disabled`. It then sends a JSON
  error frame and closes the connection.
- **`text_encoder_path`** and **`video_vae_path`** also accept local directories. The
  model card lists the `model_config` keys that override the sampler settings of the
  variant's config file.

A Trn2 chip has 4 logical NeuronCores at the default logical core size of 2:

| Deploy config | Variant | Layout | Logical cores (chips) |
|---------------|---------|--------|-----------------------|
| `flux3_action_base_tp4.yaml` | `base` | TP4 | 4 (1) |
| `flux3_action_base_tp4cfg2.yaml` | `base` | TP4 × CFG2 | 8 (2) |
| `flux3_action_gd_tp4.yaml` | `gd` | TP4 | 4 (1) |
| `flux3_action_gd_tp4cp2.yaml` | `gd` | TP4 × CP2 | 8 (2) |
| `flux3_action_gd_tp8cp2.yaml` | `gd` | TP8 × CP2 | 16 (4) |
| `flux3_action_sd_tp4.yaml` | `sd` | TP4 | 4 (1) |
| `flux3_action_sd_tp4cp2.yaml` | `sd` | TP4 × CP2 | 8 (2) |

## Step 4: Start the server

In an SSH session on the instance host, run the server in the foreground inside
the `vllm-omni-neuron` container:

```bash
sudo docker exec -it \
  -e NEURON_SCRATCHPAD_PAGE_SIZE=2048 \
  -e NEURON_RT_DBG_INTRA_RDH_CHANNEL_BUFFER_SIZE=167772160 \
  -e NEURON_RT_DBG_CC_DMA_PACKET_SIZE=2048 \
  -e TORCH_NEURONX_NEFF_CACHE_LOCK_TIMEOUT=14400 \
  -e TORCH_NEURONX_VOCAB_SHARDING_SPMD_DISABLE=1 \
  -e VLLM_NEURON_COMPILATION_TIMEOUT=3600 \
  vllm-omni-neuron \
  vllm serve /workspace/huggingface/flux-3-action-droid \
    --omni \
    --host 0.0.0.0 \
    --port 8091 \
    --deploy-config /workspace/plugin/examples/flux3_action/flux3_action_gd_tp4cp2.yaml \
    --stage-init-timeout 3600 \
    --init-timeout 3600
```

`vllm serve` and the deploy configs do not set these Neuron runtime and compiler
variables, so the command passes them to the server. The model card's latency benchmark
uses the same values. `NEURON_SCRATCHPAD_PAGE_SIZE` must match the
`--hbm-scratchpad-page-size=2048` flag of the compiled graphs, and
`NEURON_RT_DBG_CC_DMA_PACKET_SIZE` sets the DMA packet size of the collectives. The
timeouts give the first start time to compile.

For manual installation, also use `--host 127.0.0.1` instead of `--host 0.0.0.0`, so
that the unauthenticated API stays on the instance loopback interface.

Keep this SSH session open. Startup takes several minutes, because the engine's warm-up
plan compiles the graphs for every instruction of up to 80 tokens, chat template
included. The server is ready when the log reports that application startup is complete.
Early in startup, the log shows `Error parsing config for
/workspace/huggingface/flux-3-action-droid: Unrecognized model` twice, and the server
continues. The compiled graphs stay in the cache under `/workspace/vllm-cache`, so a later
start of the same deploy config skips the compile.

Open a second SSH session to the same instance and run the client commands below there.
`127.0.0.1` then refers to the instance. Check that the server answers:

```bash
curl --fail http://127.0.0.1:8091/health
```

To run the client on your local machine instead, forward the port in a separate local
terminal, replacing the example username and address:

```bash
ssh -N -L 8091:127.0.0.1:8091 ubuntu@INSTANCE_ADDRESS
```

## Step 5: Send an observation

The client uses `openpi-client`, the OpenPI policy client package. Install it in a Python
environment of its own, because the package requires `numpy<2`. NumPy 1.x has wheels only
up to Python 3.12, so create the environment with Python 3.12 or earlier. On Ubuntu,
`python3 -m venv` needs the `python3-venv` package:

```bash
python3 --version
python3 -m venv ~/flux3-action-client
~/flux3-action-client/bin/python -m pip install openpi-client typing_extensions
```

`openpi-client` imports `typing_extensions` without listing it as a dependency, so the
command installs both.

Save this script as `flux3_action_client.py`:

```python
import numpy as np
from openpi_client.websocket_client_policy import WebsocketClientPolicy

policy = WebsocketClientPolicy(host="ws://127.0.0.1:8091/v1/realtime/robot/openpi")
print(policy.get_server_metadata())

view = np.zeros((360, 640, 3), dtype=np.uint8)
obs = {
    "observation/wrist_image_left": view,
    "observation/exterior_image_1_left": view,
    "observation/exterior_image_2_left": view,
    "observation/joint_position": np.zeros(7, dtype=np.float32),
    "observation/gripper_position": np.zeros(1, dtype=np.float32),
    "prompt": "put the marker in the cup",
    "seed": 0,
}
first = np.asarray(policy.infer(obs))
second = np.asarray(policy.infer(obs))
print(first.shape, first.dtype, np.array_equal(first, second))
```

Run it:

```bash
~/flux3-action-client/bin/python flux3_action_client.py
```

The script prints the `policy_server_config` of the deploy config, then
`(32, 8) float32 True`.

- The three views are RGB `uint8` arrays of one shape, 360 x 640. A client can send one
  composed `observation/image` of 540 x 640 instead. Its wrist view is on top, and the two
  exterior views are below it at half size.
- `observation/joint_position` holds the 7 joint positions, and
  `observation/gripper_position` holds the gripper position.
- `seed` makes the actions repeatable. The same observation and seed return bit-identical
  actions, which the last line checks. Without `seed`, vLLM Omni draws a random seed for
  each plan.
- The pipeline keeps no state between plans. `session_id` and the OpenPI `reset` command
  therefore do not change the actions.
- The pipeline takes its step count from the variant's config file or the deploy config's
  `model_config`. It ignores a `num_inference_steps` value in the observation's
  `sampling_params`.

## Step 6: Measure plan latency

Append these lines to `flux3_action_client.py` and run it again. They time 50 plans after
10 warm-up plans:

```python
import time

seconds = []
for _ in range(60):
    start = time.perf_counter()
    policy.infer(obs)
    seconds.append(time.perf_counter() - start)
timed = np.array(seconds[10:])
print(f"{timed.size} plans: p50 {np.percentile(timed, 50):.3f} s, p90 {np.percentile(timed, 90):.3f} s")
```

Each value is the client round trip of one plan, including the WebSocket transport. The
[model card](../models/flux3-action.md#performance) lists the plan latency of the three
variants on 2 chips. Its benchmark times `Omni.generate`, so those values exclude the
WebSocket transport. Latency can vary by 10% or more between `trn2.48xlarge` nodes.

An instruction longer than 80 tokens, chat template included, compiles its own graphs on
its first plan. Send one such plan before you time a policy that receives long
instructions. The model card's [Accuracy](../models/flux3-action.md#accuracy) section
describes how the actions of each deploy config compare with FP32 and BF16 CPU references.

## Troubleshooting

| Symptom | Likely cause | Fix |
|---------|--------------|-----|
| `NRT_FAILURE` in `nrt_init()` / "Logical Neuron Core(s) not available" | Driver/runtime incompatibility, unavailable devices, or another process holds the cores | Follow the host prerequisites and device checks in the setup guide. Stop other servers on the same cores. |
| `GatedRepoError` or HTTP 401 during download | License not accepted, or no Hugging Face login | Accept the license on both Black Forest Labs repository pages and run `hf auth login`. |
| Startup stops, and the server logs `[StageInit] Diffusion stage process <name> not READY after <N>s (stage_init_timeout); terminating its processes` | The warm-up plan compiles for longer than `--stage-init-timeout` or `--init-timeout` | Raise both values. |
| `WebsocketClientPolicy(...)` raises `TypeError: a bytes-like object is required, not 'str'`, and the server logs `Rejecting robot OpenPI WebSocket: policy serving is disabled` | The deploy config has no `model_config.policy_server_config`, so the server sends a JSON error frame instead of the policy metadata | Start the server with a deploy config from `examples/flux3_action/`. |
| `policy.infer` returns `{'type': 'error', 'message': 'Internal inference error'}` | The pipeline rejected the observation, for example a view of another shape or a missing key | Read the server log. Send three 360 x 640 `uint8` views, 7 joint positions and 1 gripper position. |
| The connection closes after a pause | The server closes a WebSocket that stays idle for 30 seconds | Reconnect, or start the server with `--robot-openpi-idle-timeout 0`. |
| The first plan with a long instruction is slow | An instruction over 80 tokens compiles its own graphs | Send one such plan before timing. |

## Clean up

Press `Ctrl+C` in the server terminal to stop the server. If you opened an SSH tunnel,
press `Ctrl+C` in its terminal too. With the DLC flow, the `vllm-omni-neuron` container also
serves the other tutorials. If you no longer need it, stop and remove it:

```bash
sudo docker stop vllm-omni-neuron
sudo docker rm vllm-omni-neuron
```

Remove the client environment and script on the machine where you created them, from the
directory that holds the script:

```bash
rm -rf ~/flux3-action-client flux3_action_client.py
```

The downloaded weights and the compiled graphs stay on the instance host for later runs.
They are in the `huggingface` and `vllm-cache` directories of `$VLLM_OMNI_HOME`, which the
container mounts at `/workspace`.

## Conclusion

You have deployed FLUX.3 Action on Trainium. The `gd` policy serves plans over the OpenPI
WebSocket in BF16, and you have measured its plan latency. The `base` and `sd` variants
each need their own [Step 2](#step-2-download-the-model) download and deploy config.

## Next steps

- **Latency, accuracy and limitations**: the [FLUX.3 Action model card](../models/flux3-action.md)
  lists the measured plan latency, the accuracy check and the known limitations.
- **OpenPI protocol**: the
  [vLLM Omni OpenPI API](https://github.com/vllm-project/vllm-omni/blob/v0.32.0/docs/serving/openpi_api.md)
  describes the handshake, the message format, sessions and limits.
- **Context parallelism**: the [design doc](../design/context_parallelism.md) explains how
  CP splits the sequence over the TP groups.
