Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions configs/omnidreams_demo_replay_benchmarks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"schema_version": 1,
"description": "Manual one-minute local benchmark scenarios for comparing the legacy Omnidreams single-view runner against the experimental shared demo replay path. The runner writes the legacy stacked HDMap/RGB canvas while the shared demo writes generated RGB output, so use the report for manual MP4 comparison rather than automatic pixel quality scoring.",
"scenarios": [
{
"id": "omnidreams-sv-runner-baseline",
"name": "Omnidreams single-view runner baseline",
"description": "Runs the stable legacy Omnidreams single-view runner with the bundled example data for the same one-minute block count used by the shipped Omnidreams baseline.",
"report_group": {
"id": "omnidreams-demo",
"name": "Omnidreams Demo Comparison"
},
"tags": [
"manual",
"gpu",
"real-demo",
"omnidreams",
"i2v",
"replay",
"baseline"
],
"env": {
"CUBLAS_WORKSPACE_CONFIG": ":4096:8",
"PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True"
},
"command": [
"uv",
"run",
"--project",
"integrations/omnidreams",
"flashdreams-run",
"omnidreams-sv-2steps-chunk2-loc6-lightvae-lighttae",
"--example-data",
"True",
"--example-data-uuid",
"239560dc-33d1-11ef-9720-00044bcbccac",
"--total-blocks",
"226"
],
"warmup_steps": 1,
"quality_baseline_compare": false,
"timeout_s": 7200
},
{
"id": "omnidreams-sv-demo-replay",
"name": "Omnidreams shared demo replay",
"description": "Runs the experimental shared demo API replay path with the same stable non-perf preset, bundled example data, and one-minute block count as the legacy runner.",
"report_group": {
"id": "omnidreams-demo",
"name": "Omnidreams Demo Comparison"
},
"tags": [
"manual",
"gpu",
"real-demo",
"omnidreams",
"i2v",
"replay",
"shared-demo"
],
"env": {
"CUBLAS_WORKSPACE_CONFIG": ":4096:8",
"PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True"
},
"command": [
"uv",
"run",
"--project",
"integrations/omnidreams",
"omnidreams-demo",
"replay",
"--preset-id",
"omnidreams-sv-2steps-chunk2-loc6-lightvae-lighttae",
"--example-data",
"--example-data-uuid",
"239560dc-33d1-11ef-9720-00044bcbccac",
"--total-blocks",
"226",
"--output",
"{output_dir}/omnidreams-sv-demo-replay.mp4"
],
"output_dir_arg": null,
"warmup_steps": 1,
"quality_baseline_compare": false,
"timeout_s": 7200
}
]
}
64 changes: 45 additions & 19 deletions docs/inference_runtime_api_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,24 @@ model.
## Current Implementation Plan

Implementation should happen on an experimental integration branch. PRs for this
work should target that branch until the API shape, LingBot migration, and
OmniDreams migration are all working well enough to merge to `main` together.
work should target that branch until the API shape and OmniDreams migration are
working well enough to merge to `main` together. LingBot migration is deferred
to a separate follow-up after the OmniDreams path has clarified the shared demo
API shape.

The experimental branch can temporarily break or simplify command-line options
while the demos are being moved to the new API. The required outcome is that the
LingBot and OmniDreams demos still run through the new runtime path, and that
benchmark tooling can confirm they are at least broadly healthy before the
branch is merged back to `main`.
while the demos are being moved to the new API. The required outcome for this
branch is that the OmniDreams demo runs through the new shared demo/runtime path,
and that benchmark and manual WebRTC checks can confirm it is at least broadly
healthy before the branch is merged back to `main`.

Initial scope:

- define the minimal runtime API envelope;
- migrate LingBot and OmniDreams to use it;
- migrate OmniDreams to use it through a shared demo-level API;
- support selectable output modes such as MP4, JPEG/MJPEG stream, WebRTC, and
headless/null where appropriate;
- use or update benchmark tooling to verify the migrated demos;
- use or update benchmark tooling to verify the migrated OmniDreams demo;
- defer broader model migrations, hosted execution, full autotune, and polished
metrics until the first branch proves the API shape.

