Spaces:
Running on L40S
Running on L40S
Update README
Browse files
README.md
CHANGED
|
@@ -11,80 +11,111 @@ license: other
|
|
| 11 |
|
| 12 |
# Cosmos3 Action Viewer
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
FastAPI proxy, a Gradio backend, or ZeroGPU quota forwarding.
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
The
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
same runner lock and reuses the initialized pipeline. Packaged demo data lives
|
| 24 |
-
under `assets/examples/`. Generated artifacts are written below
|
| 25 |
-
`ACTION_VIZ_OUTPUT_ROOT`, loaded by the Viser session, and removed after each
|
| 26 |
-
generation/session cleanup path.
|
| 27 |
|
| 28 |
-
|
| 29 |
-
Hugging Face frontend. Private mode has been observed to serve the page while
|
| 30 |
-
leaving the Viser websocket disconnected.
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
|
|
|
|
| 36 |
```bash
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
docker run --rm --gpus all -p 8020:7860 \
|
| 38 |
-
-v /
|
| 39 |
cosmos3-action-viewer
|
| 40 |
```
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
-
`
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
- `ACTION_VIZ_MODEL_MOUNT_PATH`: explicit Hugging Face model mount path.
|
| 54 |
-
- `ACTION_VIZ_APP_DATA_ROOT`: default `/app_data`.
|
| 55 |
-
- `ACTION_VIZ_OUTPUT_ROOT`: default `/tmp/action_viz_sessions`.
|
| 56 |
-
- `ACTION_VIZ_BACKGROUND_WARMUP`: default `1`; set to `0` for lightweight UI-only local starts.
|
| 57 |
-
- `ACTION_VIZ_GENERATE_IMAGE_SIZE`: default `480`.
|
| 58 |
-
- `ACTION_VIZ_GENERATE_NUM_FRAMES`: default `24`.
|
| 59 |
-
- `ACTION_VIZ_GENERATE_NUM_STEPS`: default `30`.
|
| 60 |
-
- `ACTION_VIZ_DEFAULT_DATASET`: default `bridge`.
|
| 61 |
|
| 62 |
-
|
|
|
|
| 63 |
|
| 64 |
-
Checkpoint
|
| 65 |
|
| 66 |
-
``
|
| 67 |
-
|
| 68 |
-
``
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
| 71 |
-
temporary artifacts by default:
|
| 72 |
|
| 73 |
```bash
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
```
|
| 77 |
|
| 78 |
-
|
| 79 |
-
the same local checkpoint resolution as the Viser app.
|
| 80 |
|
| 81 |
-
|
| 82 |
|
| 83 |
```bash
|
| 84 |
-
docker
|
| 85 |
-
|
| 86 |
-
-
|
| 87 |
-
cosmos3-action-viewer
|
| 88 |
```
|
| 89 |
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Cosmos3 Action Viewer
|
| 13 |
|
| 14 |
+
An interactive, browser-based viewer for robot action datasets that runs Cosmos3
|
| 15 |
+
world-model generation locally. Three modes are supported:
|
|
|
|
| 16 |
|
| 17 |
+
- **Forward dynamics** β predict future video frames from a sequence of actions.
|
| 18 |
+
- **Inverse dynamics** β predict the actions that connect observed frames.
|
| 19 |
+
- **Policy** β predict the next actions to take.
|
| 20 |
|
| 21 |
+
The app serves the Viser frontend and runs Cosmos3 generation in a single
|
| 22 |
+
process. Packaged demo data ships under `assets/examples/`, so you can try every
|
| 23 |
+
mode without downloading any datasets β you only need the model checkpoint.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
## Run Locally
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
You need an NVIDIA GPU with >= 48GiB memory and the
|
| 28 |
+
[NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
|
| 29 |
+
installed.
|
| 30 |
|
| 31 |
+
One time, download the Cosmos3-Nano checkpoint:
|
| 32 |
+
```bash
|
| 33 |
+
hf download nvidia/Cosmos3-Nano --local-dir app_data/models/Cosmos3-Nano
|
| 34 |
+
```
|
| 35 |
|
| 36 |
+
To run:
|
| 37 |
```bash
|
| 38 |
+
# Build the image.
|
| 39 |
+
docker build -t cosmos3-action-viewer .
|
| 40 |
+
|
| 41 |
+
# Launch docker, mounting the directory that holds the model.
|
| 42 |
docker run --rm --gpus all -p 8020:7860 \
|
| 43 |
+
-v "$(pwd)/app_data:/app_data" \
|
| 44 |
cosmos3-action-viewer
|
| 45 |
```
|
| 46 |
|
| 47 |
+
Then open <http://localhost:8020>.
|
| 48 |
|
| 49 |
+
The container looks for the checkpoint under `/app_data/models/` (the mount
|
| 50 |
+
above), so any of these on-disk layouts work:
|
| 51 |
|
| 52 |
+
- `app_data/models/Cosmos3-Nano`
|
| 53 |
+
- `app_data/models/nvidia--Cosmos3-Nano`
|
| 54 |
|
| 55 |
+
On first launch the model is warmed up in the background. A generation requested
|
| 56 |
+
before warmup finishes simply waits for it to complete, then reuses the loaded
|
| 57 |
+
pipeline β so the first generation is the slowest and later ones are faster.
|
| 58 |
|
| 59 |
+
## Customizing a Launch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
+
All behavior is controlled through environment variables, which you can pass to
|
| 62 |
+
`docker run` with `-e NAME=value`. The most useful ones:
|
| 63 |
|
| 64 |
+
Checkpoint / data locations:
|
| 65 |
|
| 66 |
+
- `ACTION_VIZ_CHECKPOINT_LOCAL_PATH` β explicit checkpoint path, or a
|
| 67 |
+
colon-separated list of candidate paths to try in order.
|
| 68 |
+
- `ACTION_VIZ_MODEL_MOUNT_PATH` β explicit path to a mounted Hugging Face model.
|
| 69 |
+
- `ACTION_VIZ_APP_DATA_ROOT` β root for app data inside the container (default
|
| 70 |
+
`/app_data`); models are resolved under `<root>/models/`.
|
| 71 |
+
- `ACTION_VIZ_OUTPUT_ROOT` β where generated artifacts are written (default
|
| 72 |
+
`/tmp/action_viz_sessions`). Artifacts are cleaned up after each
|
| 73 |
+
generation/session.
|
| 74 |
+
|
| 75 |
+
Generation settings:
|
| 76 |
+
|
| 77 |
+
- `ACTION_VIZ_GENERATE_IMAGE_SIZE` β output resolution (default `480`).
|
| 78 |
+
- `ACTION_VIZ_GENERATE_NUM_FRAMES` β frames per generation (default `24`).
|
| 79 |
+
- `ACTION_VIZ_GENERATE_NUM_STEPS` β sampling steps (default `30`).
|
| 80 |
+
- `ACTION_VIZ_DEFAULT_DATASET` β dataset selected on load (default `bridge`).
|
| 81 |
+
- `ACTION_VIZ_USE_TORCH_COMPILE` β `torch.compile` the pipeline (default `1`).
|
| 82 |
+
The first generation pays a one-time compile cost in exchange for faster
|
| 83 |
+
subsequent runs.
|
| 84 |
+
- `ACTION_VIZ_BACKGROUND_WARMUP` β warm the model on startup (default `1`); set
|
| 85 |
+
to `0` for a lightweight UI-only start that skips loading the model.
|
| 86 |
|
| 87 |
+
Example β lower resolution, fewer steps, and a different default dataset:
|
|
|
|
| 88 |
|
| 89 |
```bash
|
| 90 |
+
docker run --rm --gpus all -p 8020:7860 \
|
| 91 |
+
-v "$(pwd)/app_data:/app_data" \
|
| 92 |
+
-e ACTION_VIZ_GENERATE_IMAGE_SIZE=320 \
|
| 93 |
+
-e ACTION_VIZ_GENERATE_NUM_STEPS=15 \
|
| 94 |
+
-e ACTION_VIZ_DEFAULT_DATASET=droid \
|
| 95 |
+
cosmos3-action-viewer
|
| 96 |
```
|
| 97 |
|
| 98 |
+
## Diagnostics
|
|
|
|
| 99 |
|
| 100 |
+
Check how the checkpoint is being resolved (read-only, no model load):
|
| 101 |
|
| 102 |
```bash
|
| 103 |
+
docker run --rm --gpus all \
|
| 104 |
+
-v "$(pwd)/app_data:/app_data" \
|
| 105 |
+
cosmos3-action-viewer python /app/scripts/checkpoint_diagnostic.py
|
|
|
|
| 106 |
```
|
| 107 |
|
| 108 |
+
Run a one-step generation smoke test without the browser UI (temporary artifacts
|
| 109 |
+
are cleaned up by default):
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
docker run --rm --gpus all \
|
| 113 |
+
-v "$(pwd)/app_data:/app_data" \
|
| 114 |
+
cosmos3-action-viewer \
|
| 115 |
+
python /app/scripts/local_generation_smoke.py --model-mode forward_dynamics --num-steps 1
|
| 116 |
+
|
| 117 |
+
docker run --rm --gpus all \
|
| 118 |
+
-v "$(pwd)/app_data:/app_data" \
|
| 119 |
+
cosmos3-action-viewer \
|
| 120 |
+
python /app/scripts/local_generation_smoke.py --model-mode policy --num-steps 1
|
| 121 |
+
```
|