EmbeddingGemma2AudioConverter

[source]

EmbeddingGemma2AudioConverter class

keras_hub.layers.EmbeddingGemma2AudioConverter(
    num_mels=128,
    num_fft_bins=512,
    stride=160,
    sampling_rate=16000,
    max_audio_length=30,
    min_frequency=0.0,
    max_frequency=8000.0,
    mel_floor=1e-05,
    per_bin_mean=None,
    per_bin_stddev=None,
    frame_length=320,
    **kwargs
)

EmbeddingGemma2 audio converter.

This converter is a subclass of Gemma4AudioConverter and shares the same functionality.


[source]

from_preset method

EmbeddingGemma2AudioConverter.from_preset(preset, **kwargs)

Instantiate a keras_hub.layers.AudioConverter from a model preset.

A preset is a directory of configs, weights and other file assets used to save and load a pre-trained model. The preset can be passed as one of:

  1. a built-in preset identifier like 'whisper_base_en'
  2. a Kaggle Models handle like 'kaggle://user/whisper/keras/whisper_base_en'
  3. a Hugging Face handle like 'hf://user/whisper_base_en'
  4. a path to a local preset directory like './whisper_base_en'

You can run cls.presets.keys() to list all built-in presets available on the class.

This constructor can be called in one of two ways. Either from the base class like keras_hub.models.AudioConverter.from_preset(), or from a model class like keras_hub.models.WhisperAudioConverter.from_preset(). If calling from the base class, the subclass of the returning object will be inferred from the config in the preset directory.

Arguments

  • preset: string. A built-in preset identifier, a Kaggle Models handle, a Hugging Face handle, or a path to a local directory.
  • load_weights: bool. If True, the weights will be loaded into the model architecture. If False, the weights will be randomly initialized.

Examples

# Load an audio converter from a preset.
converter = keras_hub.layers.AudioConverter.from_preset(
    "whisper_base_en"
)
# Convert some raw mono channel audio input.
converter(np.ones(2, 1_000))
Preset Parameters Description
embedding_gemma2 744.37M EmbeddingGemma 2: 744M-parameter, 24-layer multimodal embedding model built on Gemma 4. Embeds text, images, video and audio into a 768-dimensional space.