Onboard world model

From nebius/nebius-physical-ai · View interactive version

Onboard world model is an AI agent skill from the GitHub repository nebius/nebius-physical-ai. Use when onboarding and containerizing a world model (learned action-conditioned simulator — Dreamer/Genie/Cosmos-style latent video prediction) into NPA as a multi-GPU BYOF registry candidate. Generalizes the Open Dreamer onboarding into a reusable playbook — containerize the repo, stage a real dat

How to use this skill

Skill file

Onboard a World Model (generic playbook)

Reusable procedure for turning an arbitrary world-model research repo into an NPA

multi-GPU BYOF registry candidate that runs live on Nebius GPUs and drops a

viewable artifact into the agent's Rerun viewer. Distilled from the Open Dreamer

onboarding; skills/tools/open-dreamer/SKILL.md is the worked reference example.

Load together with:

(base profiles, run_byof_repo.py / workbench.byof.repo toolRef, workloads).

admission contract (read upstream docs, encode each real capability as a

solution-smoke with a named JSON artifact, collect live evidence).

the REAL component, not an echo/manifest stub.

skills/atomic/agent-visual-feedback/SKILL.md.

What Is A World Model (framing)

A world model is a learned, action-conditioned simulator: it watches video

(and actions), then, given context frames + a future action sequence, **predicts

("dreams") what happens next** — no game engine, no physics sim. The payoff is

training/planning agents inside cheap, safe, parallel imagination instead of the

slow/expensive/dangerous real world (the sim-to-real bottleneck). It is neural

generation (Tensor-core matmuls/attention in bf16), not ray tracing — latents

just make prediction cheap (predict a compact latent per frame, decode once).

Contrast: Isaac Sim/Omniverse renders a hand-built 3D world; a world model

imagines the world it learned.

Platform punchline: "point NPA at a frontier world-model repo → it containerizes,

stages data to S3, runs the full loop live on Nebius K8s GPUs, and drops a

viewable .rrd into the agent's Rerun viewer, self-serve."

When To Use

Canonical World-Model Loop → Capability Contract

Map the repo's real entrypoints onto this loop and encode each stage as a

solution-specific capability id (use the repo's own names; do not force a shared

taxonomy). Three hard gates must pass for admission; the rest headline the

run.

| Stage | Capability (rename per repo) | Real component to invoke |

| --- | --- | --- |

| Multi-GPU mesh (hard gate) | <fw>_two_gpu_data_parallel_mesh | the repo's device-mesh/parallel builder over >=2 devices |

| Data loader | <dataset>_video_dataloader | the repo's real streaming dataloader (decode + action parse) with device sharding |

| Tokenizer/encoder train (hard gate) | <fw>_tokenizer_train_two_gpu | the real tokenizer/VAE training entrypoint, sharded, to legibility |

| Offline latent tokenization | <fw>_latent_tokenization | encode episodes → latent records + latent stats (mean/std) |

| Dynamics train | <fw>_dynamics_train_two_gpu | the action-conditioned latent dynamics training loop (the core world model) |

| Action-conditioned rollout (hard gate) | <fw>_action_conditioned_dream_rollout | sampler: context frames + future actions → predicted frames; report PSNR vs GT |

| Visualization | world_model_rerun_visualization | emit a Rerun .rrd with synchronized GT / dream / decoded-ceiling / recon streams |

The driver must raise SystemExit if the hard-gate capabilities are missing from

capabilities_exercised, so a single-GPU fallback cannot masquerade as a

multi-GPU run and a green smoke means the marquee dream actually ran (not just

that training started). Gating the action-conditioned rollout transitively gates

the whole loop, since it depends on every upstream stage. Emit one JSON per

capability + a combined results JSON (the smoke_artifact_name) under

$NPA_SMOKE_OUTPUT_DIR.

Containerization Recipe (generic)

Follow byof-onboard; the world-model specifics:

CUDA jax[cuda12] / torch wheels bundle their own CUDA runtime, so a CUDA

devel base is usually unnecessary. Only pin a CUDA base if the repo builds

custom CUDA/C++ extensions.

the interpreter and venv to a world-readable dir and chmod -R a+rX them

(uv's default /root/... dirs are unreadable by the runtime user):

```bash

export UV_PYTHON_INSTALL_DIR=/opt/uv/python UV_CACHE_DIR=/opt/uv/cache

uv python install <pyver> && uv venv --python <pyver> /opt/byof/.venv

(uv sync --frozen || uv sync) # or: pip install -e . / -r requirements

chmod -R a+rX /opt/byof/.venv /opt/uv/python

```

For pip-based repos, mirror the pattern with a venv under /opt/byof/.venv.

torch==x.y.z+cuNNN). Include media deps the loader needs (decord/av,

imageio[ffmpeg]).

it must match the agent viewer version (currently 0.31.4) or the .rrd

