vertebrae.extractors.huggingface_audio

Optional Hugging Face audio embedding extractor.

Classes

HFAudioExtractor

Hugging Face audio backbone extractor with explicit pooling.

Module Contents

class vertebrae.extractors.huggingface_audio.HFAudioExtractor(name, model_id, processor_id=None, pooling='mean', hidden_layer=None, outputs=None, structured_outputs=None, batch_size=16, sampling_rate=None, device=None, revision=None, trust_remote_code=False, processor_kwargs=None, model_kwargs=None, checkpoint_paths=None, feature_mask_fn=None, cache_identity=None)[source]

Hugging Face audio backbone extractor with explicit pooling.

Parameters:
  • name (str) – User-facing extractor name.

  • model_id (str) – Hugging Face model identifier or local path.

  • processor_id (Optional[str]) – Optional Hugging Face processor identifier or local path. Defaults to model_id.

  • pooling (str) – Pooling mode: “mean”, “cls”, or “pooler”.

  • hidden_layer (Optional[int]) – Optional hidden-state layer index to pool from. Defaults to the model’s final output.

  • batch_size (int) – Number of audio clips encoded per batch.

  • sampling_rate (Optional[int]) – Default sampling rate for array inputs.

  • device (Optional[str]) – Optional device string.

  • revision (Optional[str]) – Optional model revision.

  • trust_remote_code (bool) – Whether to allow remote model code.

  • processor_kwargs (Optional[Dict[str, Any]]) – Extra keyword arguments for the processor.

  • model_kwargs (Optional[Dict[str, Any]]) – Extra keyword arguments for AutoModel.

  • outputs (Optional[List[Dict[str, Any]]])

  • structured_outputs (Optional[List[Dict[str, Any]]])

  • checkpoint_paths (Optional[List[str]])

  • feature_mask_fn (Optional[Callable[[int, Any], Any]])

  • cache_identity (Optional[str])

fit(X, y=None)[source]

No-op fit for frozen Hugging Face audio models.

Parameters:
  • X (Any)

  • y (Any)

Return type:

HFAudioExtractor

transform(X)[source]

Encode audio inputs into dense embeddings.

Parameters:

X (Any)

Return type:

numpy.ndarray

fit_transform(X, y=None)[source]

Encode audio inputs into dense embeddings.

Parameters:
  • X (Any)

  • y (Any)

Return type:

numpy.ndarray

recipe()[source]

Return a serializable Hugging Face audio recipe.

Return type:

Dict[str, Any]