Skip to content

WorldPlay2: Extending Real-Time Interactive World Models in Control and Horizon

Python

refactor: keep the WorldPlay2 integration inside reactor

Rising03213d324b350c45
diff --git a/README.md b/README.md
index da7de93..20d4f3c 100644
--- a/README.md
+++ b/README.md
@@ -127,11 +127,12 @@ All input items are processed, and videos are saved as `<output_name>.mp4` in
## ⚡ Quick Start with Reactor Runtime
-The [`reactor/`](reactor/README.md) integration serves WorldPlay2 as an interactive model with a browser frontend. The default configuration uses 4 NVIDIA B200 GPUs, Docker and the NVIDIA Container Toolkit. Follow the [Reactor setup guide](reactor/README.md#1-install-the-reactor-cli) to install the CLI and prepare the weights under `weights/base` and `weights/fast`.
+The [`reactor/`](reactor/README.md) integration serves WorldPlay2 as an interactive model with a browser frontend. The default configuration uses 4 NVIDIA B200 GPUs, Docker and the NVIDIA Container Toolkit. Follow the [Reactor setup guide](reactor/README.md#1-install-the-reactor-cli) to install the CLI and prepare the weights under `reactor/weights/base` and `reactor/weights/fast`.
-Build and start the model from the repository root, selecting four available GPUs:
+From the repository root, enter `reactor/`, then build and start the model on four available GPUs:
```bash
+cd reactor
reactor build
reactor run --gpus '"device=0,1,2,3"' --port 8080
```
diff --git a/.dockerignore b/reactor/.dockerignore
similarity index 88%
rename from .dockerignore
rename to reactor/.dockerignore
index afa20b4..55a3c3b 100644
--- a/.dockerignore
+++ b/reactor/.dockerignore
@@ -21,5 +21,5 @@ recordings/
*.ckpt
*.log
# Not part of the served model
-reactor/demo/
-reactor/assets/
+demo/
+assets/
diff --git a/.gitignore b/reactor/.gitignore
similarity index 90%
rename from .gitignore
rename to reactor/.gitignore
index fafad19..bf1b12c 100644
--- a/.gitignore
+++ b/reactor/.gitignore
@@ -1,4 +1,3 @@
-# JetBrains IDE settings
# Model weights and local environments are never part of the integration.
.idea/
__pycache__/
diff --git a/reactor/README.md b/reactor/README.md
index acf9d7e..0af12a0 100644
--- a/reactor/README.md
+++ b/reactor/README.md
@@ -33,7 +33,11 @@ endpoint list). Deployment is enabled per account by the Reactor team: ask us in
- Python 3 (for the Hugging Face download tool).
- On the machine where you open the browser: this repository, Node.js 20+ and [pnpm](https://pnpm.io/installation).
-Run every command from the root of this repository.
+Run the following commands from the `reactor/` directory:
+
+```sh
+cd reactor
+```
## 1. Install the reactor CLI
@@ -108,7 +112,7 @@ reconnecting the client alone does not restart it.
On the machine with your browser:
```sh
-cd reactor/demo && cp .env.example .env && pnpm install && pnpm dev
+cd demo && cp .env.example .env && pnpm install && pnpm dev
```
Open http://localhost:3000 and pick the **Local** endpoint. If the model runs on another machine,
@@ -194,8 +198,10 @@ buffered. A world ends after 256 chunks, the model's limit; reset or pick an ima
- **Code map:** `worldplay2_app.py` (client commands and session), `worldplay2_model.py`
(model and settings), `worldplay2_types.py` (controls and messages), `acceleration/` (runtime
code), `inference/` (streaming and optimized model extensions), `worldplay2.yaml` (settings),
- `demo/` (client). These live under `reactor/`; shared inference components are imported from
- the upstream `worldplay2/` and `configs/` packages. The root `reactor.yaml` builds both together.
+ `demo/` (client). These live under `reactor/`, along with `reactor.yaml` and the build configuration.
+ The image fetches a pinned official WorldPlay2 revision for the shared `worldplay2/` and `configs/`
+ packages, then loads the local Reactor adapter. Updating that upstream dependency means changing
+ its commit in `reactor.yaml`; edits to the repository's sibling packages are not included in this build.
## Where this is going
diff --git a/reactor.yaml b/reactor/reactor.yaml
similarity index 68%
rename from reactor.yaml
rename to reactor/reactor.yaml
index 285f2ac..70a3c07 100644
--- a/reactor.yaml
+++ b/reactor/reactor.yaml
@@ -18,12 +18,12 @@ model:
runtime:
import: reactor.worldplay2_app:WorldPlay2
- config: reactor/worldplay2.yaml
+ config: worldplay2.yaml
weights_path: ./weights
build:
runtime_version: "3.6.1"
- python_requirements: reactor/requirements.txt
+ python_requirements: requirements.txt
# Keep non-Torch packages on PyPI; the CUDA index can lag NumPy releases.
python_indexes:
- https://pypi.org/simple
@@ -37,6 +37,13 @@ build:
- pip install --no-cache-dir --no-build-isolation flash-attn==2.8.3
# FlashAttention 4 after FlashAttention 2: both wheels ship flash_attn/cute, and FA4's must win.
- pip install --no-cache-dir flash-attn-4==4.0.0b33
+ # Pin the shared upstream modules so reactor/ is a self-contained build context.
+ - >-
+ git init /opt/worldplay2
+ && git -C /opt/worldplay2 fetch --depth 1 https://github.com/WorldPlay2/WorldPlay2.git 6c7dd87c09b99b9c9086d6265b50db34f997502a
+ && git -C /opt/worldplay2 checkout --detach FETCH_HEAD
+ && ln -s /app /opt/worldplay2/reactor
runtime_env:
+ PYTHONPATH: /opt/worldplay2
TOKENIZERS_PARALLELISM: "false"
OMP_NUM_THREADS: "8"