won't load live.

e.g. python -c "import jax, flax, <repo_pkg>" (PyTorch: import torch; assert torch.cuda.is_available at run time, not build).

possible (e.g. lpips_weight=0 to avoid an HF alexnet fetch); note it as

intentional. Never bake secrets/tokens/bucket names into the image.

uv run (which tries to re-sync the root-owned venv at run time).

Data Contract (real data, staged to the run bucket)

project run bucket under a stable prefix (e.g. datasets/<name>/). The smoke

derives the bucket from S3_OUTPUT_PREFIX and pulls it at run time. Do not

hardcode buckets/paths in the spec.

download the dataset in a bash prelude before the venv driver runs.

the tokenizer resolution, fixed-length clips, the repo's action layout).

NPA Wiring

| Item | Path / pattern |

| --- | --- |

| Workflow spec | workflows/testing/byof-<model>.yaml (workload: solution-smoke) |

| N-GPU resource profile | npa/src/npa/workflows/byof/profiles/byof-solution-smoke-rtxpro-2gpu.yaml (or a new N-GPU profile) |

| toolRef | workbench.byof.repo (argv consumes smoke_command, resource_profile_yaml, output_root, run.id, …) |

| Catalog + contract | docs/workbench/oss-solution-catalog.md + npa/tests/workflows/test_byof_solution_smokes.py (must_exercise) |

Spec hygiene (learned from Open Dreamer):

--var bucket=<real> (submit) or the runner resolves the project run bucket.

appends /<run-id>/ to --output-root, so a run-id in output_root yields a

doubled .../<run-id>/<run-id>/ prefix that summary_uri never points at. Use

a base output_root and put {{run.id}} in summary_uri.

(the profile is the scheduling source of truth).

Validate (before any live run)

npa/.venv/bin/npa workbench workflow validate-spec \
  workflows/testing/byof-<model>.yaml --json
npa/.venv/bin/python -m pytest npa/tests/workflows/test_byof_solution_smokes.py \
  npa/tests/guardrails/test_skills_index.py npa/tests/smoke/test_all_workflow_yamls.py -q

Ship a tiny CPU profile in the driver (OD_MODE=cpu-style env: 1 device, a

few steps, tiny model, a local sample dataset) so the whole chain can be

validated offline before burning GPU-hours.

Live GPU Test

Model the checked-in live test on npa/tests/e2e/test_byof_open_dreamer_live_e2e.py:

..._TEST_IMAGE to skip rebuilds); a non-GPU render check still asserts the

spec resolves the workbench.byof.repo toolRef (assert on plan.to_dict()["steps"]).

runner (the real GPU path); the npa workbench workflow submit path is

intentionally plan-only for BYOF (its outer K8s pod can't build images).

(test-resolvable bucket, dataset staged there) and verify at that exact prefix

via S3 — the pod resolves a tenant run bucket at runtime the test can't

rediscover, especially when the runner returns before upload.

device mesh >= 2, and a non-trivial .rrd.

View / Share

Upload the .rrd to the run's S3 prefix and load it into a live agent:

curl -sk -u "$AGENT_USER:$AGENT_PASSWORD" -X POST https://<agent-ip>/api/sim-viz/load-artifact \
  -H 'content-type: application/json' \
  -d '{"run_id":"<run-id>","s3_uri": "s3://<bucket>/<prefix>/<run-id>/<model>_world_model.rrd"}'

Cross-World-Model Gotchas

min(T, context_length) or the KV cache overflows at prefill.

packing_factor must divide the tokenizer n_latents.

with np.maximum(std, 1e-6).

runner caps its own polling — never SIGKILL it mid-run (use --no-cleanup and

monitor via kubectl/S3; the job uploads on its own).

0% while the other pins at 100%, "leaked shared_memory" warnings). Lower

num_workers and ensure clean shutdown if a longer run hangs.

a legible-but-soft short-horizon dream is expected at smoke budgets.

Onboarding Procedure (checklist)

  1. Read upstream docs; identify the loop entrypoints (mesh, dataloader,

tokenizer, tokenization, dynamics, sampler, eval).

  1. Write the driver (env-parameterized, GPU defaults + CPU profile) that runs the

loop and emits per-capability JSON + the combined results artifact.

  1. Author byof-<model>.yaml (workload: solution-smoke) + an N-GPU resource

profile; wire the capability contract into test_byof_solution_smokes.py,

the catalog, and this/related skills. Add the index entry.

  1. CPU-validate the driver offline; validate-spec + run the guardrail gate.
  2. Stage the real dataset to the run bucket.
  3. Build + push the image (byof-onboard); run the live 2-GPU smoke; confirm all

capabilities, 0 deferred, and a viewable .rrd.

  1. Add the gated live GPU e2e test; load the .rrd into the agent viewer.
  2. For registry admission, follow oss-solution-registry-onboard.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.