Studio internals

How Studio discovers models, drives pipelines, materializes runs, and keeps UI separate from execution.

On this page

Studio is a catalog-driven shell over the same pipeline and artifact contracts used by CLI inference and evaluation. It does not own model weights, scoring logic, or benchmark manifests. Its job is to discover runnable entries, prepare inputs, invoke the right runtime driver, write a RunRecord, and pick preview assets for the UI. The same execution core serves the world realtime frontend, Workspace jobs, conda child processes, and torchrun workers.

Call graph
Studio execution path
Launch
LaunchCLI flagsvisualization/launch_config.py
parse_launch_config()
FrontendFrontend routingvisualization/launcher.py
discover_catalog()
Runtime
DiscoveryCatalogcatalog/discovery.py
StudioManager()
OrchestrationStudioManagerinference/execution.py
prepare_inputs()
PrepareStaged inputsinference/execution.py
runtime_driver_for()
DispatchDriverinference/execution.py
run()
Output
ExecuteRunRecordinference/execution.py
materialize_run()
PreviewPreview assetsinference/execution.py
Shared inference lives in studio/inference/execution.py; standalone frontends own presentation.

Keep session orchestration in studio/inference/execution.py and catalog discovery in studio/inference/catalog/. Model input semantics and generation state belong to the public pipeline and its operator. studio/visualization/launcher.py routes standalone frontends, and studio/visualization/launch_config.py parses launch options. Page layout, fullscreen, and keyboard controls live in studio/visualization/backends/world.py and assets/web/world.js.

Files

File

  • studio/inference/catalog/

    Discovers model entries from pipeline files, canonical runtime entries, and overrides.

    First file CatalogEntry, discover_catalog(), find_entry().

  • studio/inference/execution.py

    Prepares inputs, loads pipeline classes, chooses runtime driver strategy, writes run records, exports previews.

    First file PreparedInputs, RunRecord, PipelineContext, BaseRuntimeDriver, StudioManager.

  • studio/visualization/launcher.py

    Standalone frontend launch and routing; shared options are parsed by visualization/launch_config.py.

    First file StudioLaunchConfig, parse_launch_config(), main().

  • studio/visualization/backends/world.py

    Realtime page layout, styles, fullscreen controls, and browser script wiring.

    First file Browser controls are implemented by assets/web/world.js.

  • studio/serving/realtime/

    Transport-neutral input resampling, RGB normalization, JPEG encoding, and bounded frame queues.

    First file RealtimeControlResampler, FrameQueuePolicy, LatestFrameBuffer.

  • studio/visualization/backends/world_realtime.py

    Owns the resident model thread and WebRTC/WebSocket session lifecycle.

    First file ResidentWorldRuntime, RealtimePeerManager.

  • core/media/processing/postprocess.py

    Stateful, chainable output processing outside the model's encode/diffuse/decode contract.

    First file VideoPostprocessStream, VideoPostProcessorSession.

  • core/media/processing/rtx.py

    Optional layout-preserving NVIDIA VFX adapter and preflight diagnosis; imports the proprietary runtime only after explicit selection.

    First file RTXVideoSuperResolutionPostProcessor, inspect_rtx_vfx_capability().

  • runtime/realtime_regression.py

    Evaluates canonical chunk-timing JSONL against explicit performance limits.

    First file RealtimeRegressionManifest, evaluate_realtime_manifest().

Catalog discovery

Catalog build is intentionally static. discover_catalog() walks pipeline modules with AST helpers so Studio can list models without importing heavy CUDA stacks or optional dependencies. It merges three sources: pipeline_*.py classes, component-pipeline factories, and action-synthesis classes, then overlays curated overrides and canonical runtime entries (aliases, default kwargs, checkpoints, runtime_kind). Dedup keys are (module_path, class_name). Hidden or abstract ids stay out of the UI list.

Single-model find_entry() uses the same canonical runtime defaults as the full list, including aliases, prompt/reference pairs, checkpoint overrides, and call/load options. It filters canonical entries before resolving checkpoint paths, so direct lookup does not inspect unrelated model checkpoints. Sana and CogVideoX checkpoint variants still resolve to their shared Studio cards; concrete execution uses find_runtime_entry().