Expand All @@ -71,14 +73,30 @@ Initial scope:
| T1 | Complete | Minimal API envelope and naming. | Partly. | T0. | `InferenceConfig`, `UserInputs`, `InferenceInput`, runtime/session, output target, and mapping boundaries are defined well enough for demos to use. |
| T2 | Complete | Event-based `UserInputs`. | Yes, after T1 direction is agreed. | T1. | User inputs are primarily timestamped events; replay traces and derived snapshots are supported where needed. |
| T3 | Complete | `CanonicalInputs`, `InferenceInput`, schemas, and mapping boundary. | Yes, after T1 direction is agreed. | T1. | Models can declare required global/per-step inputs, and mappings can convert canonical inputs into inference inputs. |
| T4 | Planned | `ModelRunner`, `InferenceRuntime`, and `InferenceSession` skeleton. | Partly. | T1. | A minimal standard loop can initialize a runtime, run at least one sequential session, and close cleanly. |
| T4 | Complete | `ModelRunner`, `InferenceRuntime`, and `InferenceSession` skeleton. | Partly. | T1. | A minimal standard loop can initialize a runtime, run at least one sequential session, and close cleanly. |
| T5 | Planned | Output mode selection. | Yes, after the result/output shape is agreed. | T1, T4. | A run can choose output behavior such as MP4, JPEG/MJPEG stream, WebRTC, benchmark artifact, or headless/null without changing model code. |
| T6 | Planned | LingBot migration. | Yes, once T2-T4 have a usable skeleton. | T2, T3, T4. | LingBot runs through the new API path with its event inputs mapped into model inputs. |
| T7 | Planned | OmniDreams migration. | Yes, once T2-T4 have a usable skeleton. | T2, T3, T4. | OmniDreams runs through the new API path with its model-specific inputs and mapping preserved. |
| T8 | Planned | Benchmark/smoke verification for LingBot and OmniDreams. | Preparation can run early; final gate is late. | T5, T6, T7. | Existing or updated benchmark tooling can run both migrated demos and produce enough evidence that they still work. |
| T6 | Deferred | LingBot migration. | Yes, but out of scope for this branch. | T2, T3, T4. | LingBot runs through the new API path with its event inputs mapped into model inputs. |
| T7 | Partially complete | OmniDreams migration. | Yes, once T2-T4 have a usable skeleton. | T2, T3, T4. | OmniDreams replay and WebRTC run through the shared demo API path; remaining work is output/stat integration, legacy demo retirement, and cleanup. |
| T8 | Partially complete | Benchmark/smoke verification for OmniDreams. | Preparation can run early; final gate is late. | T5, T7. | Existing or updated benchmark tooling can run the migrated OmniDreams demo and produce enough evidence that it still works. |
| T9 | Planned | Metrics and profiling normalization for the branch. | Yes, but final integration is late. | T4, T5, T8. | Basic canonical metrics are emitted for migrated demos; deeper metrics can remain follow-up work. |
| T10 | Planned | CLI compatibility and migration cleanup. | Yes, after demo migrations start. | T6, T7. | Required demo commands are restored or replaced, temporary hacks are removed, and user-facing docs/notes match the branch behavior. |
| T11 | Planned | Stabilize and merge experimental branch to `main`. | No, final integration step. | T6-T10. | LingBot and OmniDreams pass agreed smoke/benchmark checks, review feedback is addressed, and the branch can merge as one API transition. |
| T10 | Planned | CLI compatibility, legacy retirement, and migration cleanup. | Yes, after demo migrations start. | T5, T7, T8. | Required demo commands are restored or replaced, old interactive-drive and old OmniDreams demo/server paths are removed or reduced to compatibility shims, code used only by retired demos is removed, and user-facing docs/notes match the branch behavior. |
| T11 | Planned | Stabilize and merge experimental branch to `main`. | No, final integration step. | T5, T7-T10. | OmniDreams passes agreed smoke/benchmark checks, review feedback is addressed, and the branch can merge as one API transition. |

Current OmniDreams migration status:

