基于vllm-ascend 0.28.0版本适配优化 背景目标:xx客户音视频生成业务要求,模型蒸馏8步后720*1280 15s视频E2E推理时长控制在60s以内
docker pull quay.io/ascend/vllm-omni:v0.28.0
原始权重:https://www.modelscope.cn/models/MiniMax/MiniMax-H3
LoRA权重:https://github.com/ModelTC/Minimax-H3-Turbo
A2:使用lightx2v蒸馏权重,8步推理15s 768*1024视频
| 优化项 | 数据 |
|---|---|
| LA默认基线拉起 | 86s |
| 叠加int8量化 | 83s |
| 叠加消除offload_to_cpu | 78s |
| 叠加稀疏FA V2 | 66s |
| 叠加稀疏FA V3 | 64s |
| 开启cache dit(8步效果很差) | 60s |
| 开启cache dit(9步) | 70s |
A2:使用lightx2v蒸馏权重,9步推理15s 704*1280视频
| 优化项 | 数据 |
|---|---|
| int8量化+稀疏FA V3+消除offload_to_cpu | 87s |
| 叠加RMSNorm优化+host侧tensor缓存 | 84s |
| 叠加轻量化VAE(精度有损较多) | 76s |
A2(vllm-omni:0.30.0):使用lightx2v蒸馏权重,8步推理15s 704*1280视频(V3、host侧tensor缓存不适用)
| 优化项 | 数据 |
|---|---|
| int8量化+稀疏FA V2 | 91.5s |
| 叠加kv_offload | 87s |
| 叠加消除offload_to_cpu | 84s |
| 叠加res@6 (精度有损较多) | 78s |
| 不带res@6,叠加conv1d优化 | 81s |
export PORT=9098
export VLLM_WORKER_MULTIPROC_METHOD=spawn
export VLLM_OMNI_VIDEO_SYNC_TIMEOUT=1800
export PYTHONDONTWRITEBYTECODE=1
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export MINDIE_SD_FA_TYPE="ascend_laser_attention"
export HCCL_NPU_SOCKET_PORT_RANGE="auto"
export HF_TRUST_REMOTE_CODE=0
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
MODEL_ROOT="/root/work/filestorage/gh/ckpts/MiniMax/MiniMax-H3/"
export MODEL="${MODEL_ROOT}/FL2VA"
vllm serve "${MODEL}" \
--omni \
--host 0.0.0.0 \
--port "${PORT}" \
--num-gpus 8 \
--usp 8 \
--ring 1 \
--text-encoder-tp-size 8 \
--quantization int8 \
--enable-distributed-layerwise-offload \
--vae-parallel-mode tile \
--vae-use-tiling \
--vae-patch-parallel-size 8 \
--enable-diffusion-pipeline-profiler \
--diffusion-attention-config '{"default": {"backend": "RAINFUSION_ATTN",
"block_sparse": {"sparsity": 0.8, "start_step": 3}}}'diff --git a/vllm_omni/diffusion/models/minimax_h3/encoder.py b/vllm_omni/diffusion/models/minimax_h3/encoder.py
index a91cb180..ff401ca9 100644
--- a/vllm_omni/diffusion/models/minimax_h3/encoder.py
+++ b/vllm_omni/diffusion/models/minimax_h3/encoder.py
@@ -1130,6 +1130,7 @@ class MiniMaxH3Qwen3VLEncoder(nn.Module):
quant_config=quant_config,
)
self.text_model.to(dtype=dtype)
+ self._keep_resident = False
logger.info(
"MiniMax H3 Qwen3-VL encoder: %d retained decoder layers, text_encoder_tp_size=%d, vision replicated",
MINIMAX_H3_QWEN3VL_SELECTED_LM_LAYER,
@@ -1217,6 +1218,8 @@ class MiniMaxH3Qwen3VLEncoder(nn.Module):
return loaded
def load_to_device(self) -> None:
+ if self._keep_resident:
+ return
if not self.is_loaded:
return
if getattr(self, "_omni_layerwise_enabled", False):
@@ -1232,13 +1235,17 @@ class MiniMaxH3Qwen3VLEncoder(nn.Module):
)
self._omni_non_block_stager = stager
stager.load()
+ self._keep_resident = True
return
self.vision.to(self.device_target)
self.text_model.to(self.device_target)
+ self._keep_resident = True
def offload_to_cpu(self) -> None:
if not self.is_loaded:
return
+ if self._keep_resident:
+ return
if getattr(self, "_omni_layerwise_enabled", False):
for hook in self._omni_layerwise_hooks:
hook.offload_layer()
diff --git a/vllm_omni/diffusion/models/minimax_h3/vae.py b/vllm_omni/diffusion/models/minimax_h3/vae.py
index 2e830fa0..a9df460c 100644
--- a/vllm_omni/diffusion/models/minimax_h3/vae.py
+++ b/vllm_omni/diffusion/models/minimax_h3/vae.py
@@ -153,12 +153,16 @@ class MiniMaxH3VideoVAE(nn.Module, DistributedVaeMixin):
self.use_slicing = False
self.parallel_size = 1
self.device_module = torch.get_device_module()
+ self._keep_resident = False
def load_to_device(self) -> None:
+ if self._keep_resident:
+ return
if self._stager is not None:
self._stager.load()
else:
self.remote.to(self._device_target)
+ self._keep_resident = True
def set_omni_component_cache(self, cache: BoundedAllocatorCache | None) -> None:
self._omni_component_cache = cache
@@ -166,6 +170,8 @@ class MiniMaxH3VideoVAE(nn.Module, DistributedVaeMixin):
self._stager.set_cache_retention(cache)
def offload_to_cpu(self) -> None:
+ if self._keep_resident:
+ return
if self._stager is not None:
self._stager.offload()
else:
@@ -425,12 +431,16 @@ class MiniMaxH3AudioVAE(nn.Module):
)
self.model = self.remote.model
self.sample_rate = int(self.config_dict["sample_rate"])
def load_to_device(self) -> None:
+ if self._keep_resident:
+ return
if self._stager is not None:
self._stager.load()
else:
self.remote.to(self._device_target)
+ self._keep_resident = True
def set_omni_component_cache(self, cache: BoundedAllocatorCache | None) -> None:
self._omni_component_cache = cache
@@ -438,6 +448,8 @@ class MiniMaxH3AudioVAE(nn.Module):
self._stager.set_cache_retention(cache)
def offload_to_cpu(self) -> None:
+ if self._keep_resident:
+ return
if self._stager is not None:
self._stager.offload()
else:
self.remote.to("cpu")
cache = getattr(self, "_omni_component_cache", None)
if cache is None:
torch.accelerator.empty_cache()
else:
cache.release_if_needed()
diff --git a/vllm_omni/diffusion/worker/diffusion_worker.py b/vllm_omni/diffusion/worker/diffusion_worker.py
index 6499beee..6e54d588 100644
--- a/vllm_omni/diffusion/worker/diffusion_worker.py
+++ b/vllm_omni/diffusion/worker/diffusion_worker.py
@@ -771,6 +771,16 @@ class DiffusionWorker:
CuMemAllocator = _get_cumem_allocator_class()
allocator = CuMemAllocator.get_instance()
+ #release vae
+ if self.model_runner is not None:
+ pipeline = self.model_runner.pipeline
+ if pipeline is not None:
+ for attr_name in ("video_vae", "audio_vae", "text_encoder"):
+ vae = getattr(pipeline, attr_name, None)
+ if vae is not None and getattr(vae, "_keep_resident", False):
+ vae._keep_resident = False
+ vae.offload_to_cpu()
+
usage_before = allocator.get_current_usage()
if level == 2 and self.model_runner is not None:
vllm_omni/diffusion/attention/backends/rainfusion_attn.py 修改_forward_sparse_npu将rf_v2改为rf_v3
def _forward_sparse_npu(
self,
query: torch.Tensor,
key: torch.Tensor,
value: torch.Tensor,
plan: RainFusionPlan,
) -> torch.Tensor:
try:
from mindiesd import sparse_attention
except ImportError:
raise ImportError(_MISSING_MINDIESD)
if self.rainfusion.precision != "bf16" and not _mindiesd_supports_precision():
raise RuntimeError(
f"block_sparse.precision={self.rainfusion.precision!r} requires MindIE-SD "
"with sparse_attention(precision=...) support; the installed mindiesd "
"silently ignores it and would run the BF16 path. Install a compatible "
"MindIE-SD release or use precision='bf16'."
)
used = plan.used_len
q, k, v = (tensor[:, :used] for tensor in (query, key, value))
# Ulysses has already gathered the full sequence onto this rank and split
# the heads, so read the head count off the tensor rather than num_heads.
common_kwargs: dict[str, object] = {
"scale": self.softmax_scale,
"head_num": query.shape[-2],
"input_layout": _INPUT_LAYOUT,
"inner_precise": _INNER_PRECISE,
"block_size": _BLOCK_SIZE,
"sparsity": self.rainfusion.sparsity,
"precision": self.rainfusion.precision,
}
if plan.video_spans is not None:
out = sparse_attention(
q,
k,
v,
sparse_type="rf_v3",
video_spans=plan.video_spans,
**common_kwargs,
)
else:
assert plan.prefix_len is not None and plan.latent_shape is not None
common_kwargs.update(
sparse_type="rf_v3",
txt_len=plan.prefix_len,
latent_shape_q=plan.latent_shape,
latent_shape_k=plan.latent_shape,
)
out = sparse_attention(q, k, v, **common_kwargs)
if used == query.shape[1]:
return out
padded = torch.zeros_like(query)
padded[:, :used] = out
return padded修改/workspace/vllm-omni/vllm_omni/diffusion/models/minimax_h3/ops/vae/init.py,在 install_h3_vae_optimizations 函数之前新增以下代码:
class _NpuRMSNorm(nn.Module):
"""Drop-in replacement for nn.RMSNorm using torch_npu.npu_rms_norm."""
def __init__(self, normalized_shape, eps=1e-5, weight=None):
super().__init__()
if isinstance(normalized_shape, int):
normalized_shape = (normalized_shape,)
self.normalized_shape = tuple(normalized_shape)
self.eps = eps
if weight is not None:
self.weight = nn.Parameter(weight.data.clone())
else:
self.register_parameter("weight", None)
self._ones_gamma = None
def forward(self, x):
import torch_npu
if self.weight is not None:
gamma = self.weight
else:
if (self._ones_gamma is None
or self._ones_gamma.dtype != x.dtype
or self._ones_gamma.device != x.device):
self._ones_gamma = torch.ones(
self.normalized_shape, dtype=x.dtype, device=x.device)
gamma = self._ones_gamma
return torch_npu.npu_rms_norm(x, gamma=gamma, epsilon=self.eps)[0]
def _npu_optimized_feed_forward(self, hidden_states):
if torch.compiler.is_compiling():
return type(self).forward(self, hidden_states)
hidden_states = self.w1(hidden_states)
hidden_states = self._omni_silu_and_mul(hidden_states)
return self.w2(hidden_states)
def _replace_rmsnorm_with_npu(module, attr_name):
norm = getattr(module, attr_name, None)
if norm is None or not isinstance(norm, nn.RMSNorm):
return False
npu_norm = _NpuRMSNorm(
norm.normalized_shape, eps=norm.eps, weight=norm.weight)
if norm.weight is not None:
npu_norm = npu_norm.to(
device=norm.weight.device, dtype=norm.weight.dtype)
setattr(module, attr_name, npu_norm)
return True
def _install_npu_vae_optimizations(decoder, *, device):
if getattr(decoder, "_omni_npu_vae_optimizations_installed", False):
return True
blocks = getattr(decoder, "transformer_blocks", None)
if not isinstance(blocks, nn.ModuleList) or not blocks:
return False
for block in blocks:
_replace_rmsnorm_with_npu(block, "norm1")
_replace_rmsnorm_with_npu(block, "norm2")
attn = getattr(block, "attn", None)
if attn is not None:
_replace_rmsnorm_with_npu(attn, "norm_q")
_replace_rmsnorm_with_npu(attn, "norm_k")
ff = getattr(block, "ff", None)
if ff is not None and getattr(ff, "use_gated", False):
ff._omni_silu_and_mul = SiluAndMul()
ff.forward = MethodType(_npu_optimized_feed_forward, ff)
decoder._omni_npu_vae_optimizations_installed = True
return True修改 install_h3_vae_optimizations 函数: 在函数开头新增 NPU 分支
def install_h3_vae_optimizations(decoder, *, device):
if getattr(decoder, "_omni_h3_vae_optimizations_installed", False):
return True
# NPU path: fused RMSNorm + SwiGLU, no CUDA triton kernels needed.
if device.type == "npu" or current_omni_platform.is_npu():
return _install_npu_vae_optimizations(decoder, device=device)
# ... 原有 CUDA 路径不变 ...新增 import: 文件头部
from vllm_omni.platforms import current_omni_platform修改/workspace/vllm-omni/vllm_omni/diffusion/models/minimax_h3/minimax_h3_transformer.py
修改位置 1: MiniMaxH3DiTModel.__init__ 中新增 _step_cache
self.final_layer = MiniMaxH3FinalLayer(
arch,
quant_config,
prefix="final_layer",
)
self._step_cache: dict[str, Any] = {} # ← 新增
self._mark_missing_params_required()修改位置 2: MiniMaxH3DiTModel.forward 方法完整重写
修改前 (核心逻辑):
def forward(self, **kwargs: Any) -> tuple[torch.Tensor, torch.Tensor]:
"""Packed inference forward.
Keyword names follow the checkpoint's serving contract.
Returns `(video_logits, audio_logits)` from rows selected by
`img_pos_for_infer_output_info` and `audio_pos_info`, with condition
rows zeroed by update masks.
"""
# Strict keyword contract: refuse any kwarg forward does not consume.
unexpected = sorted(set(kwargs) - _FORWARD_SUPPORTED_KWARGS)
if unexpected:
raise TypeError(
"MiniMaxH3DiTModel.forward received unexpected kwargs: "
f"{unexpected}; supported kwargs: "
f"{sorted(_FORWARD_SUPPORTED_KWARGS)}"
)
x = _required_kwarg(kwargs, "x")
audio_x = _required_kwarg(kwargs, "audio_x")
img_position_ids = _required_kwarg(kwargs, "img_position_ids")
unique_timesteps = _required_kwarg(kwargs, "unique_timesteps")
inverse_indices = _required_kwarg(kwargs, "inverse_indices").view(-1).to(torch.long)
update_mask = _required_kwarg(kwargs, "update_mask")
token_tags = _required_kwarg(kwargs, "token_tags").view(-1).to(torch.long)
skip_mask_out_condition = bool(kwargs.get("skip_mask_out_condition", False))
text_selected = _required_kwarg(kwargs, "prompt_embeds")
img_pos = self._pos_ids(_required_kwarg(kwargs, "img_pos_info"), "img_pos_info")
audio_pos = self._pos_ids(_required_kwarg(kwargs, "audio_pos_info"), "audio_pos_info")
text_pos = self._pos_ids(
_required_kwarg(kwargs, "text_pos_info"),
"text_pos_info",
)
infer_out_pos = self._pos_ids(
_required_kwarg(kwargs, "img_pos_for_infer_output_info"),
"img_pos_for_infer_output_info",
)
psp = _required_kwarg(kwargs, "packed_seq_params")
cu_seqlens = self._psp_field(psp, "packed_seq_params", "cu_seqlens_q").to(torch.int32)
max_seqlen = int(self._psp_field(psp, "packed_seq_params", "max_seqlen_q"))
# How many requests share this packed sequence. Carried as a host int so
# attention never reads cu_seqlens scalars off the device; a producer
# that omits it is packing a single request.
num_requests = int(self._psp_optional(psp, "num_requests", 1))
refiner_psp = _required_kwarg(kwargs, "refiner_packed_seq_params")
refiner_cu = self._psp_field(refiner_psp, "refiner_packed_seq_params", "cu_seqlens_q").to(torch.int32)
refiner_max = int(self._psp_field(refiner_psp, "refiner_packed_seq_params", "max_seqlen_q"))
video_layout = kwargs.get("video_token_layout")
if x.dim() != 3 or x.shape[0] != 1:
raise ValueError(f"x must be [1, S, C], got {list(x.shape)}")
seq_len = int(x.shape[1])
if token_tags.shape[0] != seq_len:
raise ValueError(f"token_tags must cover the full packed sequence ({seq_len}), got {token_tags.shape[0]}.")
if inverse_indices.shape[0] != seq_len:
raise ValueError(f"inverse_indices must be [{seq_len}], got {list(inverse_indices.shape)}")
device = x.device
local_span = self._rope_local_span(seq_len)
local_start, local_len = local_span
rope_table = kwargs.get("rope_table")
if rope_table is None:
if current_omni_platform.is_npu():
rope_table = self.prepare_rope_table(
img_position_ids,
seq_len=seq_len,
)
else:
# Keep CUDA/CPU numerically and structurally identical to the
# main-branch reference path used by the H100 accuracy suite.
rope_position_ids = img_position_ids.narrow(1, local_start, local_len)
rope_table = _build_rope_table(self.rope(rope_position_ids).to(device))
else:
self._validate_prepared_rope_table(
rope_table,
local_len=local_len,
device=device,
)
decoder_input, t_emb = self._embed(
x=x,
audio_x=audio_x,
text_embeddings_selected=text_selected,
unique_timesteps=unique_timesteps.view(-1).to(device),
img_pos=img_pos.to(device),
audio_pos=audio_pos.to(device),
text_pos=text_pos.to(device),
refiner_cu_seqlens=refiner_cu.to(device),
refiner_max_seqlen=refiner_max,
num_requests=num_requests,
seq_len=seq_len,
device=device,
local_span=local_span,
)
combined_indices = (inverse_indices * MINIMAX_H3_ADALN_MODALITY_NUM + token_tags.clamp(min=0)).to(device)
inverse_indices = inverse_indices.to(device)
hidden = decoder_input
cu_seqlens = cu_seqlens.to(device)
block_rope = rope_table
block_combined = combined_indices
if local_len == seq_len:
hidden, block_rope, block_combined = self.sp_prepare(
hidden,
block_rope,
block_combined,
)
else:
hidden, block_rope, block_combined = self.local_sp_prepare(
hidden,
block_rope,
block_combined,
)
for block in self.blocks:
hidden = block(
hidden,
t_emb=t_emb,
combined_indices=block_combined,
rope_table=block_rope,
cu_seqlens=cu_seqlens,
max_seqlen=max_seqlen,
packed_total=seq_len,
num_requests=num_requests,
video_layout=video_layout,
)
if local_len == seq_len:
hidden = self.sp_gather(hidden)
video_logits, audio_logits = self.final_layer(
hidden,
t_emb=t_emb,
inverse_indices=inverse_indices,
)
else:
local_inverse_indices = inverse_indices.narrow(
0,
local_start,
local_len,
)
video_logits, audio_logits = self.final_layer(
hidden,
t_emb=t_emb,
inverse_indices=local_inverse_indices,
)
compact_logits = torch.cat((video_logits, audio_logits), dim=-1)
compact_logits = self.sp_gather(compact_logits)
video_width = self.arch.latents_dim * math.prod(self.arch.patch_size)
video_logits = compact_logits[..., :video_width]
audio_logits = compact_logits[..., video_width:]
# Select target and condition rows at inference-output positions, then
# zero the condition rows.
video_logits = video_logits.index_select(0, infer_out_pos.to(device))
audio_logits = audio_logits.index_select(0, audio_pos.to(device))
if not skip_mask_out_condition:
update_mask = update_mask.view(-1).to(device)
if update_mask.shape[0] != video_logits.shape[0]:
raise ValueError(f"update_mask length mismatch: {update_mask.shape[0]} != {video_logits.shape[0]}")
video_logits = video_logits * update_mask.unsqueeze(-1)
# Audio has no condition rows in the supported tasks, so its
# derived update mask is all ones. Honor an explicit mask when
# provided.
update_audio_mask = kwargs.get("update_audio_mask")
if update_audio_mask is not None:
audio_logits = audio_logits * update_audio_mask.view(-1).unsqueeze(-1)
return video_logits, audio_logits修改后 (缓存逻辑):
def forward(self, **kwargs: Any) -> tuple[torch.Tensor, torch.Tensor]:
"""Packed inference forward.
Keyword names follow the checkpoint's serving contract.
Returns `(video_logits, audio_logits)` from rows selected by
`img_pos_for_infer_output_info` and `audio_pos_info`, with condition
rows zeroed by update masks.
"""
# Strict keyword contract: refuse any kwarg forward does not consume.
unexpected = sorted(set(kwargs) - _FORWARD_SUPPORTED_KWARGS)
if unexpected:
raise TypeError(
"MiniMaxH3DiTModel.forward received unexpected kwargs: "
f"{unexpected}; supported kwargs: "
f"{sorted(_FORWARD_SUPPORTED_KWARGS)}"
)
x = _required_kwarg(kwargs, "x")
audio_x = _required_kwarg(kwargs, "audio_x")
unique_timesteps = _required_kwarg(kwargs, "unique_timesteps")
text_selected = _required_kwarg(kwargs, "prompt_embeds")
if x.dim() != 3 or x.shape[0] != 1:
raise ValueError(f"x must be [1, S, C], got {list(x.shape)}")
seq_len = int(x.shape[1])
device = x.device
# ------------------------------------------------------------------
# Cache static tensors that don't change across denoise steps.
# The pipeline passes the same inverse_indices/token_tags/cu_seqlens
# etc. for every step of a single request. Caching the device-
# resident versions and the derived combined_indices avoids ~7x
# redundant H2D transfers and element-wise kernels per request.
# ------------------------------------------------------------------
inv_indices_src = _required_kwarg(kwargs, "inverse_indices")
cache = self._step_cache
src_ptr = inv_indices_src.data_ptr()
cache_hit = (
cache.get("_src_ptr") == src_ptr
and cache.get("_seq_len") == seq_len
and cache.get("_device") == device
)
if cache_hit:
inverse_indices = cache["inverse_indices"]
combined_indices = cache["combined_indices"]
cu_seqlens = cache["cu_seqlens"]
refiner_cu = cache["refiner_cu"]
img_pos = cache["img_pos"]
audio_pos = cache["audio_pos"]
text_pos = cache["text_pos"]
infer_out_pos = cache["infer_out_pos"]
update_mask_cached = cache.get("update_mask")
img_position_ids = cache["img_position_ids"]
else:
inverse_indices = inv_indices_src.view(-1).to(torch.long)
update_mask = _required_kwarg(kwargs, "update_mask")
token_tags = _required_kwarg(kwargs, "token_tags").view(-1).to(torch.long)
skip_mask_out_condition = bool(kwargs.get("skip_mask_out_condition", False))
img_position_ids = _required_kwarg(kwargs, "img_position_ids")
img_pos = self._pos_ids(_required_kwarg(kwargs, "img_pos_info"), "img_pos_info")
audio_pos = self._pos_ids(_required_kwarg(kwargs, "audio_pos_info"), "audio_pos_info")
text_pos = self._pos_ids(
_required_kwarg(kwargs, "text_pos_info"),
"text_pos_info",
)
infer_out_pos = self._pos_ids(
_required_kwarg(kwargs, "img_pos_for_infer_output_info"),
"img_pos_for_infer_output_info",
)
psp = _required_kwarg(kwargs, "packed_seq_params")
cu_seqlens = self._psp_field(psp, "packed_seq_params", "cu_seqlens_q").to(torch.int32)
num_requests = int(self._psp_optional(psp, "num_requests", 1))
refiner_psp = _required_kwarg(kwargs, "refiner_packed_seq_params")
refiner_cu = self._psp_field(refiner_psp, "refiner_packed_seq_params", "cu_seqlens_q").to(torch.int32)
video_layout = kwargs.get("video_token_layout")
if token_tags.shape[0] != seq_len:
raise ValueError(f"token_tags must cover the full packed sequence ({seq_len}), got {token_tags.shape[0]}.")
if inverse_indices.shape[0] != seq_len:
raise ValueError(f"inverse_indices must be [{seq_len}], got {list(inverse_indices.shape)}")
# Pre-compute and cache device-resident static tensors.
cache["_src_ptr"] = src_ptr
cache["_seq_len"] = seq_len
cache["_device"] = device
cache["inverse_indices"] = inverse_indices.to(device)
cache["combined_indices"] = (
inverse_indices * MINIMAX_H3_ADALN_MODALITY_NUM + token_tags.clamp(min=0)
).to(device)
cache["cu_seqlens"] = cu_seqlens.to(device)
cache["refiner_cu"] = refiner_cu.to(device)
cache["img_pos"] = img_pos.to(device)
cache["audio_pos"] = audio_pos.to(device)
cache["text_pos"] = text_pos.to(device)
cache["infer_out_pos"] = infer_out_pos.to(device)
cache["img_position_ids"] = img_position_ids
cache["video_layout"] = video_layout
cache["num_requests"] = num_requests
if not skip_mask_out_condition:
cache["update_mask"] = update_mask.view(-1).to(device)
# Return cached + freshly-computed values for this branch.
max_seqlen = int(self._psp_field(psp, "packed_seq_params", "max_seqlen_q"))
refiner_max = int(self._psp_field(refiner_psp, "refiner_packed_seq_params", "max_seqlen_q"))
cache["max_seqlen"] = max_seqlen
cache["refiner_max"] = refiner_max
# Populate local vars from cache for the code below.
inverse_indices = cache["inverse_indices"]
combined_indices = cache["combined_indices"]
cu_seqlens = cache["cu_seqlens"]
refiner_cu = cache["refiner_cu"]
img_pos = cache["img_pos"]
audio_pos = cache["audio_pos"]
text_pos = cache["text_pos"]
infer_out_pos = cache["infer_out_pos"]
update_mask_cached = cache.get("update_mask")
max_seqlen = cache["max_seqlen"]
refiner_max = cache["refiner_max"]
num_requests = cache["num_requests"]
video_layout = cache["video_layout"]
skip_mask_out_condition = "update_mask" not in cache
local_span = self._rope_local_span(seq_len)
local_start, local_len = local_span
rope_table = kwargs.get("rope_table")
if rope_table is None:
if current_omni_platform.is_npu():
rope_table = self.prepare_rope_table(
img_position_ids,
seq_len=seq_len,
)
else:
# Keep CUDA/CPU numerically and structurally identical to the
# main-branch reference path used by the H100 accuracy suite.
rope_position_ids = img_position_ids.narrow(1, local_start, local_len)
rope_table = _build_rope_table(self.rope(rope_position_ids).to(device))
else:
self._validate_prepared_rope_table(
rope_table,
local_len=local_len,
device=device,
)
decoder_input, t_emb = self._embed(
x=x,
audio_x=audio_x,
text_embeddings_selected=text_selected,
unique_timesteps=unique_timesteps.view(-1).to(device),
img_pos=img_pos,
audio_pos=audio_pos,
text_pos=text_pos,
refiner_cu_seqlens=refiner_cu,
refiner_max_seqlen=refiner_max,
num_requests=num_requests,
seq_len=seq_len,
device=device,
local_span=local_span,
)
hidden = decoder_input
block_rope = rope_table
block_combined = combined_indices
if local_len == seq_len:
hidden, block_rope, block_combined = self.sp_prepare(
hidden,
block_rope,
block_combined,
)
else:
hidden, block_rope, block_combined = self.local_sp_prepare(
hidden,
block_rope,
block_combined,
)
for block in self.blocks:
hidden = block(
hidden,
t_emb=t_emb,
combined_indices=block_combined,
rope_table=block_rope,
cu_seqlens=cu_seqlens,
max_seqlen=max_seqlen,
packed_total=seq_len,
num_requests=num_requests,
video_layout=video_layout,
)
if local_len == seq_len:
hidden = self.sp_gather(hidden)
video_logits, audio_logits = self.final_layer(
hidden,
t_emb=t_emb,
inverse_indices=inverse_indices,
)
else:
local_inverse_indices = inverse_indices.narrow(
0,
local_start,
local_len,
)
video_logits, audio_logits = self.final_layer(
hidden,
t_emb=t_emb,
inverse_indices=local_inverse_indices,
)
compact_logits = torch.cat((video_logits, audio_logits), dim=-1)
compact_logits = self.sp_gather(compact_logits)
video_width = self.arch.latents_dim * math.prod(self.arch.patch_size)
video_logits = compact_logits[..., :video_width]
audio_logits = compact_logits[..., video_width:]
# Select target and condition rows at inference-output positions, then
# zero the condition rows.
video_logits = video_logits.index_select(0, infer_out_pos)
audio_logits = audio_logits.index_select(0, audio_pos)
if not skip_mask_out_condition:
if update_mask_cached is None:
update_mask_kwarg = _required_kwarg(kwargs, "update_mask")
update_mask_cached = update_mask_kwarg.view(-1).to(device)
if update_mask_cached.shape[0] != video_logits.shape[0]:
raise ValueError(f"update_mask length mismatch: {update_mask_cached.shape[0]} != {video_logits.shape[0]}")
video_logits = video_logits * update_mask_cached.unsqueeze(-1)
# Audio has no condition rows in the supported tasks, so its
# derived update mask is all ones. Honor an explicit mask when
# provided.
update_audio_mask = kwargs.get("update_audio_mask")
if update_audio_mask is not None:
audio_logits = audio_logits * update_audio_mask.view(-1).unsqueeze(-1)
return video_logits, audio_logits新增/workspace/vllm-omni/vllm_omni/diffusion/models/minimax_h3/ops/tae_decoder.py
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
# SPDX-License-Identifier: MIT
# Copyright (c) 2025 Ollin Boer Bohan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""Decoder-only TAEH3 runtime adapted from madebyollin/taehv.
Expects RAW normalized latents (no denormalization).
Output is clamped to [0, 1] (no percentile stretching needed).
Temporal processing via _MemBlock + _TGrow (4x temporal upscale).
"""
from __future__ import annotations
import hashlib
import logging
import os
from pathlib import Path
from urllib.parse import urlparse
import torch
import torch.nn.functional as F
from torch import nn
logger = logging.getLogger(__name__)
TAEH3_UPSTREAM_COMMIT = "e589fddc076e77f5ba8cd6baabe4ba3260b261cd"
TAEH3_CHECKPOINT_URL = f"https://raw.githubusercontent.com/madebyollin/taehv/{TAEH3_UPSTREAM_COMMIT}/taeh3.pth"
TAEH3_CHECKPOINT_SHA256 = "af92965c2d7986a89a757e7cccd26f9eeeff0c3f0d5495eb168aeb2d6d9be9ba"
def _conv(in_channels: int, out_channels: int, **kwargs) -> nn.Conv2d:
return nn.Conv2d(in_channels, out_channels, 3, padding=1, **kwargs)
class _Clamp(nn.Module):
def forward(self, value: torch.Tensor) -> torch.Tensor:
return torch.tanh(value / 3) * 3
class _MemBlock(nn.Module):
def __init__(self, in_channels: int, out_channels: int) -> None:
super().__init__()
self.conv = nn.Sequential(
_conv(in_channels * 2, out_channels),
nn.ReLU(inplace=True),
_conv(out_channels, out_channels),
nn.ReLU(inplace=True),
_conv(out_channels, out_channels),
)
self.skip = (
nn.Conv2d(in_channels, out_channels, 1, bias=False) if in_channels != out_channels else nn.Identity()
)
self.act = nn.ReLU(inplace=True)
def forward(self, value: torch.Tensor, past: torch.Tensor) -> torch.Tensor:
return self.act(self.conv(torch.cat((value, past), dim=1)) + self.skip(value))
class _TGrow(nn.Module):
def __init__(self, channels: int, stride: int) -> None:
super().__init__()
self.stride = stride
self.conv = nn.Conv2d(channels, channels * stride, 1, bias=False)
def forward(self, value: torch.Tensor) -> torch.Tensor:
_, channels, height, width = value.shape
return self.conv(value).reshape(-1, channels, height, width)
# CANN 25.7.rc1.6 (Ascend 950PR): nn.Upsample(mode='nearest') on 4-D input
# silently skips writing the tail of the output once the flattened batch
# exceeds a threshold measured between 165 (clean) and 200 (corrupt), leaving
# stale device memory in the unwritten rows (first bad row observed at 170,
# independent of total batch). The equivalent F.interpolate forms share the
# same kernel. Splitting the call keeps every piece under the threshold;
# nearest upsampling is per-sample, so the split is bit-exact.
_UPSAMPLE_MAX_BATCH = 128
def _upsample_nearest_safe(block: nn.Upsample, value: torch.Tensor) -> torch.Tensor:
if value.shape[0] <= _UPSAMPLE_MAX_BATCH:
return block(value)
return torch.cat([block(chunk) for chunk in value.split(_UPSAMPLE_MAX_BATCH, dim=0)], dim=0)
def _apply_decoder_parallel(decoder: nn.Sequential, value: torch.Tensor) -> torch.Tensor:
if value.ndim != 5:
raise ValueError(f"TAEH3 expects NTCHW latent input, got {tuple(value.shape)}")
batch, frames, channels, height, width = value.shape
value = value.reshape(batch * frames, channels, height, width)
for block in decoder:
if isinstance(block, _MemBlock):
frames = value.shape[0] // batch
shaped = value.reshape(batch, frames, value.shape[1], value.shape[2], value.shape[3])
past = F.pad(shaped, (0, 0, 0, 0, 0, 0, 1, 0))[:, :frames]
value = block(value, past.reshape_as(value))
elif isinstance(block, nn.Upsample):
value = _upsample_nearest_safe(block, value)
else:
value = block(value)
frames = value.shape[0] // batch
return value.reshape(batch, frames, value.shape[1], value.shape[2], value.shape[3])
def _sha256_file(path: Path) -> str:
digest = hashlib.sha256()
with path.open("rb") as handle:
while chunk := handle.read(1024 * 1024):
digest.update(chunk)
return digest.hexdigest()
def resolve_taeh3_checkpoint(source: str | os.PathLike[str]) -> Path:
raw_source = str(source)
parsed = urlparse(raw_source)
if parsed.scheme in {"http", "https"}:
if raw_source != TAEH3_CHECKPOINT_URL:
raise ValueError(f"unsupported remote TAEH3 checkpoint: {raw_source}")
checkpoint_dir = Path(torch.hub.get_dir()) / "checkpoints"
checkpoint_dir.mkdir(parents=True, exist_ok=True)
checkpoint = checkpoint_dir / f"taeh3-{TAEH3_CHECKPOINT_SHA256[:12]}.pth"
if not checkpoint.is_file():
temporary = checkpoint.with_name(f"{checkpoint.name}.{os.getpid()}.tmp")
try:
torch.hub.download_url_to_file(
raw_source,
temporary,
hash_prefix=TAEH3_CHECKPOINT_SHA256,
progress=True,
)
os.replace(temporary, checkpoint)
finally:
temporary.unlink(missing_ok=True)
else:
checkpoint = Path(source).expanduser()
checkpoint = checkpoint.resolve(strict=True)
actual_sha256 = _sha256_file(checkpoint)
if actual_sha256 != TAEH3_CHECKPOINT_SHA256:
raise RuntimeError(f"TAEH3 checkpoint SHA-256 {actual_sha256} != {TAEH3_CHECKPOINT_SHA256}: {checkpoint}")
return checkpoint
class H3TAEDecoder(nn.Module):
"""Tiny decoder for normalized MiniMax H3 video latents.
Uses madebyollin/taehv checkpoint (taeh3.pth, 11.3M params, FP16).
Expects RAW normalized latents (no denormalization) in NCTHW format.
Output is clamped to [0, 1] (no percentile stretching needed).
Temporal processing via _MemBlock + _TGrow (4x temporal upscale).
"""
latent_channels = 24
patch_size = 2
temporal_upscale = 4
frames_to_trim = temporal_upscale - 1
def __init__(self) -> None:
super().__init__()
self.decoder = nn.Sequential(
_Clamp(),
_conv(24, 256),
nn.ReLU(inplace=True),
_MemBlock(256, 256),
_MemBlock(256, 256),
_MemBlock(256, 256),
nn.Upsample(scale_factor=2),
_TGrow(256, 1),
_conv(256, 128, bias=False),
_MemBlock(128, 128),
_MemBlock(128, 128),
_MemBlock(128, 128),
nn.Upsample(scale_factor=2),
_TGrow(128, 2),
_conv(128, 64, bias=False),
_MemBlock(64, 64),
_MemBlock(64, 64),
_MemBlock(64, 64),
nn.Upsample(scale_factor=2),
_TGrow(64, 2),
_conv(64, 64, bias=False),
nn.ReLU(inplace=True),
_conv(64, 3 * self.patch_size**2),
)
@classmethod
def from_pretrained(
cls,
ckpt_path: str,
latent_channels: int = 24,
dtype: torch.dtype = torch.float16,
) -> H3TAEDecoder:
"""Load TAEH3 weights from .pth checkpoint (SHA-256 verified)."""
checkpoint = resolve_taeh3_checkpoint(ckpt_path)
state_dict = torch.load(checkpoint, map_location="cpu", weights_only=True)
if not isinstance(state_dict, dict):
raise TypeError(f"TAEH3 checkpoint must contain a state dict, got {type(state_dict).__name__}")
decoder_state = {
name.removeprefix("decoder."): tensor
for name, tensor in state_dict.items()
if name.startswith("decoder.")
}
decoder = cls()
decoder.decoder.load_state_dict(decoder_state, strict=True)
decoder.to(device=torch.device("cpu"), dtype=torch.float16)
decoder.eval()
decoder.requires_grad_(False)
logger.info(
"TAEH3 decoder loaded from %s (params=%d)",
ckpt_path,
sum(p.numel() for p in decoder.parameters()),
)
return decoder
@torch.no_grad()
def decode_video(self, latent: torch.Tensor, *, chunk_frames: int = 16) -> torch.Tensor:
"""Decode a 5-D video latent to frames.
latent: [B, C, T, H, W] (raw normalized, NO denormalization)
-> [B, 3, T*4-15, H*16, W*16] clamped to [0, 1]
Processes ``chunk_frames`` input frames at a time to keep peak NPU
memory bounded (each chunk yields chunk_frames*4 output frames after
temporal upsampling).
"""
if latent.ndim != 5 or latent.shape[1] != self.latent_channels:
raise ValueError(
f"TAEH3 expects NCTHW latent with {self.latent_channels} channels, got {tuple(latent.shape)}"
)
dtype = next(self.parameters()).dtype
device = next(self.parameters()).device
value = latent.permute(0, 2, 1, 3, 4).to(device=device, dtype=dtype).contiguous()
batch, total_frames = value.shape[0], value.shape[1]
if total_frames <= chunk_frames:
value = _apply_decoder_parallel(self.decoder, value)
else:
parts = []
for start in range(0, total_frames, chunk_frames):
end = min(start + chunk_frames, total_frames)
parts.append(_apply_decoder_parallel(self.decoder, value[:, start:end]))
value = torch.cat(parts, dim=1)
chunk_frames = 5 * self.temporal_upscale
pad_frames = (-value.shape[1]) % chunk_frames
if pad_frames:
value = F.pad(value, (0, 0, 0, 0, 0, 0, 0, pad_frames))
if value.shape[1] < chunk_frames:
raise ValueError(f"TAEH3 decoded timeline is too short: {value.shape[1]} frames")
value = value.unflatten(1, (-1, chunk_frames))
value = value[:, :, self.frames_to_trim :].flatten(1, 2)
value = value[:, : -3 * self.temporal_upscale]
batch, frames, channels, height, width = value.shape
value = F.pixel_shuffle(
value.reshape(batch * frames, channels, height, width),
self.patch_size,
)
value = value.reshape(batch, frames, 3, value.shape[-2], value.shape[-1])
return value.clamp_(0, 1).permute(0, 2, 1, 3, 4).contiguous()新增 import os 和 import torch.nn.functional as F:
import os
...
import torch.nn.functional as FMiniMaxH3VideoVAE.__init__)在 self._keep_resident = False 之后新增 TAEH3 加载逻辑:
self._keep_resident = False
# TAEH3 lightweight decoder (preview mode, gated by OMNI_H3_TAE)
self._tae_decoder = None
tae_path = os.environ.get("OMNI_H3_TAE", "")
if tae_path and os.path.isfile(tae_path):
from vllm_omni.diffusion.models.minimax_h3.ops.tae_decoder import H3TAEDecoder
self._tae_decoder = H3TAEDecoder.from_pretrained(
tae_path,
).to(device=device)
logger.info(
"MiniMax-H3 TAEH3 preview decoder loaded from %s (params=%d)",
tae_path,
sum(p.numel() for p in self._tae_decoder.parameters()),
)MiniMaxH3VideoVAE.decode_latent)在 mean/std 计算之后、原始 VAE decode 之前,新增 TAEH3 分支:
# TAEH3 decode path — uses RAW normalized latents (no denormalization)
if self._tae_decoder is not None:
if next(self._tae_decoder.parameters()).device != latent.device:
self._tae_decoder.to(device=latent.device)
device_type = latent.device.type
with torch.autocast(device_type, enabled=False):
frames = self._tae_decoder.decode_video(latent)
return frames.float()
# Original VAE decode path with tiling
...MiniMaxH3AudioVAE.decode_latent)修改前:
@torch.inference_mode()
def decode_latent(self, latent: torch.Tensor) -> torch.Tensor:
channels = int(self.config_dict["latent_channels"])
mean = torch.tensor(
self.config_dict["latents_mean"],
device=latent.device,
dtype=latent.dtype,
).view(1, channels, 1)
std = torch.tensor(
self.config_dict["latents_std"],
device=latent.device,
dtype=latent.dtype,
).view(1, channels, 1)
waveform = self.remote.decode(latent * std + mean)
if waveform.ndim != 3 or waveform.shape[1] != 1:
raise ValueError(f"unexpected decoded audio shape {tuple(waveform.shape)}")
return waveform.permute(1, 0, 2).contiguous().float()
修改后:
@torch.inference_mode()
def decode_latent(self, latent: torch.Tensor) -> torch.Tensor:
channels = int(self.config_dict["latent_channels"])
mean = torch.tensor(
self.config_dict["latents_mean"],
device=latent.device,
dtype=latent.dtype,
).view(1, channels, 1)
std = torch.tensor(
self.config_dict["latents_std"],
device=latent.device,
dtype=latent.dtype,
).view(1, channels, 1)
denorm = latent.float() * std.float() + mean.float()
device_type = latent.device.type
with torch.autocast(device_type, enabled=False):
waveform = self.remote.decode(denorm)
if waveform.ndim != 3 or waveform.shape[1] != 1:
raise ValueError(f"unexpected decoded audio shape {tuple(waveform.shape)}")
return waveform.permute(1, 0, 2).contiguous().float()
https://github.com/vllm-project/vllm-omni/pull/8072 启动时添加:
--kv-offload-config '{"mode":"tier2","kv_refresh_interval":8,"kv_host_quantization":"int8","skip_reference_projection":true}'https://github.com/vllm-project/vllm-omni/pull/8378
https://github.com/vllm-project/vllm-omni/pull/8813
https://github.com/vllm-project/vllm-omni/pull/6939(v0.29.0rc1) 脚本配置:
=========yaml文件
# MiniMax H3: vLLM Qwen3-VL text encoder + diffusion video/audio generation.
# MiniMax H3: unified text/video/audio encoder stage + diffusion generation stage.
pipeline: minimax_h3_disaggregated
async_chunk: false
trust_remote_code: true
distributed_executor_backend: mp
stages:
- stage_id: 0
devices: "0,1,2,3,4,5,6,7"
max_num_seqs: 1
gpu_memory_utilization: 0.6
tensor_parallel_size: 8
hf_overrides:
minimax_h3_encoder_components:
text_encoder:
parallel_mode: tp
video_vae:
parallel_mode: patch
audio_vae:
parallel_mode: leader
default_sampling_params:
max_tokens: 1
temperature: 0.0
detokenize: false
- stage_id: 1
devices: "0,1,2,3,4,5,6,7"
max_num_seqs: 1
model_loaded:
text_encoder: false
vae_encoder: false
parallel_config:
tensor_parallel_size: 1
ulysses_degree: 8
vae_patch_parallel_size: 8
default_sampling_params:
seed: 42
num_inference_steps: 50
====node1
#!/bin/bash
# MiniMax-H3 two-node deployment — Node 1 (Head)
set -eo pipefail
source /usr/local/Ascend/ascend-toolkit/set_env.sh 2>/dev/null || true
source /usr/local/Ascend/nnal/atb/set_env.sh 2>/dev/null || true
# ── Network configuration ──
NODE1_IP="${NODE1_IP:-$(hostname -I | awk '{print $1}')}"
OMNI_MASTER_PORT="${OMNI_MASTER_PORT:-26000}"
GLOO_IFNAME="${GLOO_IFNAME:-enp189s0f0}"
export GLOO_SOCKET_IFNAME="${GLOO_IFNAME}"
export HCCL_NPU_SOCKET_PORT_RANGE="auto"
export HCCL_HOST_SOCKET_PORT_RANGE="auto"
# ── Common environment ──
export PORT="${PORT:-9098}"
export VLLM_WORKER_MULTIPROC_METHOD=spawn
export VLLM_OMNI_VIDEO_SYNC_TIMEOUT=1800
export PYTHONDONTWRITEBYTECODE=1
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export MINDIE_SD_FA_TYPE="ascend_laser_attention"
# ── Model path ──
MODEL_ROOT="${MODEL_ROOT:-/home/weight/MiniMax-H3/}"
export MODEL="${MODEL_ROOT}/FL2VA"
# ── Distributed timeout ──
export STAGE_INIT_TIMEOUT="${STAGE_INIT_TIMEOUT:-600}"
export INIT_TIMEOUT="${INIT_TIMEOUT:-1200}"
vllm serve "${MODEL}" \
--omni \
--deploy-config 2node.yaml \
--host 0.0.0.0 \
--port "${PORT}" \
--trust-remote-code \
--stage-id 0 \
--omni-master-address "${NODE1_IP}" \
--omni-master-port "${OMNI_MASTER_PORT}" \
--enable-distributed-layerwise-offload \
--enable-diffusion-pipeline-profiler \
--vae-parallel-mode tile \
--vae-use-tiling \
--diffusion-attention-backend FLASH_ATTN
========node2
#!/bin/bash
# MiniMax-H3 two-node deployment — Node 2 (Headless Worker)
set -eo pipefail
source /usr/local/Ascend/ascend-toolkit/set_env.sh 2>/dev/null || true
source /usr/local/Ascend/nnal/atb/set_env.sh 2>/dev/null || true
# ── Network configuration ──
NODE1_IP="80.48.37.206"
OMNI_MASTER_PORT="${OMNI_MASTER_PORT:-26000}"
NODE2_IP="${NODE2_IP:-$(hostname -I | awk '{print $1}')}"
GLOO_IFNAME="${GLOO_IFNAME:-enp189s0f0}"
export GLOO_SOCKET_IFNAME="${GLOO_IFNAME}"
export HCCL_NPU_SOCKET_PORT_RANGE="auto"
export HCCL_HOST_SOCKET_PORT_RANGE="auto"
# ── Common environment (must match head) ──
export VLLM_WORKER_MULTIPROC_METHOD=spawn
export VLLM_OMNI_VIDEO_SYNC_TIMEOUT=1800
export PYTHONDONTWRITEBYTECODE=1
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export MINDIE_SD_FA_TYPE="ascend_laser_attention"
# ── Model path ──
MODEL_ROOT="${MODEL_ROOT:-/home/weight/MiniMax-H3/}"
export MODEL="${MODEL_ROOT}/FL2VA"
# ── Distributed timeout ──
export STAGE_INIT_TIMEOUT="${STAGE_INIT_TIMEOUT:-600}"
export INIT_TIMEOUT="${INIT_TIMEOUT:-1200}"
vllm serve "${MODEL}" \
--omni \
--deploy-config 2node.yaml \
--trust-remote-code \
--headless \
--stage-id 1 \
--omni-master-address "${NODE1_IP}" \
--omni-master-port "${OMNI_MASTER_PORT}" \
--omni-replica-address "${NODE2_IP}" \
--stage-init-timeout "${STAGE_INIT_TIMEOUT}" \
--init-timeout "${INIT_TIMEOUT}" \
--enable-diffusion-pipeline-profiler \
--enable-distributed-layerwise-offload \
--vae-parallel-mode tile \
--vae-use-tiling \
--diffusion-attention-backend FLASH_ATTN
性能: A2:使用lightx2v蒸馏权重,8步推理15s 704*1280视频
| 优化项 | 数据 |
|---|---|
| LA默认基线拉起 | 130s |
1、开启int8量化报错: https://github.com/vllm-project/vllm-omni/issues/6852