[Bugfix] Allow Fish Speech phoneme-control tokens through normalize_fish_speech_text (#7043)

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
This commit is contained in:
Pujitha PaladuguandPujitha Paladugu authored and GitHub committed 2026-09-14 10:02:39 -07:00
1 parent 40f8e94400
commit 5f25d98652
3 files changed
+31 -1

No files matched your search

@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""Shared Fish Speech prompt construction helpers."""
from __future__ import annotations
@@ -11,6 +14,7 @@ FISH_CLONE_SYSTEM_PROMPT_SUFFIX = "\n\nSpeech:\n"
_LEGACY_SPEAKER_TAG_PATTERN = re.compile(r"<speaker:(\d+)>")
_CANONICAL_SPEAKER_TAG_PATTERN = re.compile(r"<\|speaker:\d+\|>")
_PHONEME_TAG_PATTERN = re.compile(r"<\|phoneme_(?:start|end)\|>")
_CONTROL_TOKEN_PATTERN = re.compile(r"<\|[^>]+\|>")
@@ -21,7 +25,7 @@ def normalize_fish_speech_text(text: str, *, add_default_speaker: bool = False)
disallowed_tokens = [
token
for token in _CONTROL_TOKEN_PATTERN.findall(normalized)
if not _CANONICAL_SPEAKER_TAG_PATTERN.fullmatch(token)
if not (_CANONICAL_SPEAKER_TAG_PATTERN.fullmatch(token) or _PHONEME_TAG_PATTERN.fullmatch(token))
]
if disallowed_tokens:
disallowed_list = ", ".join(sorted(set(disallowed_tokens)))