[Bugfix][Model] Fix Qwen3-TTS Code2Wav max_model_len validation (#2508)

Signed-off-by: greenhandzpx <px.tsang@foxmail.com>
Co-authored-by: greenhandzpx <px.tsang@foxmail.com>
This commit is contained in:
Greenhand Tsangandgreenhandzpx authored and GitHub committed 2026-04-22 03:35:39 +00:00
1 parent e6cf26efb7
commit 2903f528d2
2 files changed
+42

No files matched your search

+7
View File
@@ -246,6 +246,13 @@ class OmniEngineArgs(EngineArgs):
if model_type is not None:
self.hf_overrides.setdefault("model_type", model_type)
# Stage wrappers (e.g. Code2Wav) may need max_model_len larger
# than the base checkpoint's text max_position_embeddings.
if self.model_arch == "Qwen3TTSCode2Wav" and self.max_model_len is not None:
self.hf_overrides.setdefault("talker_config", {}).setdefault(
"max_position_embeddings", int(self.max_model_len)
)
# For models whose HF config.json is empty or lacks model_type
# (e.g. CosyVoice3), AutoConfig.from_pretrained fails because it
# cannot determine which config class to use from the empty dict.