bridge.models.minicpmo.audio#

Adapt current Whisper attention to MiniCPM-o’s offline encoder contract.

Module Contents#

Classes#

MiniCPMOAudioAttention

Keep HF attention math and parameter names with a legacy return tuple.

API#

class bridge.models.minicpmo.audio.MiniCPMOAudioAttention#

Bases: transformers.models.whisper.modeling_whisper.WhisperAttention

Keep HF attention math and parameter names with a legacy return tuple.

MiniCPM-o 4.5’s encoder layer unpacks three values, whereas current HF Whisper returns two. Offline understanding does not consume a KV cache.

forward(
hidden_states: torch.Tensor,
*,
past_key_value: Any = None,
past_key_values: Any = None,
layer_head_mask: torch.Tensor | None = None,
**kwargs: Any,
) → tuple[torch.Tensor, torch.Tensor | None, None]#

Return the native attention outputs plus an unused cache slot.