The catalog package is layered so lower modules never import higher ones: entry.py (data model), resolve.py (checkpoint, local-path, and interpreter resolution), params.py (parameter templates shared across families), models/<family>.py (curated overrides and model-specific defaults for video generation, world models, 3D scene, embodied, and remote API models), and discovery.py (AST scan, entry building, lookup). Other catalog modules call resolution helpers as resolve.<name>(...), so tests patch catalog.resolve once to affect every caller.

Import happens later, only when a run needs a concrete class: StudioManager.import_pipeline_class() loads module_path / class_name from the selected CatalogEntry. That split is why a model can appear in the catalog yet still fail at LOAD if the current environment lacks its runtime imports or local checkpoint.

  • Find project root (_project_root() / _project_root_candidates()) — Allows Studio to run from repo root or package context.
  • Inspect pipelines (AST helpers around _AstPipelineInfo) — Reads pipeline modules without importing heavy model dependencies.
  • Normalize ids (_normalize_model_id()) — Stable lookup key for UI, CLI launch args, and recent runs.
  • Build entries (discover_catalog()) — Produces CatalogEntry[] with family, class path, category, backend, aliases, examples.

Execution core

StudioManager is the orchestration hub. A typical run / stream / init / reset path prepares a request, stages inputs into a run directory, selects a driver from entry.runtime_kind, loads the pipeline (LRU-cached), invokes the driver, then materializes a RunRecord. Drivers exist because not every family is a single __call__: two-stage 3DGS reconstructs then orbits, and point-cloud nav reconstructs then renders views. WorldFM uses BaseRuntimeDriver; its operator owns camera controls and calibration, and its pipeline owns scene reconstruction and streaming state.

PreparedInputs is the normalized payload after staging prompts, images, videos, interactions, and runtime kwargs. PipelineContext holds the loaded class, device, variant, and output root. RunRecord is the durable unit the UI reloads: ids, inputs, outputs, artifact paths, preview picks, status, and manifest JSON. Workspace inference may also pass an infer_metadata contract so materialization can enforce required output kinds (video, image, splat, and so on).

  • PreparedInputs — Captures staged prompt, images, videos, interactions, runtime kwargs, and metadata.
  • RunRecord — Stores run ID, model ID, inputs, outputs, artifacts, preview paths, status, and manifest export.
  • PipelineContext — Keeps imported pipeline class, model ref, device, variant, load kwargs, and output root.
  • BaseRuntimeDriver — Default driver: load pipeline, run fresh request, optionally initialize/continue streaming, reset state.
  • TwoStage3DGSRuntimeDriver — Specialized driver for two-stage 3DGS flows.
  • PointCloudNavRuntimeDriver — Specialized driver for point-cloud/navigation previews.
  • StudioManager — Orchestrates import, driver selection, input preparation, run execution, recent-run storage, unload/reset.

Pipeline-owned interactive state

A pipeline exposing stream_state_ready() owns its interactive state. The shared driver forwards inputs without seeding its memory with a raw image or replacing its context with generated frames. Optional init_stream(...) prepares that state through the pipeline's input contract without generating a chunk. Pipelines using frame memory without these methods retain the shared image-seeding path. The native visual adapter keeps artifact history, not a reusable rollout state: stream_state_ready() remains false and each stream request retains its explicit conditioning. Stored in-memory keyframes use the same declared layout and pixel range as transport.

Ordinary actions, realtime fallback, and torchrun ranks share BaseRuntimeDriver.initialize_stream() and continue_stream(). Realtime and worker initialization do not materialize previews; rank zero owns distributed artifact export. Native realtime pipelines retain prepare_realtime() / configure_realtime() / stream_realtime(). Both session reset and cached-model reset invoke reset_realtime(), otherwise reset_memory(), otherwise frame-memory reset. Geometry drivers retain reconstruction/render transitions, and stateless/API calls do not acquire streaming state.

WorldFMPipeline.init_stream() reconstructs and records a scene, then stream() reuses it. Failed reconstruction preserves the prior scene; reset clears the instance's scene memory. WorldFMOperator accepts explicit poses or navigation tokens, applies world-coordinate translation and local Rx/Rz rotation, and resolves calibration in the order explicit K, meta-file K, source-image defaults. Studio stages these inputs but does not implement their model mathematics.

The torchrun command bridge owns rank/device mapping, collective ordering, and process teardown. PreparedInputs.explicit_load_params records user override names through worker transport so launch defaults do not masquerade as explicit loader choices. LingBot's replication/FSDP, offload, sequence-parallel defaults, and active process-count policy live in pipelines/lingbot_world/distributed.py. Matrix-Game 3, LongVie 2, Helios, and DreamX retain their own topology and loading contracts.

Regression coverage includes pipeline-owned INIT/STREAM/RESET, failed initialization and retry, A/B/A instance isolation, public-loader delegation, frame-memory seeding, cache leases, and torchrun policy isolation. Weight-free contracts are distinct from accepted-reference checkpoint replay and realtime performance gates.

Preview and artifact helpers

After the driver returns, materialize_run() turns a heterogeneous result into files under the run directory: metadata JSON, known artifact keys, optional frame-to-video export, mesh conversion, and optional Rerun recordings. When previews are still empty, Studio may scan the output directory depending on WORLDFOUNDRY_STUDIO_ARTIFACT_SCAN_MODE. pick_preview_assets() then ranks generated artifacts for the UI and returns the primary video, image, splat/model, gallery, and optional .rrd. Fresh and streaming materialization excludes staged inputs and explicit conditioning paths from preview selection. State-only INIT may display its seed image, but input attachments never satisfy required generated-output kinds. Inputs remain available in their run-owned staging directory.

Blank previews usually mean the pipeline wrote files outside expected keys, returned an in-memory object without save(), or produced a video the decoder rejects. Fix the pipeline contract first; only then widen scan mode or conversion helpers.

  • export_frames_to_video() — Converts frame sequences into a preview video.
  • collect_artifact_paths() — Finds generated files under the output directory.
  • pick_preview_assets() — Chooses primary video/image/model/json assets for UI preview.
  • maybe_extract_video_preview_image() — Saves a representative image from a video preview.
  • convert_model_for_preview() — Converts 3D assets when browser preview needs a different format.
  • maybe_build_rerun_rrd() — Builds a Rerun recording when available.
  • write_json() — Writes run manifests and input/output records.

UI file boundaries

Standalone browser frontends own launch and presentation. Shared inference modules own model loading, normalized inputs, runtime drivers, and artifact contracts; page and transport handlers call StudioManager.

  • Launch parsing — visualization/launch_config.py parses CLI flags and environment defaults into StudioLaunchConfig.
  • Frontend routing — visualization/launcher.py and visualization/backends/frontends.py select world, Viser, Spark, or another frontend from model or artifact metadata.
  • Browser UI — visualization/backends/world.py and assets/web/world.js own layout, fullscreen, keyboard, and joystick controls.
  • Realtime transport — visualization/backends/world_realtime.py owns resident sessions, calls StudioManager.run_realtime(), and transports frames and controls over WebRTC/WebSocket.
  • Shared execution — inference/execution.py owns session orchestration, pipeline cache leases, and driver invocation; pipelines own model execution and state. Realtime interaction transports frames in memory without exporting an MP4 for each control event.

Realtime serving boundaries

The realtime path deliberately separates model state from presentation state:

Call graph
Realtime serving
InputBrowser key edges
resample control edges
ControlRealtimeControlResampler
step resident runtime
ModelResidentWorldRuntime
Extractrealtime_frames_from_result()
session postprocess chain
PostVideoPostprocessStream
encode for transport
TransportResolution / JPEG work
enqueue by policy
Queuelatest-interactive / ordered-quality
WireWebRTC / WebSocket
Models own causal cadence through RealtimeSpec. Transports must not infer latent strides.

Models own causal cadence through RealtimeSpec; transports must not infer latent strides or silently change exact segment counts. latest-interactive may evict stale frames after bounded backpressure to protect control latency. ordered-quality never drops and is mandatory for prompt-scheduled or queued segments whose chunk_done frame count is a playback contract.

