From dc72559d5d975e4ba2f60461455d6b3cfeac7102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=BF=97=E9=B9=8F?= Date: Fri, 21 Aug 2026 19:45:46 +0800 Subject: [PATCH] [BugFix]: CosyVoice3 STFT window device mismatch (#6454) Signed-off-by: princepride --- .../models/cosyvoice3/code2wav_core/hifigan.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vllm_omni/model_executor/models/cosyvoice3/code2wav_core/hifigan.py b/vllm_omni/model_executor/models/cosyvoice3/code2wav_core/hifigan.py index d8d99aa21..66efe24b2 100644 --- a/vllm_omni/model_executor/models/cosyvoice3/code2wav_core/hifigan.py +++ b/vllm_omni/model_executor/models/cosyvoice3/code2wav_core/hifigan.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project +# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project # Adopted from https://github.com/FunAudioLLM/CosyVoice/tree/main/cosyvoice/hifigan # Copyright (c) 2024 Alibaba Inc (authors: Xiang Lyu, Kai Hu) @@ -696,7 +696,11 @@ class CausalHiFTGenerator(HiFTGenerator): self.ups.apply(init_weights) self.conv_post.apply(init_weights) self.reflection_pad = nn.ReflectionPad1d((1, 0)) - self.stft_window = torch.from_numpy(get_window("hann", istft_params["n_fft"], fftbins=True).astype(np.float32)) + self.register_buffer( + "stft_window", + torch.from_numpy(get_window("hann", istft_params["n_fft"], fftbins=True).astype(np.float32)), + persistent=False, + ) self.conv_pre_look_right = conv_pre_look_right self.f0_predictor = f0_predictor