Replace the re-export stubs with real vendored copies of the fastvideo modeling
+ layer + supporting infra, for the kept diffusion models (wan21, wan_causal,
ltx2, flux2, matrixgame2). v2 now imports ZERO `fastvideo.*` — it is
self-contained. (bagel/qwen_omni load from vllm_omni, an external pkg, not
fastvideo; cosmos3's load_id was already dangling — both out of scope here.)
Vendored (cp + `sed fastvideo. -> v2.`):
- models/ the 5 models' nn.Module dits/vaes/encoders/audio/upsamplers + the
component loader/ + the lazy class registry (other families' rows are
dormant/lazy — only the 5 resolve).
- layers/ attention/ platforms/ distributed/ configs/ logging_utils/ hooks/
third_party/pynvml + top-level forward_context/fastvideo_args/envs/logger/
utils/version — copied verbatim (layers et al. 'as is').
- api/ slimmed to schema + results (the VideoGenerator's config dataclasses);
the fastvideo parser/presets/overrides (which pull the pipeline runtime) are
intentionally NOT vendored — v2 has its own runtime/loop.
Decoupling surgery (cut the loader's coupling to the fastvideo runtime):
- configs/pipeline_registry.py (vendored from fastvideo/registry.py, renamed to
avoid colliding with v2/registry.py): dropped the _register_presets() auto-call
and matrixgame3 (removed model); config-class resolution preserved.
- configs/pipelines/__init__.py: dropped the registry back-edge (fixes an import
cycle) — base.py imports the registry lazily where used.
- torch_backend: load_component now uses v2.models.loader.
The only remaining external 'fastvideo*' refs are `fastvideo_kernel` (the
separate optional CUDA-kernel pkg for sparse/MoBA attention) — guarded; the dense
TORCH_SDPA path v2 uses never imports it.
Vendored subtrees added to the pre-commit exclude (faithful copies, mirroring the
existing fastvideo/models exclusion — not re-linted, to stay re-syncable).
Verified: grep finds zero fastvideo-package imports in v2/; Wan2.1 T2V on H100 is
BIT-IDENTICAL to the fastvideo-backed path (same .npy SHA256, byte-for-byte); CPU
mini 156 (154 passed + 2 env-skipped on x86, torch present). Backup: branch v2_backup.
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
from v2.distributed.communication_op import *
|
|
from v2.distributed.parallel_state import (
|
|
cleanup_dist_env_and_memory, get_dp_group, get_dp_rank, get_dp_world_size, get_local_torch_device, get_sp_group,
|
|
get_sp_parallel_rank, get_sp_world_size, get_tp_group, get_tp_rank, get_tp_world_size, get_world_group,
|
|
get_world_rank, get_world_size, init_distributed_environment, initialize_model_parallel,
|
|
maybe_init_distributed_environment_and_model_parallel, model_parallel_is_initialized)
|
|
from v2.distributed.utils import *
|
|
|
|
__all__ = [
|
|
# Initialization
|
|
"init_distributed_environment",
|
|
"initialize_model_parallel",
|
|
"cleanup_dist_env_and_memory",
|
|
"model_parallel_is_initialized",
|
|
"maybe_init_distributed_environment_and_model_parallel",
|
|
"warmup_sequence_parallel_communication",
|
|
|
|
# World group
|
|
"get_world_group",
|
|
"get_world_rank",
|
|
"get_world_size",
|
|
|
|
# Data parallel group
|
|
"get_dp_group",
|
|
"get_dp_rank",
|
|
"get_dp_world_size",
|
|
|
|
# Sequence parallel group
|
|
"get_sp_group",
|
|
"get_sp_parallel_rank",
|
|
"get_sp_world_size",
|
|
|
|
# Tensor parallel group
|
|
"get_tp_group",
|
|
"get_tp_rank",
|
|
"get_tp_world_size",
|
|
|
|
# Get torch device
|
|
"get_local_torch_device",
|
|
]
|