RealtimeSpec.advance selects who starts each chunk. The default on_input generates only for held keys, axis samples, STEP, or a prompt update. continuous sessions, such as native Self-Forcing, auto-advance: after each completed chunk the worker starts the next one until max_chunks chunks of the current rollout exist, using ordered-quality so generation stays at most one frame queue ahead of playback. {"type": "pause"} and {"type": "resume"} stop and restart auto-advance and are acknowledged as pause_ack / resume_ack. A new prompt reopens the model rollout and restarts the chunk count. On a finished rollout STEP returns step_ack with ok: false, and other work that would continue it is dropped. In continuous sessions ready, chunk_done, and both acknowledgements carry advance, rollout_chunks, max_chunks, and paused.

Models also declare their input bindings in RealtimeSpec. keys maps each key to an action and a conflict group, where the most recently pressed key in a group wins; the default is W/A/S/D plus I/J/K/L with arrow aliases and stays out of the payload. axes declares continuous inputs from mouse_x/mouse_y or the gamepad sticks, either summed per frame (delta) or held per frame (level), with deadzone, scale, and a per-frame limit. Clients send source-level samples, {"type": "axis", "source": "mouse", "dx", "dy"} or {"type": "axis", "source": "gamepad", "lx", "ly", "rx", "ry"}, and the server maps them to the declared axes and ignores undeclared sources. The client releases inputs by sending neutral samples. RealtimeControlResampler places key edges and axis samples on one chunk timeline, so each chunk passes realtime_segments and, when axes are declared, realtime_axes={name: [per-frame values]} to the model. Over WebRTC the ordered, reliable controls DataChannel owns the session; an axes channel opened with ordered: false, maxRetransmits: 0 only feeds samples into the same input path. The WebSocket fallback accepts the same messages.

Decoded native visual results carry a video_chunk using the existing core VideoChunk: declared layout, pixel value range, and layout-derived frame count. Image outputs use a singleton time axis. Native return_dict=True preserves these semantics for both fresh and streaming calls while raw returns remain tensors or artifact paths. Studio prefers this chunk over untyped aliases and uses core/media/codecs/video.py for conversion; positive-only [-1,1] output is still interpreted as signed pixels. Batched and multi-view layouts require singleton batch/view axes for single-video transport; sensor composition handles multiple views. CUDA byte chunks retain the existing device snapshot/event transport.

Post-processors live after decoded RGB extraction, own isolated per-session state, may buffer a chunk, and flush tails in chain order. The default identity processor runs through the same production boundary without changing output, so future VSR, denoise, or interpolation adapters do not enter model-specific inference loops. The RTX adapter preserves layout/container/dtype/range, owns one VFX effect per stream, clones borrowed DLPack output before reuse, and is gated behind the separately licensed rtx_postprocess extra. Every completed chunk records normalized stage timings; use runtime/realtime_regression.py to gate p50/p90, throughput, queue depth, and drops from those traces.

Debug path

Most Studio bugs originate in catalog, input, runtime, or artifact contract mismatches. A missing model is almost always catalog discovery, aliases, or a hidden id. Wrong device or variant usually means launch config and PipelineContext overrides. Inputs that never reach the model fail in prepare_inputs() or driver kwargs binding. Streaming failures often mean init/stream was called without memory state or without a prior reconstruction for two-stage drivers. Recent-run reload failures mean the manifest or artifact paths drifted after materialize_run().

  • Model missing from UI — discover_catalog() output, CatalogEntry.aliases, category filter, pipeline file naming.
  • Wrong variant/device — StudioLaunchConfig, resolve_cli_variant_id(), PipelineContext.
  • Input not reaching model — prepare_inputs(), PreparedInputs, driver run_fresh() kwargs.
  • Preview blank — collect_artifact_paths(), pick_preview_assets(), conversion helpers, generated file extension.
  • Streaming broken — BaseRuntimeDriver.run_init(), BaseRuntimeDriver.run_continue(), pipeline stream(), memory state.
  • Recent run cannot reload — RunRecord.to_manifest(), materialize_run(), load_run(), artifact paths.

For end-user launch and frontend routing, see Studio. For how Studio as a surface compiles user intent into the same requests as CLI and MCP, see Surfaces and orchestration. For the pipeline / operator / GenerationResult contract Studio sits on, see Model runtime.