- The shared `flashdreams.runtime.demo` API and OmniDreams demo adapter exist.
- OmniDreams MP4 replay runs through the shared replay runner and MP4 output
target.
- The one-minute benchmark comparison can run the legacy replay path and the new
shared demo replay path side by side.
- OmniDreams WebRTC runs through `serve_flashdreams_demo(...)` and the shared
WebRTC manager path while still using the existing OmniDreams runtime and
packaged browser app.
- The migration is not complete until the new output target/stat artifact work
lands, the new OmniDreams path is updated to use it, the old interactive-drive
and old OmniDreams demo/server paths are removed or reduced to deliberate
compatibility shims, code used only by retired demos is deleted, and the
experimental demo/runtime/input code is cleaned up.

Suggested parallel split:

Expand All @@ -88,7 +106,8 @@ Suggested parallel split:
stay coherent;
- one person owns T5/T8/T9, because outputs, benchmarks, and metrics are tightly
related;
- LingBot and OmniDreams can be assigned separately once the skeleton is usable;
- LingBot should be tracked as a separate follow-up once OmniDreams has settled
the shared demo API shape;
- one person should track branch health, CLI compatibility, and merge readiness.

## Architecture
Expand Down Expand Up @@ -510,6 +529,11 @@ adapter/runtime still owns deep tensor validation and model semantics.
The standard loop should be shared by CLI generation, headless playback, MP4
generation, benchmarks, and simple realtime applications.

The current v0 production loop is `flashdreams.runtime.run_inference_session()`.
It is intentionally narrow: one adapter, one config, one canonicalizer/source,
one selected mapping, one initial input, one output target, one metrics
recorder, and one synchronous sequential session.

A run should:

1. Discover the model or preset without loading checkpoints.
Expand Down Expand Up @@ -645,9 +669,11 @@ The new API should reuse existing code instead of replacing everything:

The task tracker near the start of this document is the source of truth for the
first implementation branch. The first milestone is intentionally narrower than
the full design: prove the API with LingBot and OmniDreams, selectable output
modes, and enough benchmark/smoke coverage to merge the experimental branch
back to `main` safely.
the full design: prove the API with OmniDreams, add shared output/stat artifact
selection, retire the old OmniDreams demo paths, clean up the experimental
runtime/demo code, and collect enough benchmark/smoke evidence to merge the
experimental branch back to `main` safely. LingBot should be handled in a
separate follow-up plan.

## Design Risks

Expand Down Expand Up @@ -709,7 +735,7 @@ registry, standard loop, concrete output modes, or model migrations:
registering it?
- What package registration mechanism should third-party and internal adapters
use for CLI discovery and benchmarks?
- What is the first public model to migrate?
- Which model should migrate after OmniDreams settles the shared demo API shape?
- What metrics are required for every benchmark run?
- What metadata must be discoverable without loading checkpoints?
- What requirements do Dynamo/Reactor-style backends need before we commit to
Expand Down
13 changes: 8 additions & 5 deletions docs/inference_runtime_inputs_implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Implementation lives in `flashdreams.runtime`:
and compatibility
- `flashdreams/tests/test_runtime_canonical.py`
- `flashdreams/tests/test_runtime_input_mapping.py`
- `flashdreams/tests/test_inference_runtime_api.py` — the T1 envelope tests,
including a reference loop that exercises all three layers
- `flashdreams/tests/test_inference_runtime_api.py` — the T1 envelope tests
- `flashdreams/tests/test_runtime_runner.py` — the production standard loop
tests that exercise all three input layers with runtime/session cleanup

The supported-model input inventory that informed this work is in
`docs/inference_runtime_supported_inputs_inventory.md`.
Expand Down Expand Up @@ -269,8 +270,9 @@ layer:
to `OutputTarget.write()`. Output shape is T5.
- **Declared output modalities**, so an output target or quality-eval can state
what it requires and be matched the way inputs now are. T5/T8.
- **`Application`**, the class that has-a input system, input map, global
conditioning, session, and output target. T4.
- **Full `Application` ownership**, the class that has-a input system, input
map, global conditioning, session, and output target. T4 now provides the
narrow synchronous runner; richer application ownership remains outside T4.
- **Loop ownership** — whether the application or the runtime/session drives the
main event loop, and whether inputs are queued and batched.

Expand All @@ -279,7 +281,8 @@ layer:
```bash
.venv/bin/pytest flashdreams/tests/test_runtime_canonical.py \
flashdreams/tests/test_runtime_input_mapping.py \
flashdreams/tests/test_inference_runtime_api.py -q
flashdreams/tests/test_inference_runtime_api.py \
flashdreams/tests/test_runtime_runner.py -q
.venv/bin/ty check flashdreams/flashdreams/runtime
```

