Wav2Vec2 Conformer Model Components (wav2vec2_conformer/modular_wav2vec2_conformer.py)

transformers · src/transformers/models/wav2vec2_conformer/modular_wav2vec2_conformer.py · python · Apache-2.0
ai, voice, fw:pytorch, tag:transformer

Implements modular Wav2Vec2 Conformer encoder layers, attention mechanisms, and feature projection for speech processing. Reuse when building custom speech recognition architectures.

# Source: https://github.com/huggingface/transformers | License: Apache-2.0 | Copyright 2018- The Hugging Face team. All rights reserved
# Provided via justclaw.it.com; keep this notice with the code.
import math
from collections.abc import Callable
from dataclasses import dataclass

import torch
from torch import nn

from ... import initialization as init
from ...activations import ACT2FN
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from ...integrations.fsdp import is_fsdp_managed_module
from ...masking_utils import create_bidirectional_mask
from ...modeling_layers import GradientCheckpointingLayer
from ...modeling_outputs import BaseModelOutput, Wav2Vec2BaseModelOutput
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...processing_utils impo

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key