[BugFix] fix hunyuan image3 offline cot (#4174)

Signed-off-by: zzh <943967662@qq.com>
Signed-off-by: zengchuang <zengchuang3@huawei.com>
Co-authored-by: zengchuang <zengchuang3@huawei.com>
Co-authored-by: Canlin Guo <canlinguosdu@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-06-08 10:58:44 +08:00
1 parent 29b18ea298
commit eb1b782dd1
3 files changed
+7

No files matched your search

@@ -1457,6 +1457,7 @@ class HunyuanImage3ForConditionalGeneration(nn.Module, SupportsMultiModal, Suppo
HunyuanImage3Inputs: TypeAlias = HunyuanImage3PixelInputs
prefer_model_sampler = True
logitsprocs_need_output_token_ids = True
# Siglip2 ViT supports data-parallel encoding (mm_encoder_tp_mode="data"):
# weights are replicated and the image batch is sharded across TP ranks.
@@ -33,6 +33,7 @@ class OmniNPUModelRunner(OmniGPUModelRunner, NPUModelRunner):
# in _pad_for_sequence_parallelism during execute_model.
# This is a workaround for vllm-ascend not passing vllm_config to enable_sp().
enable_sp(self.vllm_config)
self._maybe_enable_output_token_ids_for_model_sampler()
self._init_talker_mtp()
@torch.inference_mode()
+5
View File
@@ -143,9 +143,14 @@ class OmniGPUModelRunner(GPUModelRunner):
@instrument(span_name="Loading (GPU)")
def load_model(self, *args, **kwargs) -> None:
super().load_model(*args, **kwargs)
self._maybe_enable_output_token_ids_for_model_sampler()
self._init_talker_mtp()
self._prewarm_attention_capture_workspaces()
def _maybe_enable_output_token_ids_for_model_sampler(self) -> None:
if getattr(self.model, "logitsprocs_need_output_token_ids", False):
self.input_batch.logitsprocs_need_output_token_ids = True
def _init_talker_mtp(self) -> None:
# TODO move this model specific logic to a separate class
# TTS model IS the talker (no .talker sub-attr); use getattr to support both Omni and TTS.