The v2 top level had grown to ~27 dirs + 13 loose files — half of them
single-concept abstraction shells (memory/ 86 LOC, transport/ 222, parity/ 178,
extend/ 226) and half vendored fastvideo code sitting as peers to the actual v2
design. Regroup to mirror README section 3 "Planes & dependency order":
core/ enums+types, card, loop, program, parity, request, parallel
(the model-native contracts; no kernels)
runtime/ + folded-in substrate: cache, memory, transport, extend
(the import graph shows only runtime consumes them; compile/cudagraph
already lived here)
serving/ + deploy/ (products / fleet)
_vendor/ all copied fastvideo: models, layers, attention, configs, distributed,
platforms, api, hooks, logging_utils, third_party + fastvideo_args/
utils/logger/envs/forward_context — internal layout unchanged, still
mirrors upstream for diffing
28 dirs + 13 root files -> 8 dirs + 6 root files. Pure mechanical move: 947
absolute-import paths rewritten (v2.X -> v2.{core,runtime,serving,_vendor}.X),
boundary-anchored so platform/ (native dispatch) and platforms/ (vendored CUDA
detect) no longer collide and neither does hooks/ vs extend/. Deleted the empty
v2/loader/. README section 3 + 16 updated; stale test count corrected
(34 files/216 tests -> 22 files/143 tests).
Validated: `import v2` stays torch-free; `v2/run_tests.py` and `pytest v2/tests/`
-> 143 passed, 2 skipped on the numpy toy backend. (On a GPU box force the toy
backend with CUDA_VISIBLE_DEVICES="" or detect() picks cuda.) No external importer
changed — examples use the re-exported `from v2 import VideoGenerator`.
v2_examples/inference — Wan2.1-1.3B
Runnable, self-contained inference examples for the Wan2.1-1.3B (recipe, runtime) card on the
v2 runtime. CPU + numpy only — the architecture (cards, driven loops, scheduler, caches, parity) is
real; the neural forwards are numpy toys (see ../../v2/README.md and
../../designv4.md). On a GPU box you swap ComponentSpec.factory for the torch
Wan adapter and none of these scripts change.
Each script bootstraps the repo onto sys.path, so run it from anywhere:
python3 v2_examples/inference/01_basic_t2v.py
| Script | What it shows |
|---|---|
01_basic_t2v.py |
the minimal path: build engine → typed T2V request → run → read the video artifact |
02_params_and_reproducibility.py |
DiffusionParams knobs (steps / CFG guidance / resolution) + seeded bit-identical reproducibility |
03_streaming.py |
per-denoise-step preview chunks via OutputSpec(stream=...) (off by default) |
04_concurrent_interleaved.py |
step-interleaved batching, the interleave parity gate (serial == interleaved), shared-prompt feature-cache reuse |
05_async_serving.py |
AsyncEngine: concurrent generate, live event streaming, step-boundary cancellation |
All five use only the public API (v2.models.build_default_engine, v2.request.make_request,
v2.runtime.AsyncEngine). For the OpenAI HTTP server, disaggregated pools, and the fleet/Dynamo path,
see python3 -m v2.examples (example h).