Expand Down
21 changes: 21 additions & 0 deletions docs/source/developer_guides/local_benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,27 @@ input stream is shorter than the requested duration. ``interactive-drive`` is
left out of this shipped MP4 suite for now because its public CLI is a live
presenter rather than a file-writing runner.

Omnidreams Shared Demo Comparison
---------------------------------

``configs/omnidreams_demo_replay_benchmarks.json`` contains a one-minute manual
comparison between the legacy Omnidreams single-view runner and the experimental
shared demo replay path:

.. code-block:: bash

uv run flashdreams-benchmark \
--scenario-file configs/omnidreams_demo_replay_benchmarks.json \
--scenario omnidreams-sv-runner-baseline \
--scenario omnidreams-sv-demo-replay \
--output-dir artifacts/benchmarks/omnidreams-demo-replay-compare

Use the generated report's MP4 links for side-by-side manual review. The legacy
runner writes the stacked HDMap/RGB canvas while the shared demo writes generated
RGB output, so this comparison intentionally disables automatic baseline quality
scoring until those output layouts are aligned. Both scenarios use ``226``
blocks, matching the shipped Omnidreams one-minute baseline.

Quality Hooks
-------------

Expand Down
4 changes: 4 additions & 0 deletions flashdreams/flashdreams/runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
RuntimeMetricSample,
)
from flashdreams.runtime.output import NullOutputTarget, OutputArtifact, OutputTarget
from flashdreams.runtime.runner import run_inference_session
from flashdreams.runtime.types import StepRequest, StepResult
from flashdreams.runtime.video_output import Mp4VideoOutputTarget

__all__ = [
"CanonicalInputs",
Expand Down Expand Up @@ -88,6 +90,7 @@
"MappingCompatibility",
"MetricsRecorder",
"ModelAdapter",
"Mp4VideoOutputTarget",
"NullMetricsRecorder",
"NullOutputTarget",
"OutputArtifact",
Expand All @@ -98,6 +101,7 @@
"StepRequest",
"StepResult",
"TimeWindow",
"run_inference_session",
"undeclared_inference_inputs",
"UserInputCapability",
"UserInputEvent",
Expand Down
31 changes: 31 additions & 0 deletions flashdreams/flashdreams/runtime/demo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Experimental shared demo API above the inference runtime API."""

from flashdreams.runtime.demo.app import run_flashdreams_demo, serve_flashdreams_demo
from flashdreams.runtime.demo.outputs import build_output_target
from flashdreams.runtime.demo.replay import run_replay_demo
from flashdreams.runtime.demo.spec import (
DemoAdapter,
DemoSpec,
Mp4OutputSpec,
NullOutputSpec,
OutputSpec,
PreparedScenario,
WebRTCOutputSpec,
)

__all__ = [
"DemoAdapter",
"DemoSpec",
"Mp4OutputSpec",
"NullOutputSpec",
"OutputSpec",
"PreparedScenario",
"WebRTCOutputSpec",
"build_output_target",
"run_flashdreams_demo",
"run_replay_demo",
"serve_flashdreams_demo",
]
36 changes: 36 additions & 0 deletions flashdreams/flashdreams/runtime/demo/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Experimental shared demo entrypoints."""

from __future__ import annotations

from typing import Any

from .replay import run_replay_demo
from .spec import DemoAdapter, DemoSpec


def run_flashdreams_demo(
*,
spec: DemoSpec,
adapter: DemoAdapter,
**kwargs: Any,
) -> object:
"""Run a synchronous replay demo through the shared runtime runner."""
return run_replay_demo(spec=spec, adapter=adapter, **kwargs)


def serve_flashdreams_demo(
*,
spec: DemoSpec,
adapter: DemoAdapter,
**kwargs: Any,
) -> object:
"""Serve a WebRTC demo through the shared serving manager."""
from .webrtc import serve_webrtc_demo

return serve_webrtc_demo(spec=spec, adapter=adapter, **kwargs)


__all__ = ["run_flashdreams_demo", "serve_flashdreams_demo"]
Loading
Loading