[Hardware][Ascend] Keep HiFT vocoder on NPU (#5242)

Signed-off-by: fatSheep <tzh2005t@163.com>
Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
fatSheepandamy-why-3459 authored and GitHub committed 2026-07-21 14:30:30 +08:00
1 parent 740bb31ff9
commit 5d44868e91
5 files changed
+282 -49

No files matched your search

@@ -514,7 +514,7 @@ class MiniCPMO45OmniTTSForConditionalGeneration(nn.Module, SupportsPP):
# memory on the NPU sdpa path. Detach the Token2wav vocoder first
# so the cast does not drag it onto the accelerator or downcast
# its float32 flow/HiFT weights: it manages its own device
# placement (e.g. CPU HiFT on NPU) and may not be an nn.Module.
# placement and may not be an nn.Module.
device = current_omni_platform.get_torch_device()
audio_tok = getattr(self.tts_obj, "audio_tokenizer", None)
if audio_tok is not None:
@@ -6,8 +6,8 @@
``from stepaudio2 import Token2wav`` entry point (``stepaudio2-minicpmo``).
That package hard-codes ``.cuda()`` and duplicates the flow/HiFT stack that
vLLM-Omni already vendors for Step-Audio2 (which also carries the Ascend/NPU
fixes: CPU HiFT, DiT mask expand, MATH SDPA, compile disable, PE buffer
extension).
fixes: HiFT linear downsample, DiT mask expand, MATH SDPA, compile disable,
PE buffer extension).
This module exposes the same call surface MiniCPM expects
(``__call__`` / ``set_stream_cache`` / ``stream``) while delegating the
@@ -100,8 +100,9 @@ class StepAudio2Token2WavCore(nn.Module):
# and apply the Token2Wav NPU patch here (idempotent) before
# ``_ensure_models_loaded`` runs. Covers every
# construction site (Step-Audio2 wrapper + MiniCPM-o facade): patched
# ``_ensure_models_loaded`` offloads HiFT to CPU and patched ``forward``
# expands CosyVoice DiT masks + forces MATH SDPA (avoids FA 161001).
# ``_ensure_models_loaded`` replaces HiFT's failing linear downsample,
# while patched ``forward`` expands CosyVoice DiT masks and forces
# MATH SDPA (avoids FA 161001).
from vllm_omni.platforms import current_omni_platform
if current_omni_platform.is_npu():