vllm.model_executor.models.moss_audio
¶
Inference-only MOSS-Audio model compatible with HuggingFace weights.
Classes:
-
MossAudioAudioInputs–Dimensions:
-
MossAudioModel– -
MossAudioProcessor–
MossAudioAudioInputs
¶
MossAudioModel
¶
Bases: Module, SupportsMultiModal, SupportsPP, SupportsLoRA
_parse_and_validate_audio_input(**kwargs)
¶
Normalize and validate model-side audio kwargs.
If audio_data is provided, this checks that audio_data_seqlens is also present, flattens sequence lengths to a long tensor, pads list inputs to [batch, mel_dim, time], validates batch-size/sequence-length agreement, and rejects empty, non-positive, or downsampled-zero audio lengths.
_process_audio_input(audio_input)
¶
Run the audio encoder and return one embedding tensor per audio.
Example
audio_data=[2, 128, 1200], audio_data_seqlens=[800, 1200] -> returns (audio0_embeds, audio1_embeds), split by token length -> DeepStack packs each item as [main, layer0, ...] on dim -1
_split_multimodal_embeddings(multimodal_embeddings, hidden_size)
¶
Unpack audio embeddings before merging them into token embeddings.
embed_input_ids calls this on the output of embed_multimodal. Plain audio embeddings already have width hidden_size and are returned as the main embeddings for _merge_multimodal_embeddings. When DeepStack is enabled, _process_audio_input packs each audio item as [main, layer0, layer1, ...] along the last dimension so the standard multimodal path can carry a single embedding object. This method splits that packed layout back into main embeddings plus per-layer DeepStack embeddings, which _cache_deepstack_input_embeds scatters and forward passes into MossQwen3Model for layer injection.
MossAudioProcessor
¶
Methods:
-
__call__–Build text tokens and audio tensors for one MossAudio prompt.
__call__(text=None, audios=None, audio=None, return_tensors='pt', **kwargs)
¶
Build text tokens and audio tensors for one MossAudio prompt.
Example
text="Describe this.", audio=[waveform] -> input_ids contains audio_start, N audio tokens, audio_end -> audio_data has shape [1, mel_dim, max_time] -> mel_dim is the number of mel filter-bank bins, 128 by default -> audio_data_seqlens stores the unpadded mel length
_ensure_moss_audio_placeholder_tokens(tokenizer)
¶
Register the audio placeholder tokens if the tokenizer lacks them.
The MOSS-Audio hub tokenizer does not define the audio placeholder tokens (the reference HF processor patches them in at runtime). Left as plain text, they merge with adjacent tokens under BPE, so prompts no longer contain a stable token sequence for prompt updates to match.