[refactor] rename package mini_fastvideo → v2

Directory rename (git mv, history preserved) plus rewrite of all references: absolute imports in
tests, the zero-dep runner, docstrings, comments, and the README. No behavior change.

Run: python3 -m pytest v2/tests/ -q ; python3 v2/run_tests.py ; python3 -m v2.examples
This commit is contained in:
SolitaryThinker
2026-06-18 09:41:12 +00:00
parent 71caa58ba9
commit 145082cf74
112 changed files with 96 additions and 96 deletions
+8 -8
View File
@@ -1,4 +1,4 @@
# mini-fastvideo
# v2
A scoped, **CPU-testable** realization of the `design_v3.md` model-native runtime — the architecture
where *omni is native, train and serve are the same loops by construction, and correctness is a typed
@@ -76,9 +76,9 @@ engine never imports `training`. `card/` imports no runtime.
```bash
cd /Users/willlin/src/FastVideo-mini
python3 -m pytest mini_fastvideo/tests/ -q # 49 tests
python3 mini_fastvideo/run_tests.py # same suite, ZERO deps (no pytest needed)
python3 -m mini_fastvideo.examples # the design_v3 §15 worked examples
python3 -m pytest v2/tests/ -q # 49 tests
python3 v2/run_tests.py # same suite, ZERO deps (no pytest needed)
python3 -m v2.examples # the design_v3 §15 worked examples
```
Requires only Python 3.10+ and numpy.
@@ -111,7 +111,7 @@ DAG-of-engines can express, made native:
The diffusion loop is literally `WanDenoiseLoop` (the same step body the engine serves for Wan), bound
to the MoT module — one loop definition, reused. The interleave gate generalizes across loop types
(`test_omni.py::test_omni_interleave_parity_holds_across_loop_types`). Run it:
`python3 -c "from mini_fastvideo.models import build_omni_engine; ..."` or see `mini_fastvideo/examples.py`.
`python3 -c "from v2.models import build_omni_engine; ..."` or see `v2/examples.py`.
Still future work (declared on the spine, not yet built): the packed factored-sequence
(`[text|vision|action|sound]`) `LoopState.extension`, joint multi-modality denoise with per-modality
@@ -144,9 +144,9 @@ The serving layer is built, not deferred to Dynamo:
```python
import asyncio
from mini_fastvideo.models import build_default_engine, build_omni_engine
from mini_fastvideo.runtime import AsyncEngine
from mini_fastvideo.serving import OmniOpenAIServer
from v2.models import build_default_engine, build_omni_engine
from v2.runtime import AsyncEngine
from v2.serving import OmniOpenAIServer
async def serve():
eng = build_default_engine(); build_omni_engine(eng)
host, port = await OmniOpenAIServer(AsyncEngine(eng)).serve(port=8000)
@@ -1,4 +1,4 @@
"""mini-fastvideo — a scoped, CPU-testable realization of the design_v3 model-native runtime.
"""v2 — a scoped, CPU-testable realization of the design_v3 model-native runtime.
> A model card is a (recipe, runtime) pair with a parity obligation.
> The model owns loop semantics; the runtime owns loop lifecycle.
@@ -12,7 +12,7 @@ omni-ready (multi-loop ModelInstance, ar_decode/chunk_rollout loop kinds) for th
Cosmos3 + vllm-omni omni ports.
The core is numpy-only and CPU-testable; heavy Wan/LTX neural forwards become lazy torch
adapters (see ``mini_fastvideo/models/*/components.py``) that are off the test path.
adapters (see ``v2/models/*/components.py``) that are off the test path.
"""
from __future__ import annotations
+2 -2
View File
@@ -1,10 +1,10 @@
"""Shared lightweight type aliases for mini-fastvideo.
"""Shared lightweight type aliases for v2.
The core (card/loop/runtime/cache/parity/program/request/training) is numpy-only
and CPU-testable. Tensors are therefore typed structurally as ``TensorLike``:
on the CPU test path they are ``numpy.ndarray``; on a GPU box the same code runs
with ``torch.Tensor``. The core never imports torch — only model-component
*adapters* do, lazily (see ``mini_fastvideo/card/components.py``).
*adapters* do, lazily (see ``v2/card/components.py``).
"""
from __future__ import annotations
View File
@@ -143,7 +143,7 @@ class ComponentSpec:
resident_for: list[str] = field(default_factory=list) # loop_ids that keep this resident mid-request
optional_for: set[str] = field(default_factory=set) # tasks that don't need it
required_for: set[str] = field(default_factory=set) # tasks that require it
# mini-fastvideo wiring: a factory producing the live component (toy numpy or torch adapter)
# v2 wiring: a factory producing the live component (toy numpy or torch adapter)
factory: Callable[..., Any] | None = None
@@ -170,7 +170,7 @@ class LoopSpec:
# omni-ready (omni-readiness report §4a):
shared_weight_components: list[str] = field(default_factory=list)
allows_interleaving: bool = True
# mini-fastvideo: the Loop implementation factory (built at bind time)
# v2: the Loop implementation factory (built at bind time)
loop_factory: Callable[..., Any] | None = None
@@ -1,6 +1,6 @@
"""Worked examples (design_v3 §15), runnable as a demo:
python3 -m mini_fastvideo.examples
python3 -m v2.examples
Each prints what it demonstrates. This doubles as living documentation of the API.
"""
@@ -136,7 +136,7 @@ def example_h_serving_and_fleet() -> None:
def main() -> None:
print("=" * 78)
print("mini-fastvideo — worked examples (design_v3 §6,§13-16). One runtime, many loops.")
print("v2 — worked examples (design_v3 §6,§13-16). One runtime, many loops.")
print("=" * 78)
eng = build_default_engine()
print(f"registered (recipe, runtime) cards: {list(eng._registry)}")
@@ -6,7 +6,7 @@ logs, finals." Event taxonomy: ``request.*``, ``session.*``, ``artifact.*``,
stream, byte-range/buffer-ref, codec/container, timestamp range, and
preview-vs-final — invalid combinations are unrepresentable.
For mini-fastvideo the Stream is a simple synchronous ordered channel (the core is
For v2 the Stream is a simple synchronous ordered channel (the core is
numpy/sync and CPU-testable); a GPU/server deployment swaps in an async channel
without changing the event types.
"""
@@ -1,13 +1,13 @@
#!/usr/bin/env python3
"""Zero-dependency test runner for mini-fastvideo.
"""Zero-dependency test runner for v2.
The mini-fastvideo core is numpy-only and CPU-testable. This runner discovers
``test_*`` functions in ``mini_fastvideo/tests/test_*.py`` and runs them without
The v2 core is numpy-only and CPU-testable. This runner discovers
``test_*`` functions in ``v2/tests/test_*.py`` and runs them without
needing pytest installed (it is fully pytest-compatible, so ``pytest`` works too).
Usage:
python3 mini_fastvideo/run_tests.py # run all
python3 mini_fastvideo/run_tests.py interleave # run files matching a substring
python3 v2/run_tests.py # run all
python3 v2/run_tests.py interleave # run files matching a substring
"""
from __future__ import annotations
@@ -18,7 +18,7 @@ from pathlib import Path
HERE = Path(__file__).resolve().parent
TESTS_DIR = HERE / "tests"
REPO_ROOT = HERE.parent # so `import mini_fastvideo` works
REPO_ROOT = HERE.parent # so `import v2` works
def _load(path: Path):
@@ -61,7 +61,7 @@ def _ser_artifacts(out: Output) -> dict:
class OmniOpenAIServer:
def __init__(self, engine: Any, *, engine_id: str = "mini-fastvideo", max_jobs: int = 512):
def __init__(self, engine: Any, *, engine_id: str = "v2", max_jobs: int = 512):
self.engine = engine # an AsyncEngine
self.engine_id = engine_id
self.jobs: dict[str, dict] = {} # video job store
@@ -7,12 +7,12 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo.memory import MemoryManager, OutOfMemory
from mini_fastvideo.models import build_default_engine
from mini_fastvideo.models.wan21.loop import latent_shape
from mini_fastvideo.parity import compare_outputs
from mini_fastvideo.request import DiffusionParams, TaskType, make_request
from mini_fastvideo.runtime import AdmissionController, Engine
from v2.memory import MemoryManager, OutOfMemory
from v2.models import build_default_engine
from v2.models.wan21.loop import latent_shape
from v2.parity import compare_outputs
from v2.request import DiffusionParams, TaskType, make_request
from v2.runtime import AdmissionController, Engine
def test_memory_manager_reserve_release_and_oom():
@@ -3,9 +3,9 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo.cache import CacheKey, CacheManager, CachePolicy
from mini_fastvideo.cache.classes import FeatureCache, Slab, SlabKVCache
from mini_fastvideo.models.wan_causal import build_wan_causal_card
from v2.cache import CacheKey, CacheManager, CachePolicy
from v2.cache.classes import FeatureCache, Slab, SlabKVCache
from v2.models.wan_causal import build_wan_causal_card
def test_feature_cache_reuse_and_adapter_partition():
@@ -55,6 +55,6 @@ def test_cache_manager_materializes_only_declared_classes():
cm = CacheManager.from_card(build_wan_causal_card())
assert cm.has("feature") and cm.has("slab_kv")
# a pure bidirectional card declares no KV class
from mini_fastvideo.models.wan21 import build_wan21_card
from v2.models.wan21 import build_wan21_card
cm2 = CacheManager.from_card(build_wan21_card())
assert cm2.has("feature") and not cm2.has("slab_kv") # KV is the minority case
@@ -3,18 +3,18 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo._enums import ConsistencyLevel, LoopKind, WorkUnitKind
from mini_fastvideo.card import (
from v2._enums import ConsistencyLevel, LoopKind, WorkUnitKind
from v2.card import (
CardValidationError,
CostModel,
LoopSpec,
ModelCard,
RecipeSpec,
)
from mini_fastvideo.cache.keys import CacheKey, content_hash
from mini_fastvideo.models.wan21 import build_wan21_card
from mini_fastvideo.models.wan_causal import build_wan_causal_card
from mini_fastvideo.parallel import ParallelPlan, ParallelValidationError, validate_plan
from v2.cache.keys import CacheKey, content_hash
from v2.models.wan21 import build_wan21_card
from v2.models.wan_causal import build_wan_causal_card
from v2.parallel import ParallelPlan, ParallelValidationError, validate_plan
def test_wan_card_validates():
@@ -4,19 +4,19 @@ interleave-safe; a module-global version provably is NOT — which is *why* §11
"""
from __future__ import annotations
from mini_fastvideo._enums import WorkUnitKind
from mini_fastvideo.card import CostModel
from mini_fastvideo.extend import (
from v2._enums import WorkUnitKind
from v2.card import CostModel
from v2.extend import (
InterceptorChain,
InterceptorConflict,
NaNWatch,
Profiler,
ResidualSkipInterceptor,
)
from mini_fastvideo.models import build_default_engine
from mini_fastvideo.parity import assert_interleave_parity
from mini_fastvideo.request import DiffusionParams, TaskType, make_request
from mini_fastvideo.runtime import Engine
from v2.models import build_default_engine
from v2.parity import assert_interleave_parity
from v2.request import DiffusionParams, TaskType, make_request
from v2.runtime import Engine
def _req(prompt, seed):
@@ -3,11 +3,11 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo.models import build_default_engine
from mini_fastvideo.models.ltx2 import BASE_SIGMAS, REFINE_SIGMAS, build_ltx2_card
from mini_fastvideo.models.wan21 import build_wan21_card
from mini_fastvideo.models.wan_causal import build_wan_causal_card
from mini_fastvideo.request import DiffusionParams, OutputSpec, TaskType, make_request
from v2.models import build_default_engine
from v2.models.ltx2 import BASE_SIGMAS, REFINE_SIGMAS, build_ltx2_card
from v2.models.wan21 import build_wan21_card
from v2.models.wan_causal import build_wan_causal_card
from v2.request import DiffusionParams, OutputSpec, TaskType, make_request
def _eng():
@@ -6,9 +6,9 @@ this gate is not.
"""
from __future__ import annotations
from mini_fastvideo.models import build_default_engine
from mini_fastvideo.parity import assert_interleave_parity
from mini_fastvideo.request import DiffusionParams, TaskType, make_request
from v2.models import build_default_engine
from v2.parity import assert_interleave_parity
from v2.request import DiffusionParams, TaskType, make_request
def _req(mid, prompt, seed, steps=4):
@@ -8,11 +8,11 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo._enums import WorkUnitKind
from mini_fastvideo.models import build_omni_engine
from mini_fastvideo.models.cosmos3 import build_cosmos3_card
from mini_fastvideo.parity import assert_interleave_parity
from mini_fastvideo.request import DiffusionParams, SamplingParams, TaskType, make_request
from v2._enums import WorkUnitKind
from v2.models import build_omni_engine
from v2.models.cosmos3 import build_cosmos3_card
from v2.parity import assert_interleave_parity
from v2.request import DiffusionParams, SamplingParams, TaskType, make_request
def _eng():
@@ -3,7 +3,7 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo.parity import ConsistencyLevel, ParityAligner, array_diff, bit_identical, within
from v2.parity import ConsistencyLevel, ParityAligner, array_diff, bit_identical, within
def test_aligner_no_divergence_on_identical_runs():
@@ -3,8 +3,8 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo.loop.contracts import StepContext
from mini_fastvideo.loop.policies import (
from v2.loop.contracts import StepContext
from v2.loop.policies import (
AdaptiveGateCFG,
BoundaryTimestepRouting,
ClassicCFG,
@@ -9,17 +9,17 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo._enums import WorkUnitKind
from mini_fastvideo.cache import CacheManager
from mini_fastvideo.card import load_card
from mini_fastvideo.loop.contracts import ResourceRequest, ShapeSignature, WorkPlan
from mini_fastvideo.memory import MemoryManager
from mini_fastvideo.models import build_default_engine
from mini_fastvideo.models.common import cached_text_encode
from mini_fastvideo.models.wan21 import build_wan21_card
from mini_fastvideo.parity import compare_outputs
from mini_fastvideo.request import DiffusionParams, Output, TaskType, VideoArtifact, make_request
from mini_fastvideo.runtime import AdmissionController, AdmissionInfeasible, Engine
from v2._enums import WorkUnitKind
from v2.cache import CacheManager
from v2.card import load_card
from v2.loop.contracts import ResourceRequest, ShapeSignature, WorkPlan
from v2.memory import MemoryManager
from v2.models import build_default_engine
from v2.models.common import cached_text_encode
from v2.models.wan21 import build_wan21_card
from v2.parity import compare_outputs
from v2.request import DiffusionParams, Output, TaskType, VideoArtifact, make_request
from v2.runtime import AdmissionController, AdmissionInfeasible, Engine
def test_infeasible_reservation_fails_fast_not_busy_spin():
@@ -10,21 +10,21 @@ import asyncio
import numpy as np
from mini_fastvideo._enums import WorkUnitKind
from mini_fastvideo.card import CostModel
from mini_fastvideo.deploy import (
from v2._enums import WorkUnitKind
from v2.card import CostModel
from v2.deploy import (
DynamoWorkerAdapter,
FakeDynamoRuntime,
LocalFleet,
NoWorkerAvailable,
build_deployment_card,
)
from mini_fastvideo.extend import InterceptorChain, ObserverBus
from mini_fastvideo.models import build_default_engine, build_omni_engine, build_wan21_card, build_wan_t2v_program
from mini_fastvideo.request import DiffusionParams, OutputSpec, SamplingParams, TaskType, make_request
from mini_fastvideo.runtime import AsyncEngine, DisaggregatedRunner, Engine, PoolSet, wan_t2v_disaggregated
from mini_fastvideo.serving import OmniOpenAIServer
from mini_fastvideo.transport import (
from v2.extend import InterceptorChain, ObserverBus
from v2.models import build_default_engine, build_omni_engine, build_wan21_card, build_wan_t2v_program
from v2.request import DiffusionParams, OutputSpec, SamplingParams, TaskType, make_request
from v2.runtime import AsyncEngine, DisaggregatedRunner, Engine, PoolSet, wan_t2v_disaggregated
from v2.serving import OmniOpenAIServer
from v2.transport import (
InProcConnector,
InProcKVConnector,
ShmFakeConnector,
@@ -137,7 +137,7 @@ def _req(seed=1):
def test_fleet_least_loaded_routes_around_busy_worker():
from mini_fastvideo.runtime import RequestState
from v2.runtime import RequestState
A, B, cardA, cardB = _two_workers()
fleet = LocalFleet("least_loaded")
fleet.register("A", A, cardA); fleet.register("B", B, cardB)
@@ -3,12 +3,12 @@ from __future__ import annotations
import asyncio
from mini_fastvideo.card import CostModel
from mini_fastvideo.deploy import build_deployment_card
from mini_fastvideo.models import build_default_engine, build_wan21_card, build_wan_t2v_program
from mini_fastvideo.request import Cancelled, DiffusionParams, OutputSpec, TaskType, make_request
from mini_fastvideo.runtime import AsyncEngine, PoolSet, wan_t2v_disaggregated
from mini_fastvideo.transport import InProcConnector
from v2.card import CostModel
from v2.deploy import build_deployment_card
from v2.models import build_default_engine, build_wan21_card, build_wan_t2v_program
from v2.request import Cancelled, DiffusionParams, OutputSpec, TaskType, make_request
from v2.runtime import AsyncEngine, PoolSet, wan_t2v_disaggregated
from v2.transport import InProcConnector
def _disagg_engine():
@@ -101,8 +101,8 @@ def test_offline_runner_honors_cancellation():
def test_http_rejects_oversized_and_malformed_requests():
from mini_fastvideo.runtime import AsyncEngine as AE
from mini_fastvideo.serving import OmniOpenAIServer
from v2.runtime import AsyncEngine as AE
from v2.serving import OmniOpenAIServer
async def status_of(host, port, raw: bytes) -> int:
r, w = await asyncio.open_connection(host, port)
@@ -7,10 +7,10 @@ from __future__ import annotations
import numpy as np
from mini_fastvideo._enums import ConsistencyLevel
from mini_fastvideo.models.wan21 import build_wan21_card
from mini_fastvideo.models.wan_causal import build_wan_causal_card
from mini_fastvideo.training import (
from v2._enums import ConsistencyLevel
from v2.models.wan21 import build_wan21_card
from v2.models.wan_causal import build_wan_causal_card
from v2.training import (
WeightRole,
build_diffusion_nft,
build_dmd2,

Some files were not shown because too many files have changed in this diff Show More