This document is relevant for: Trn2, Trn3
Tutorial: Deploy LingBot-World-V2 with vLLM Omni Neuron#
This tutorial walks through deploying the LingBot-World-V2 world model with the vLLM Omni Neuron plugin. It covers environment setup, model download, the deploy configuration, starting the server, and streaming camera-controlled video:
LingBot-World-V2 14B causal-fast — camera-controlled image-to-video. See its model card.
The model generates a 480p, 16 fps video from a source image and a prompt, chunk by chunk, and
follows a camera that the client gives as a camera action script, a camera trajectory or
camera interaction events.
Generation runs online: vllm-omni serve streams each chunk as fragmented MP4 over the
/v1/realtime/video WebSocket. BF16 is the precision throughout.
Task |
Endpoint |
Resolution |
Cores |
|---|---|---|---|
Camera-controlled image-to-video |
|
832x480 |
80 at LNC 1 (DiT TP8 × CP8 on 64, encode / decode on 16) |
Prerequisites:
One SSH-accessible
trn2.48xlargeortrn3.48xlarge. Step 1 prepares it.
Step 1: Set up your environment#
Complete the setup guide, choosing manual or DLC installation. It configures the dependencies, device access, and persistent caches, then verifies the environment.
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, omit
sudo docker exec vllm-omni-neuron, and replace /workspace with
$VLLM_OMNI_HOME. Write the expanded path, not the variable, in the deploy config and in the
Python commands: neither expands $VLLM_OMNI_HOME.
LingBot-World-V2 runs at a logical NeuronCore size of 1 (LNC 1): its role workers use
NeuronCores 64-79, which exist only with one logical core per physical core. Step 4 starts the
server with NEURON_LOGICAL_NC_CONFIG=1; for manual installation, export it before you start the
server.
Step 2: Download the model (optional)#
The checkpoint is licensed CC-BY-NC-SA-4.0. Review the license on Hugging Face first.
sudo docker exec vllm-omni-neuron hf download robbyant/lingbot-world-v2-14b-causal-fast-diffusers
The checkpoint is about 81 GB. It downloads into the mounted Hugging Face cache (HF_HOME),
where vllm-omni serve in Step 4 finds it by its model ID.
Note
This step is optional. Without it, vllm-omni serve downloads the weights into the same cache
on first start.
Step 3: Review the deploy configuration#
The placement and the sampling defaults live in
examples/lingbot_world/lingbot_world_v2_stepwise_neuron.yaml:
pipeline: lingbot_world
distributed_executor_backend: vllm_omni_neuron.diffusion.models.lingbot_world.executor.LingBotWorldExecutor
async_chunk: false
dtype: bfloat16
stages:
- stage_id: 0
devices: "0-63" # the DiT
max_num_seqs: 1 # one session at a time
model_class_name: LingBotWorldCausalDMDPipeline # resolved to NeuronLingBotWorldPipeline
engine_backend: vllm_omni.experimental.ar_diffusion.engine.ARDiffusionEngine
step_execution: true
streaming_output: true
parallel_config:
tensor_parallel_size: 8 # TP
ulysses_degree: 8 # CP
default_sampling_params:
num_inference_steps: 4 # the distilled step count
output_type: pil
extra_args:
flow_shift: 5.0
model_config:
ar_diffusion_height: 480
ar_diffusion_width: 832
lingbot_aux: # the role workers, one 16-rank world on cores 64-79
roles:
text: # UMT5, once per prompt
devices: "64-79"
parallel_config:
tensor_parallel_size: 16
condition: # the image condition of each chunk
devices: "64-79"
model_config:
lingbot_vae_grid: [2, 8]
decode: # the streaming VAE decode of each chunk
devices: "64-79"
model_config:
lingbot_vae_grid: [2, 8]
engine_backendselects vLLM Omni’s AR-Diffusion engine. The plugin runs it with the Neuron AR-Diffusion model runner and a paged K/V pool on the device.distributed_executor_backendstarts the role workers on cores 64-79 beside the DiT workers. The DECODE role decodes chunknwhile the DiT computes chunkn + 1.ar_diffusion_height/ar_diffusion_widthfix the video size; every graph is compiled for it at load.
These model_config keys can be set under stages[0].model_config:
Key |
Default |
Meaning |
|---|---|---|
|
480, 832 |
The video size. The graphs are compiled for this size at load |
|
see above |
The devices and layout of the text encoder ( |
|
unset |
A trusted directory on the server for camera trajectories. A session’s |
|
8 |
The number of DiT launches kept queued on the device |
|
unset |
A JSON lines file that receives one timing row per chunk |
The pipeline requires compiled execution: enforce_eager is refused.
Step 5 streams a camera trajectory, so write a copy of the file with a trusted directory,
lingbot_action_root, under stages[0].model_config:
sudo docker exec vllm-omni-neuron python -c '
import yaml
src = "/workspace/plugin/examples/lingbot_world/lingbot_world_v2_stepwise_neuron.yaml"
config = yaml.safe_load(open(src))
config["stages"][0]["model_config"]["lingbot_action_root"] = "/workspace/lingbot_actions"
yaml.safe_dump(config, open("/workspace/lingbot_world_v2.yaml", "w"), sort_keys=False)'
Step 4: Start the server#
Start the server in the container, bound to the loopback interface:
sudo docker exec -d -e NEURON_LOGICAL_NC_CONFIG=1 vllm-omni-neuron bash -c '
cd /workspace && vllm-omni serve robbyant/lingbot-world-v2-14b-causal-fast-diffusers --omni \
--deploy-config /workspace/lingbot_world_v2.yaml \
--host 127.0.0.1 --port 8091 \
--stage-init-timeout 7200 --init-timeout 7200 > /workspace/lingbot_server.log 2>&1'
On the first start, the server compiles the DiT graphs, runs a 6-chunk warm-up rollout into the steady state, and compiles and warms up the role workers’ graphs. This takes about an hour, so the command raises the start timeouts to 2 hours. Later starts reuse the persistent compile caches set up in Step 1. Wait until the server is healthy:
sudo docker exec vllm-omni-neuron bash -c \
'until curl -sf http://127.0.0.1:8091/health; do sleep 30; done; echo ready'
The server log is /workspace/lingbot_server.log. The DiT ranks log their per-core device
memory ([neuron-hbm] lines) after load and after the warm-up.
Step 5: Stream a session#
A client opens ws://127.0.0.1:8091/v1/realtime/video and sends one session.start message:
Field |
Value |
Notes |
|---|---|---|
|
text |
Encoded once per prompt by the text encoder |
|
|
The source image. The pipeline resizes it to the video size |
|
832, 480 |
Must match the deploy config |
|
|
9 frames for the first chunk, then 12 per chunk |
|
4 |
The distilled step count |
|
16 |
The frame rate of the streamed MP4 |
|
integer |
|
|
5.0 |
|
|
per chunk, 3 key lists |
A camera action script: the movement keys held in each latent frame. |
|
directory name |
A camera trajectory: per-frame camera poses and intrinsics in a directory under |
|
dict |
H.264 encoder options of the stream, for example |
The server answers each chunk with a video.chunk_metadata message and a binary
fragmented-MP4 message, and ends with session.done. With a camera action script or a camera
trajectory, the next chunk’s camera is known in advance, so the server starts the next chunk before it
returns the current one; with camera interaction, each chunk’s decode follows its DiT.
This step uses example 00 of the LingBot-World repository: its source image, its prompt and its camera trajectory. Download it into the trusted directory of Step 3:
sudo docker exec vllm-omni-neuron bash -c '
mkdir -p /workspace/lingbot_actions/00 && cd /workspace/lingbot_actions/00
for f in image.jpg prompt.txt poses.npy intrinsics.npy; do
curl -sSfLO https://raw.githubusercontent.com/Robbyant/lingbot-world/main/examples/00/$f
done'
The command below sends one session.start request from inside the container and writes the
streamed chunks to an MP4 in /workspace. The sections after it change only the request’s
camera.
Camera action script#
Fly forward for 40 chunks (477 frames, about 30 s of video), turning right during chunks 8-15:
sudo docker exec -i vllm-omni-neuron python - <<'EOF'
import base64, json
from websockets.sync.client import connect
chunks = 40
image = base64.b64encode(open("/workspace/lingbot_actions/00/image.jpg", "rb").read()).decode()
start = {
"type": "session.start",
"prompt": (
"The video presents a soaring journey through a fantasy jungle. The wind whips past the "
"rider's blue hands gripping the reins, causing the leather straps to vibrate. The ancient "
"gothic castle approaches steadily, its stone details becoming clearer against the backdrop "
"of floating islands and distant waterfalls."
),
"image_reference": {"image_url": f"data:image/jpeg;base64,{image}"},
"width": 832, "height": 480, "fps": 16, "num_frames": (3 * chunks - 1) * 4 + 1,
"num_inference_steps": 4, "seed": 42,
"extra_params": {
"flow_shift": 5.0,
"camera_action_script": [[["w", "l"] if 8 <= c < 16 else ["w"]] * 3 for c in range(chunks)],
},
}
with connect("ws://127.0.0.1:8091/v1/realtime/video", max_size=None) as ws, \
open("/workspace/lingbot_action_script.mp4", "wb") as out:
ws.send(json.dumps(start))
while not isinstance(msg := ws.recv(), str) or json.loads(msg)["type"] not in ("session.done", "error"):
if isinstance(msg, bytes):
out.write(msg) # one fragmented-MP4 piece per chunk
print(msg)
EOF
Camera trajectory#
A camera trajectory is a directory with poses.npy ([F, 4, 4] float32 OpenCV
camera-to-world poses) and intrinsics.npy ([F, 4] float32 fx, fy, cx, cy at 832 x 480),
such as the example 00 directory downloaded above. Run the command above with the directory in
place of the action script; the session follows the trajectory’s first num_frames poses:
"extra_params": {"flow_shift": 5.0, "action_path": "00"},
A known limitation of the model: while the camera holds still, the video can drift backward, and the view can move from first person to behind the rider. Example 00’s trajectory holds the camera still for its first 32 frames (about 2 s), so its video drifts this way at the start. A camera action script or camera interaction that moves from the first chunk avoids it.
Camera interaction#
Without a camera action script or a camera trajectory, the camera follows camera interaction
events (session.interaction) sent while the video streams. Each event holds an SE(3) camera
velocity per latent frame (+Z forward, a positive rotation about +Y turns right) until the next
event replaces it. An event takes effect about two chunks after it is sent, because the next
chunk is already being generated. With camera interaction the next chunk’s camera is known only
at the chunk boundary, so the next chunk’s denoise cannot start while the current chunk decodes,
and the video streams slower than with a camera action script or a camera trajectory. Send the first event right after session.start, so the camera
moves from the first chunk (see Camera trajectory for what happens when the camera holds still).
Run the command above with "extra_params": {"flow_shift": 5.0} and replace its ws.send and
receive loop with these lines. The camera moves forward from the first chunk, turns right at
6 degrees per latent frame (the action script’s l) during chunks 9-12, then goes straight:
forward = {"translation": [0.0, 0.0, 0.05], "rotation": [0.0, 0.0, 0.0, 1.0]}
right = {"translation": [0.0, 0.0, 0.05], "rotation": [0.0, 0.0523, 0.0, 0.9986]}
camera = lambda n, data: json.dumps({"type": "session.interaction", "interaction": {
"event_id": f"camera-{n}", "event": {"multi_modal_data": {"camera": {
"mode": "velocity", "data": data}}}}})
ws.send(json.dumps(start))
ws.send(camera(0, forward))
plan, n = {7: right, 11: forward}, 0
while not isinstance(msg := ws.recv(), str) or json.loads(msg)["type"] not in ("session.done", "error"):
if isinstance(msg, bytes):
out.write(msg)
n += 1
if n in plan:
ws.send(camera(n, plan[n]))
The command prints the last message of the session: session.done, or the server’s error.
Troubleshooting#
Symptom |
Likely cause |
Fix |
|---|---|---|
|
The environment sets an LNC other than 1 |
Set |
|
Driver/runtime incompatibility, unavailable devices, or another process holds the cores |
Follow the host prerequisites and device checks in the setup guide; stop leftover |
The server exits during start with a timeout |
The first start compiles every graph |
Keep |
The session’s |
|
Set |
The MP4 plays 1.5x fast |
The session omits |
Send |
Silent crash / |
|
Start the container with |
To stop the server, end the vllm-omni serve process in the container (for example
sudo docker exec vllm-omni-neuron pkill -f "vllm-omni serve").
Conclusion#
You have deployed LingBot-World-V2 on Trainium and streamed camera-controlled 480p video over the vLLM Omni realtime video endpoint in BF16: in real time with a camera action script or a camera trajectory, and with camera interaction.
Next steps#
Understand the serving path — the AR-Diffusion runner, the paged K/V pool and the encode / denoise / decode overlap: AR-Diffusion in vLLM Omni Neuron.
Features and accuracy — the supported features, the recommended configuration and the VBench-I2V results: LingBot-World-V2 model card.
This document is relevant for: Trn2, Trn3