[BugFix] Qwen2.5-Omni streaming code2wav input handling (#3396)

Signed-off-by: yinpeiqi <yinpeiqi809@gmail.com>
This commit is contained in:
Peiqi Yin authored and GitHub committed 2026-05-07 11:00:20 +08:00
1 parent 3c85ca5536
commit 5d4b16e6e3
3 files changed
+31 -3

No files matched your search

@@ -51,6 +51,7 @@ QWEN2_5_OMNI_PIPELINE = PipelineConfig(
final_output=True,
final_output_type="audio",
engine_output_type="audio",
custom_process_input_func=f"{_PROC}.talker2code2wav",
sampling_constraints={"detokenize": True},
),
),
@@ -351,10 +351,12 @@ class Qwen2_5OmniForConditionalGeneration(
)
)
code = code[:-1] if code[-1] == TALKER_CODEC_EOS_TOKEN_ID else code
code = code[1:] if code[0] == TALKER_CODEC_BOS_TOKEN_ID else code
if code.numel() and code[-1] == TALKER_CODEC_EOS_TOKEN_ID:
code = code[:-1]
if code.numel() and code[0] == TALKER_CODEC_BOS_TOKEN_ID:
code = code[1:]
audio_tensor = self.generate_audio(code, voice_type)
audio_tensor = self.generate_audio(code, voice_type) if code.numel() else torch.zeros(0, device=code.device)
return OmniOutput(text_hidden_states=None, multimodal_outputs={"model_outputs": audio_tensor})
return OmniOutput(