vllm.model_executor.models.glmasr
¶
Classes:
-
GlmAsrDummyInputsBuilder–Builder for dummy inputs used in profiling and testing.
-
GlmAsrEmbeddingInputs–Dimensions:
-
GlmAsrEncoder–Optimized GLM-ASR Audio Encoder with vLLM native implementation.
-
GlmAsrEncoderAttention–Optimized Multi-headed Grouped Query Attention for GLM-ASR encoder.
-
GlmAsrEncoderLayer–Optimized Transformer encoder layer for GLM-ASR.
-
GlmAsrEncoderMLP–Optimized MLP for GLM-ASR encoder.
-
GlmAsrEncoderRotaryEmbedding–Rotary Position Embedding for GLM-ASR encoder.
-
GlmAsrFeatureInputs–Dimensions:
-
GlmAsrForConditionalGeneration– -
GlmAsrMultiModalDataParser–Custom parser for GLM-ASR multimodal data.
-
GlmAsrMultiModalProcessor–GLM-ASR processor that inherits directly from BaseMultiModalProcessor
-
GlmAsrMultiModalProjector–Projects audio encoder outputs to language model hidden space.
-
GlmAsrProcessingInfo–Processing information provider for GLM-ASR model.
GlmAsrDummyInputsBuilder
¶
Bases: BaseDummyInputsBuilder[GlmAsrProcessingInfo]
Builder for dummy inputs used in profiling and testing.
Generates dummy text prompts and audio data that match the expected format for GLM-ASR model inputs. Used for memory profiling and performance benchmarking.
GlmAsrEmbeddingInputs
¶
Bases: TensorSchema
Dimensions: - bn: Batch size - naf: Number of audio features - hs: Hidden size (must match the hidden size of language model backbone)
GlmAsrEncoder
¶
Bases: Module
Optimized GLM-ASR Audio Encoder with vLLM native implementation.
This encoder processes audio features through convolutional layers followed by transformer layers with rotary position embeddings. Optimized for performance with: - QKVParallelLinear for fused attention projections - Tensor parallelism support via ColumnParallelLinear/RowParallelLinear - Quantization support - Flash Attention (SDPA)
Methods:
-
forward–Forward pass through the encoder.
_get_feat_extract_output_lengths(input_lengths)
¶
forward(input_features)
¶
Forward pass through the encoder.
Parameters:
Returns:
-
_GlmAsrEncoderOutput(_GlmAsrEncoderOutput) –Object with .last_hidden_state attribute containing [batch_size, seq_len', hidden_size] where seq_len' is the sequence length after convolutions
GlmAsrEncoderAttention
¶
Bases: Module
Optimized Multi-headed Grouped Query Attention for GLM-ASR encoder.
Uses vLLM's QKVParallelLinear for fused projections, ApplyRotaryEmb for rotary position embeddings, and MMEncoderAttention for hardware-optimized attention computation with automatic backend selection.
Methods:
-
forward–Args:
forward(hidden_states, rotary_pos_emb_cos, rotary_pos_emb_sin)
¶
GlmAsrEncoderLayer
¶
GlmAsrEncoderMLP
¶
Bases: Module
Optimized MLP for GLM-ASR encoder. Uses vLLM's parallel linear layers for better performance.
GlmAsrEncoderRotaryEmbedding
¶
Bases: Module
Rotary Position Embedding for GLM-ASR encoder.
Computes rotary position embeddings on-demand for efficiency. Only caches inv_freq as a buffer; cos/sin are computed during forward to avoid wasted computation during initialization and ensure correct device placement.
Methods:
-
forward–Compute rotary position frequencies for given sequence length.
GlmAsrFeatureInputs
¶
Bases: TensorSchema
Dimensions: - num_chunks: Number of audio chunks (flattened) - nmb: Number of mel bins - num_audios: Number of original audio files
GlmAsrForConditionalGeneration
¶
Bases: Module, SupportsMultiModal, SupportsPP, SupportsLoRA, SupportsTranscription
Methods:
-
get_generation_prompt–Get the generation prompt to be used for transcription requests.
GlmAsrMultiModalDataParser
¶
Bases: MultiModalDataParser
Custom parser for GLM-ASR multimodal data.
Extends the base parser to handle GLM-ASR specific audio data formats, including both pre-computed audio embeddings and raw audio features.
GlmAsrMultiModalProcessor
¶
Bases: BaseMultiModalProcessor['GlmAsrProcessingInfo']
GLM-ASR processor that inherits directly from BaseMultiModalProcessor for better performance and cleaner implementation.
GlmAsrMultiModalProjector
¶
Bases: Module
Projects audio encoder outputs to language model hidden space.
This projector uses a two-layer MLP to map audio features from the encoder's intermediate size to the language model's hidden size. Uses vLLM's parallel linear layers for tensor parallelism support.
Architecture
- Linear layer: intermediate_size -> hidden_size * 2
- Activation function (e.g., GELU)
- Linear layer: hidden_size * 2 -> hidden_size
GlmAsrProcessingInfo
¶
Bases: BaseProcessingInfo
Processing information provider for GLM-ASR model.
Provides access to model configuration, processor, and feature extractor needed for audio preprocessing and multimodal integration.
_GlmAsrEncoderOutput
¶
Simple output container compatible with transformers' BaseModelOutput.
This lightweight container holds the encoder output and is compatible with the transformers library's output format while being more efficient than a full dataclass.
Attributes:
-
last_hidden_state–Final layer hidden states from the encoder. Shape: [batch_size, seq_len, hidden_size]
_glmasr_field_config(hf_inputs)
¶
Configure multimodal field batching strategy for GLM-ASR.
Determines how to batch audio inputs based on whether chunking is used. When chunk_counts is present, features are flattened across chunks; otherwise, they are batched normally.
Parameters:
Returns:
-
dict[str, MultiModalFieldConfig]–Dictionary mapping field names to MultiModalFieldConfig objects that specify batching behavior.