A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[Bugfix] MiDashengLM model contact error under concurrent testing (#24738)
Signed-off-by: chenbing8 <chenbing8@xiaomi.com> Signed-off-by: bingchen-mi <chenbing8@xiaomi.com>
bingchen-mi committed
Sep 15, 2025 at 14:38 UTC
a8c0f599734d169f7fdac69dc9a09539d508a751
1 file changed
+17
-11
vllm/model_executor/models/midashenglm.py
+17
-11
@@ -497,8 +497,11 @@ class MiDashengLMDummyInputsBuilder(
497
498
hf_processor = self.info.get_hf_processor()
499
audio_token = hf_processor.audio_token
500
+ audio_bos_token = hf_processor.audio_bos_token
501
+ audio_eos_token = hf_processor.audio_eos_token
502
501
- return audio_token * num_audios
503
+ single_audio_text = f"{audio_bos_token}{audio_token}{audio_eos_token}"
504
+ return single_audio_text * num_audios
505
506
def get_dummy_mm_data(
507
self,
@@ -577,14 +580,7 @@ class MiDashengLMMultiModalProcessor(
580
vocab = tokenizer.get_vocab()
581
582
audio_token = getattr(processor, "audio_token", "<|AUDIO|>")
580
- audio_bos_token = getattr(processor, "audio_bos_token",
581
- "<|audio_bos|>")
582
- audio_eos_token = getattr(processor, "audio_eos_token",
583
- "<|audio_eos|>")
584
-
583
audio_token_id = vocab[audio_token]
586
- audio_bos_id = vocab[audio_bos_token]
587
- audio_eos_id = vocab[audio_eos_token]
584
585
out_mm_data = out_mm_kwargs.get_data()
586
audio_length = out_mm_data.get("audio_length")
@@ -604,7 +600,7 @@ class MiDashengLMMultiModalProcessor(
600
audio_tokens = [audio_token_id] * num_features
601
602
return PromptUpdateDetails.select_token_id(
607
- [audio_bos_id] + audio_tokens + [audio_eos_id],
603
+ audio_tokens,
604
embed_token_id=audio_token_id,
605
)
606
@@ -670,8 +666,18 @@ class MiDashengLMModel(nn.Module, SupportsMultiModal, SupportsPP):
666
f"Got type: {type(mm_input)}")
667
if isinstance(mm_input, torch.Tensor):
668
return mm_input.reshape(-1, *mm_input.shape[2:])
673
- else:
674
- return torch.concat(mm_input)
669
+
670
+ if name == "input_values":
671
+ max_length = max(tensor.shape[1] for tensor in mm_input)
672
+ padded_mm_input = [
673
+ torch.nn.functional.pad(tensor,
674
+ (0, max_length - tensor.shape[1]))
675
+ if tensor.shape[1] < max_length else tensor
676
+ for tensor in mm_input
677
+ ]
678
+ return torch.concat(padded_mm_input)
679
+
680
+ return torch.concat(mm_input)
681
682
def _parse_and_validate_audio_input(
683
self, **kwargs: object) -> Optional[MiDashengLMAudioInputs]: