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
1 change: 1 addition & 0 deletions apps/dreamverse/dreamverse/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def _optional_env(*names: str) -> str | None:
DEVTOOLS_ENABLED = _env_bool("FASTVIDEO_ENABLE_DEVTOOLS", False)
PROMPT_SAFETY_ENABLED = _env_bool("FASTVIDEO_ENABLE_PROMPT_SAFETY", False)
DREAMVERSE_MAX_AUTOTUNE = _env_bool("DREAMVERSE_MAX_AUTOTUNE", True)
DREAMVERSE_SP_SIZE = max(1, _env_int("DREAMVERSE_SP_SIZE", 1))

DREAMVERSE_MODEL_PATH = (os.getenv("DREAMVERSE_MODEL_PATH", "").strip() or None)
if DREAMVERSE_MODEL_PATH:
Expand Down
13 changes: 11 additions & 2 deletions apps/dreamverse/dreamverse/gpu_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from dreamverse.config import (
DEFAULT_MODEL_ID,
DREAMVERSE_SP_SIZE,
MODEL_REGISTRY,
STARTUP_WARMUP_ENABLED,
STARTUP_WARMUP_PROMPT,
Expand Down Expand Up @@ -845,8 +846,16 @@ class GPUPool:
"""Manages multiple GPU worker subprocesses."""

def __init__(self, gpu_ids: list[int]):
self.gpu_ids = gpu_ids
self.slots: dict[int, GPUSlot] = {gpu_id: GPUSlot(gpu_id, str(gpu_id)) for gpu_id in gpu_ids}
sp_size = DREAMVERSE_SP_SIZE
groups = [gpu_ids[i:i + sp_size] for i in range(0, len(gpu_ids), sp_size)]
groups = [g for g in groups if len(g) == sp_size]
Comment on lines +849 to +851

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When DREAMVERSE_SP_SIZE is greater than 1, any available GPUs that do not fit evenly into sequence-parallel groups of size sp_size are silently dropped. It would be highly beneficial to log a warning message to inform the operator that some GPUs will remain idle due to the grouping configuration.

        sp_size = DREAMVERSE_SP_SIZE
        groups = [gpu_ids[i:i + sp_size] for i in range(0, len(gpu_ids), sp_size)]
        unused_count = len(gpu_ids) % sp_size
        if unused_count > 0:
            print(f"[WARNING] {unused_count} GPU(s) will be unused because they cannot be grouped into sequence-parallel slots of size {sp_size}.")
        groups = [g for g in groups if len(g) == sp_size]

if not groups:
raise RuntimeError(f"Not enough GPUs for DREAMVERSE_SP_SIZE={sp_size}: available={gpu_ids}")
if sp_size > 1:
print(f"[INFO] Sequence-parallel slots (sp_size={sp_size}): " + ", ".join("{" + ",".join(map(str, g)) + "}"
for g in groups))
self.gpu_ids = [g[0] for g in groups]
self.slots: dict[int, GPUSlot] = {g[0]: GPUSlot(g[0], ",".join(str(x) for x in g)) for g in groups}
self.waiting_list: list[tuple[str, asyncio.Event, WebSocket]] = []
self.client_gpu_map: dict[str, int] = {}
self._pool_lock = asyncio.Lock()
Expand Down
3 changes: 2 additions & 1 deletion apps/dreamverse/dreamverse/video_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
NUM_FRAMES,
NUM_INFERENCE_STEPS,
DREAMVERSE_MAX_AUTOTUNE,
DREAMVERSE_SP_SIZE,
DREAMVERSE_LORA_PATH,
DREAMVERSE_LORA_NICKNAME,
DREAMVERSE_LORA_STRENGTH,
Expand Down Expand Up @@ -289,7 +290,7 @@ def initialize(self, model_config: dict | None = None) -> None:
generator_config = GeneratorConfig(
model_path=model_root,
engine=EngineConfig(
num_gpus=1,
num_gpus=DREAMVERSE_SP_SIZE,
offload=OffloadConfig(
dit=False,
dit_layerwise=False,
Expand Down
1 change: 0 additions & 1 deletion fastvideo/models/dits/ltx2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ def __init__(
)
self.rope_type = rope_type

@torch.compiler.disable
def forward(
self,
q: torch.Tensor,
Expand Down
Loading