id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,000 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/tokenization_vits.py | transformers.models.vits.tokenization_vits.VitsTokenizer | from ...utils import is_phonemizer_available, is_uroman_available, logging
import os
import re
import json
from ...tokenization_utils import PreTrainedTokenizer
from typing import Any, Optional, Union
class VitsTokenizer(PreTrainedTokenizer):
"""
Construct a VITS tokenizer. Also supports MMS-TTS.
This tok... |
class VitsTokenizer(PreTrainedTokenizer):
'''
Construct a VITS tokenizer. Also supports MMS-TTS.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab_file... | 13 | 7 | 15 | 2 | 10 | 2 | 2 | 0.38 | 1 | 8 | 0 | 0 | 11 | 7 | 11 | 100 | 197 | 34 | 118 | 48 | 92 | 45 | 79 | 32 | 67 | 8 | 3 | 3 | 27 |
6,001 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/configuration_vivit.py | transformers.models.vivit.configuration_vivit.VivitConfig | from ...configuration_utils import PretrainedConfig
class VivitConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VivitModel`]. It is used to instantiate a ViViT
model according to the specified arguments, defining the model architecture. Instantiating a configu... |
class VivitConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VivitModel`]. It is used to instantiate a ViViT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar co... | 2 | 1 | 35 | 2 | 33 | 0 | 1 | 1.34 | 1 | 1 | 0 | 0 | 1 | 14 | 1 | 1 | 93 | 11 | 35 | 34 | 16 | 47 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
6,002 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/image_processing_vivit.py | transformers.models.vivit.image_processing_vivit.VivitImageProcessor | import numpy as np
from ...utils import filter_out_non_signature_kwargs, logging
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, is_valid_image, to_numpy_array, valid_images, validate_preprocess_... |
class VivitImageProcessor(BaseImageProcessor):
'''
Constructs a Vivit image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
`do_resize` parameter i... | 7 | 5 | 58 | 5 | 36 | 17 | 6 | 0.67 | 1 | 9 | 2 | 0 | 5 | 11 | 5 | 25 | 339 | 30 | 185 | 85 | 115 | 124 | 70 | 21 | 64 | 13 | 3 | 1 | 31 |
6,003 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitAttention | from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
import torch
from .configuration_vivit import VivitConfig
from torch import nn
from typing import Callable, Optional
class VivitAttention(nn.Module):
def __init__(self, config: VivitConfig):
super().__init__()
self.a... |
class VivitAttention(nn.Module):
def __init__(self, config: VivitConfig):
pass
def prune_heads(self, heads: set[int]):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 4 | 0 | 11 | 1 | 9 | 1 | 1 | 0.1 | 1 | 8 | 3 | 1 | 3 | 3 | 3 | 13 | 37 | 6 | 29 | 16 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
6,004 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitEmbeddings | from .configuration_vivit import VivitConfig
from torch import nn
import torch
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
class VivitEmbeddings(nn.Module):
"""
Vivit Embeddings.
Creates embeddings from a video using VivitTubeletEmbeddings, adds CLS token and positional emb... |
class VivitEmbeddings(nn.Module):
'''
Vivit Embeddings.
Creates embeddings from a video using VivitTubeletEmbeddings, adds CLS token and positional embeddings.
'''
def __init__(self, config: VivitConfig):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, w... | 4 | 2 | 22 | 5 | 14 | 3 | 2 | 0.33 | 1 | 5 | 1 | 0 | 3 | 6 | 3 | 13 | 77 | 20 | 43 | 21 | 39 | 14 | 35 | 21 | 31 | 2 | 1 | 1 | 5 |
6,005 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitEncoder | from typing import Callable, Optional
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
import torch
from .configuration_vivit import VivitConfig
class VivitEncoder(nn.Module):
def __init__(self, config: VivitConfig):
super().__init__()... |
class VivitEncoder(nn.Module):
def __init__(self, config: VivitConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> BaseModelOutput:
pass | 3 | 0 | 24 | 4 | 20 | 0 | 6 | 0 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 49 | 8 | 41 | 18 | 31 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
6,006 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitForVideoClassification | from typing import Callable, Optional
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
import torch
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from ...utils.generic import can_return_tuple, check_model_inputs
from ...processing_utils imp... | @auto_docstring(custom_intro="\n ViViT Transformer model with a video classification head on top (a linear layer on top of the final hidden state of the\n [CLS] token) e.g. for Kinetics-400.\n\n <Tip>\n\n Note that it's possible to fine-tune ViT on higher resolution images than the ones it h... | 6 | 1 | 70 | 13 | 22 | 36 | 4 | 1.51 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 144 | 26 | 47 | 22 | 33 | 71 | 23 | 12 | 20 | 6 | 2 | 2 | 8 |
6,007 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitIntermediate | from torch import nn
from ...activations import ACT2FN
from .configuration_vivit import VivitConfig
import torch
class VivitIntermediate(nn.Module):
def __init__(self, config: VivitConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
self.dropout... |
class VivitIntermediate(nn.Module):
def __init__(self, config: VivitConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 1 | 7 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 16 | 2 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
6,008 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitLayer | import torch
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_vivit import VivitConfig
from typing import Callable, Optional
class VivitLayer(GradientCheckpointingLayer):
"""This corresponds to the EncoderBlock class in the scenic/vivit implementation."""
def ... |
class VivitLayer(GradientCheckpointingLayer):
'''This corresponds to the EncoderBlock class in the scenic/vivit implementation.'''
def __init__(self, config: VivitConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 1 | 17 | 3 | 12 | 3 | 1 | 0.25 | 1 | 3 | 2 | 0 | 2 | 7 | 2 | 12 | 37 | 7 | 24 | 14 | 21 | 6 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
6,009 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitModel | from torch import nn
from typing import Callable, Optional
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
import torch
from .configuration_vivit import VivitConfig
from ...utils.generic import can_return_tuple, check_model_inputs
from ...processing_utils import Unpack
from ...modeling_outpu... | @auto_docstring
class VivitModel(VivitPreTrainedModel):
def __init__(self, config: VivitConfig, add_pooling_layer: bool=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(self):
... | 8 | 3 | 36 | 6 | 12 | 17 | 3 | 1.33 | 1 | 7 | 4 | 0 | 4 | 5 | 4 | 5 | 148 | 27 | 52 | 24 | 37 | 69 | 29 | 15 | 24 | 7 | 2 | 1 | 12 |
6,010 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitOutput | from .configuration_vivit import VivitConfig
import torch
from torch import nn
class VivitOutput(nn.Module):
def __init__(self, config: VivitConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob... |
class VivitOutput(nn.Module):
def __init__(self, config: VivitConfig):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 2 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 14 | 4 | 10 | 5 | 7 | 0 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
6,011 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitPooler | from .configuration_vivit import VivitConfig
from torch import nn
import torch
class VivitPooler(nn.Module):
def __init__(self, config: VivitConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_... |
class VivitPooler(nn.Module):
def __init__(self, config: VivitConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
6,012 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitPreTrainedModel | from torch import nn
from .configuration_vivit import VivitConfig
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class VivitPreTrainedModel(PreTrainedModel):
config: VivitConfig
base_model_prefix... | @auto_docstring
class VivitPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 17 | 0 | 14 | 3 | 7 | 0.33 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 30 | 2 | 21 | 8 | 19 | 7 | 18 | 8 | 16 | 7 | 1 | 2 | 7 |
6,013 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitSelfAttention | from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional
import torch
from .configuration_vivit import VivitConfig
class VivitSelfAttention(nn.Module):
def __init__(self, config: VivitConfig):
super().__init__()
if config.hid... |
class VivitSelfAttention(nn.Module):
def __init__(self, config: VivitConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 0 | 18 | 4 | 12 | 2 | 2 | 0.13 | 1 | 6 | 1 | 1 | 3 | 7 | 3 | 13 | 58 | 15 | 38 | 23 | 32 | 5 | 33 | 21 | 29 | 3 | 1 | 1 | 6 |
6,014 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitSelfOutput | from .configuration_vivit import VivitConfig
import torch
from torch import nn
class VivitSelfOutput(nn.Module):
"""
The residual connection is defined in VivitLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, config: V... |
class VivitSelfOutput(nn.Module):
'''
The residual connection is defined in VivitLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: VivitConfig):
pass
def forward(self, hidden_states: torch.Tensor, i... | 3 | 1 | 5 | 1 | 4 | 0 | 1 | 0.44 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 16 | 3 | 9 | 5 | 6 | 4 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
6,015 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vivit/modeling_vivit.py | transformers.models.vivit.modeling_vivit.VivitTubeletEmbeddings | from .configuration_vivit import VivitConfig
import torch
from torch import nn
class VivitTubeletEmbeddings(nn.Module):
"""
Construct Vivit Tubelet embeddings.
This module turns a batch of videos of shape (batch_size, num_frames, num_channels, height, width) into a tensor of
shape (batch_size, seq_len... |
class VivitTubeletEmbeddings(nn.Module):
'''
Construct Vivit Tubelet embeddings.
This module turns a batch of videos of shape (batch_size, num_frames, num_channels, height, width) into a tensor of
shape (batch_size, seq_len, hidden_size) to be consumed by a Transformer encoder.
The seq_len (the num... | 3 | 1 | 16 | 2 | 13 | 2 | 2 | 0.38 | 1 | 3 | 0 | 0 | 2 | 6 | 2 | 12 | 43 | 7 | 26 | 11 | 23 | 10 | 17 | 11 | 14 | 2 | 1 | 1 | 3 |
6,016 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/configuration_wav2vec2.py | transformers.models.wav2vec2.configuration_wav2vec2.Wav2Vec2Config | import operator
from ...configuration_utils import PretrainedConfig
import functools
class Wav2Vec2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Wav2Vec2Model`]. It is used to instantiate an
Wav2Vec2 model according to the specified arguments, defining the ... | null | 4 | 1 | 70 | 4 | 63 | 3 | 2 | 1.33 | 1 | 3 | 0 | 0 | 2 | 53 | 2 | 2 | 318 | 18 | 129 | 116 | 67 | 171 | 61 | 57 | 58 | 2 | 1 | 1 | 3 |
6,017 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/feature_extraction_wav2vec2.py | transformers.models.wav2vec2.feature_extraction_wav2vec2.Wav2Vec2FeatureExtractor | from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
from typing import Optional, Union
import numpy as np
class Wav2Vec2FeatureExtractor(SequenceFeatureExtractor):
"""
Constructs... |
class Wav2Vec2FeatureExtractor(SequenceFeatureExtractor):
'''
Constructs a Wav2Vec2 feature extractor.
This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains
most of the main methods. Users should refer to this superclass for more information... | 5 | 3 | 57 | 8 | 31 | 18 | 6 | 0.84 | 1 | 10 | 1 | 0 | 2 | 2 | 3 | 20 | 210 | 33 | 96 | 38 | 70 | 81 | 44 | 16 | 40 | 12 | 3 | 3 | 17 |
6,018 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.AMSoftmaxLoss | from torch import nn
import torch
class AMSoftmaxLoss(nn.Module):
def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4):
super().__init__()
self.scale = scale
self.margin = margin
self.num_labels = num_labels
self.weight = nn.Parameter(torch.randn(input_dim, num... |
class AMSoftmaxLoss(nn.Module):
def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4):
pass
def forward(self, hidden_states, labels):
pass | 3 | 0 | 10 | 1 | 9 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 21 | 3 | 18 | 14 | 15 | 0 | 18 | 14 | 15 | 1 | 1 | 0 | 2 |
6,019 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.TDNNLayer | from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__... |
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 14 | 2 | 11 | 1 | 3 | 0.04 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 29 | 5 | 23 | 11 | 19 | 1 | 20 | 11 | 16 | 3 | 1 | 2 | 5 |
6,020 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2Adapter | from torch import nn
import numpy as np
class Wav2Vec2Adapter(nn.Module):
def __init__(self, config):
super().__init__()
if config.output_hidden_size != config.hidden_size:
self.proj = nn.Linear(config.hidden_size, config.output_hidden_size)
self.proj_layer_norm = nn.LayerN... |
class Wav2Vec2Adapter(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 14 | 3 | 10 | 1 | 3 | 0.1 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 29 | 6 | 21 | 9 | 18 | 2 | 20 | 9 | 17 | 4 | 1 | 2 | 6 |
6,021 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2AdapterLayer | from torch import nn
class Wav2Vec2AdapterLayer(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.output_hidden_size, 2 * config.output_hidden_size, config.adapter_kernel_size, stride=config.adapter_stride, padding=1)
def forward(self, hidden_states):
... |
class Wav2Vec2AdapterLayer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 1 | 7 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 16 | 2 | 14 | 4 | 11 | 0 | 8 | 4 | 5 | 1 | 1 | 0 | 2 |
6,022 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2Attention | from torch import nn
import torch
from .configuration_wav2vec2 import Wav2Vec2Config
from ...processing_utils import Unpack
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
from ...modeling_flash_attention_utils import FlashAttentionKwargs
class Wav2Ve... |
class Wav2Vec2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[Wav2Vec2Config]=None):
pass
def forward(s... | 3 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 2 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
6,023 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2AttnAdapterLayer | from torch import nn
import torch
class Wav2Vec2AttnAdapterLayer(nn.Module):
def __init__(self, config):
"""
Implements adapter modules directly with 3D tensor weight as parameters and without using ModuleList to speed
up training throughput.
"""
super().__init__()
... |
class Wav2Vec2AttnAdapterLayer(nn.Module):
def __init__(self, config):
'''
Implements adapter modules directly with 3D tensor weight as parameters and without using ModuleList to speed
up training throughput.
'''
pass
def forward(self, hidden_states: torch.FloatTensor)... | 3 | 1 | 11 | 2 | 7 | 2 | 1 | 0.27 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 23 | 4 | 15 | 9 | 12 | 4 | 15 | 9 | 12 | 1 | 1 | 0 | 2 |
6,024 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2Encoder | from torch import nn
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
import torch
from ...integrations.fsdp import is_fsdp_managed_module
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, MaskedLMOutput, SequenceClassifierOutput, TokenClassifierOutp... |
class Wav2Vec2Encoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.tensor, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=True):
pass
def _update_full_mask(self, attent... | 4 | 0 | 41 | 5 | 33 | 3 | 8 | 0.07 | 1 | 8 | 3 | 0 | 2 | 7 | 2 | 12 | 83 | 11 | 67 | 26 | 57 | 5 | 45 | 19 | 42 | 15 | 1 | 3 | 16 |
6,025 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2EncoderLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
class Wav2Vec2EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = Wav2Vec2Attention(embed_dim=config.hidden_size, num_heads=config.num_attention_heads, dropout=confi... |
class Wav2Vec2EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False):
pass | 3 | 0 | 16 | 3 | 13 | 0 | 2 | 0 | 1 | 2 | 1 | 0 | 2 | 5 | 2 | 12 | 33 | 6 | 27 | 11 | 24 | 0 | 20 | 11 | 17 | 2 | 1 | 1 | 3 |
6,026 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2EncoderLayerStableLayerNorm | from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
import torch
class Wav2Vec2EncoderLayerStableLayerNorm(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = Wav2Vec2Attention(embed_di... |
class Wav2Vec2EncoderLayerStableLayerNorm(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False):
pass | 3 | 0 | 21 | 3 | 18 | 0 | 3 | 0 | 1 | 5 | 2 | 0 | 2 | 6 | 2 | 12 | 43 | 6 | 37 | 17 | 29 | 0 | 24 | 12 | 21 | 3 | 1 | 1 | 5 |
6,027 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2EncoderStableLayerNorm | from typing import Callable, Optional, Union
from torch import nn
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
import torch
from ...integrations.fsdp import is_fsdp_managed_module
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, MaskedLMOutput, ... |
class Wav2Vec2EncoderStableLayerNorm(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True):
pass
def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inpu... | 4 | 0 | 43 | 6 | 34 | 3 | 8 | 0.09 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 87 | 12 | 69 | 27 | 59 | 6 | 45 | 19 | 42 | 15 | 1 | 3 | 16 |
6,028 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2FeatureEncoder | from torch import nn
class Wav2Vec2FeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
if config.feat_extract_norm == 'group':
conv_layers = [Wav2Vec2GroupNormConvLayer(config, layer_id=0)] + [Wav2Vec2NoLaye... |
class Wav2Vec2FeatureEncoder(nn.Module):
'''Construct the features from raw audio waveform'''
def __init__(self, config):
pass
def _freeze_parameters(self):
pass
def forward(self, input_values):
pass | 4 | 1 | 13 | 1 | 11 | 0 | 3 | 0.06 | 1 | 6 | 3 | 1 | 3 | 3 | 3 | 13 | 44 | 7 | 35 | 11 | 31 | 2 | 23 | 11 | 19 | 4 | 1 | 2 | 9 |
6,029 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2FeatureExtractor | import warnings
class Wav2Vec2FeatureExtractor(Wav2Vec2FeatureEncoder):
def __init__(self, config):
super().__init__(config)
warnings.warn(f'The class `{self.__class__.__name__}` has been depreciated and will be removed in Transformers v5. Use `{self.__class__.__bases__[0].__name__}` instead.', Fu... |
class Wav2Vec2FeatureExtractor(Wav2Vec2FeatureEncoder):
def __init__(self, config):
pass | 2 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 14 | 9 | 0 | 9 | 2 | 7 | 0 | 4 | 2 | 2 | 1 | 2 | 0 | 1 |
6,030 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2FeatureProjection | from torch import nn
class Wav2Vec2FeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.layer_norm_eps)
self.projection = nn.Linear(config.conv_dim[-1], config.hidden_size)
self.dropout = nn.Drop... |
class Wav2Vec2FeatureProjection(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.09 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 13 | 1 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
6,031 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2FeedForward | from torch import nn
from ...activations import ACT2FN
class Wav2Vec2FeedForward(nn.Module):
def __init__(self, config):
super().__init__()
self.intermediate_dropout = nn.Dropout(config.activation_dropout)
self.intermediate_dense = nn.Linear(config.hidden_size, config.intermediate_size)
... |
class Wav2Vec2FeedForward(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 2 | 9 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 4 | 18 | 8 | 15 | 0 | 17 | 8 | 14 | 2 | 1 | 1 | 3 |
6,032 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForAudioFrameClassification | from typing import Callable, Optional, Union
from torch.nn import CrossEntropyLoss
from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
from ...modelin... | @auto_docstring
class Wav2Vec2ForAudioFrameClassification(Wav2Vec2PreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_extractor(self):
'''
Calling this function will disable the gradient computation for the feature encoder so that its parameter will
not be upd... | 8 | 4 | 18 | 2 | 13 | 4 | 3 | 0.26 | 1 | 7 | 2 | 0 | 5 | 4 | 5 | 11 | 104 | 13 | 73 | 28 | 51 | 19 | 39 | 19 | 33 | 6 | 2 | 1 | 13 |
6,033 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForCTC | from typing import Callable, Optional, Union
from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutput, Caus... | @auto_docstring(custom_intro='\n Wav2Vec2 Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ')
class Wav2Vec2ForCTC(Wav2Vec2PreTrainedModel):
def __init__(self, config, target_lang: Optional[str]=None):
'''
target_lang (`str`, *optional*):
... | 9 | 6 | 23 | 3 | 14 | 6 | 3 | 0.35 | 1 | 8 | 2 | 0 | 6 | 4 | 6 | 12 | 149 | 22 | 94 | 33 | 71 | 33 | 47 | 24 | 40 | 7 | 2 | 2 | 18 |
6,034 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForMaskedLM | from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, MaskedLMOutput, SequenceClassifie... | @auto_docstring
class Wav2Vec2ForMaskedLM(Wav2Vec2PreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_values: torch.FloatTensor, attention_mask: Optional[torch.LongTensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None,... | 5 | 0 | 20 | 4 | 16 | 1 | 2 | 0.03 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 8 | 43 | 8 | 34 | 19 | 22 | 1 | 18 | 10 | 15 | 3 | 2 | 1 | 4 |
6,035 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTraining | from torch import nn
import warnings
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
import torch
from .configuration_wav2vec2 import Wav2Vec2Config
from typing import Callable, Optional, Union
@... | @auto_docstring(custom_intro='\n Wav2Vec2 Model with a quantizer and `VQ` head on top.\n ')
class Wav2Vec2ForPreTraining(Wav2Vec2PreTrainedModel):
def __init__(self, config: Wav2Vec2Config):
pass
def set_gumbel_temperature(self, temperature: int):
'''
Set the Gumbel softmax tempe... | 10 | 5 | 35 | 6 | 17 | 13 | 2 | 0.74 | 1 | 10 | 4 | 0 | 5 | 5 | 6 | 12 | 221 | 38 | 105 | 40 | 81 | 78 | 53 | 24 | 46 | 8 | 2 | 2 | 13 |
6,036 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput | from typing import Callable, Optional, Union
import torch
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
@dataclass
@auto_docstring(custom_intro='\n Output t... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`Wav2Vec2ForPreTraining`], with potential hidden states and attentions.\n ')
class Wav2Vec2ForPreTrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `sample_negative_indices` are passed, `torch.FloatTensor` of shape `(1,)`):
... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.89 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 39 | 4 | 9 | 9 | 8 | 26 | 9 | 9 | 8 | 0 | 1 | 0 | 0 |
6,037 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForSequenceClassification | from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, MaskedLMOutput, SequenceClassifie... | @auto_docstring(custom_intro='\n Wav2Vec2 Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like\n SUPERB Keyword Spotting.\n ')
class Wav2Vec2ForSequenceClassification(Wav2Vec2PreTrainedModel):
def __init__(self, config):
pass
def freeze_featu... | 8 | 4 | 20 | 2 | 14 | 4 | 3 | 0.24 | 1 | 7 | 2 | 0 | 5 | 4 | 5 | 11 | 115 | 14 | 82 | 31 | 59 | 20 | 46 | 22 | 40 | 8 | 2 | 1 | 15 |
6,038 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForXVector | from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, MaskedLMOutput, SequenceClassifie... | @auto_docstring(custom_intro='\n Wav2Vec2 Model with an XVector feature extraction head on top for tasks like Speaker Verification.\n ')
class Wav2Vec2ForXVector(Wav2Vec2PreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_extractor(self):
'''
Calling this functi... | 10 | 5 | 19 | 3 | 13 | 4 | 3 | 0.26 | 1 | 11 | 4 | 0 | 6 | 7 | 6 | 12 | 144 | 23 | 97 | 42 | 73 | 25 | 63 | 33 | 55 | 10 | 2 | 2 | 19 |
6,039 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2GroupNormConvLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from ...activations import ACT2FN
class Wav2Vec2GroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0... |
class Wav2Vec2GroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 1 | 9 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 3 | 19 | 8 | 16 | 0 | 13 | 8 | 10 | 2 | 1 | 0 | 3 |
6,040 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2GumbelVectorQuantizer | from torch import nn
import torch
class Wav2Vec2GumbelVectorQuantizer(nn.Module):
"""
Vector quantization using gumbel softmax. See `[CATEGORICAL REPARAMETERIZATION WITH
GUMBEL-SOFTMAX](https://huggingface.co/papers/1611.01144) for more information.
"""
def __init__(self, config):
super().... |
class Wav2Vec2GumbelVectorQuantizer(nn.Module):
'''
Vector quantization using gumbel softmax. See `[CATEGORICAL REPARAMETERIZATION WITH
GUMBEL-SOFTMAX](https://huggingface.co/papers/1611.01144) for more information.
'''
def __init__(self, config):
pass
@staticmethod
def _compute_pe... | 5 | 1 | 22 | 3 | 16 | 3 | 2 | 0.24 | 1 | 2 | 0 | 0 | 2 | 5 | 3 | 13 | 74 | 13 | 49 | 20 | 44 | 12 | 35 | 19 | 31 | 2 | 1 | 1 | 6 |
6,041 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2LayerNormConvLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from ...activations import ACT2FN
class Wav2Vec2LayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0... |
class Wav2Vec2LayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 12 | 2 | 10 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 25 | 4 | 21 | 8 | 18 | 0 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
6,042 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2Model | from typing import Callable, Optional, Union
from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_available, logging
from .configuration_wav2vec2 import Wav2Vec2Config
fr... | @auto_docstring
class Wav2Vec2Model(Wav2Vec2PreTrainedModel):
def __init__(self, config: Wav2Vec2Config):
pass
def freeze_feature_extractor(self):
'''
Calling this function will disable the gradient computation for the feature encoder so that its parameters will
not be updated ... | 8 | 4 | 26 | 3 | 19 | 4 | 4 | 0.18 | 1 | 11 | 7 | 0 | 5 | 6 | 5 | 11 | 145 | 21 | 105 | 31 | 78 | 19 | 50 | 17 | 44 | 7 | 2 | 1 | 18 |
6,043 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2NoLayerNormConvLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from ...activations import ACT2FN
class Wav2Vec2NoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id >... |
class Wav2Vec2NoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 19 | 2 | 17 | 7 | 14 | 0 | 11 | 7 | 8 | 2 | 1 | 0 | 3 |
6,044 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2PositionalConvEmbedding | from torch import nn
from ...activations import ACT2FN
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
class Wav2Vec2PositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_size=config.... |
class Wav2Vec2PositionalConvEmbedding(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 21 | 3 | 18 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 43 | 7 | 36 | 10 | 32 | 0 | 28 | 10 | 24 | 4 | 1 | 2 | 5 |
6,045 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2PreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
from torch import nn
import warnings
import torch
from ...utils import ModelOutput, auto_docstring, cached_file, check_torch_load_is_safe, is_peft_available, is_safetensors_available, is_torch_flex_attn_a... | @auto_docstring
class Wav2Vec2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _get_feat_extract_output_lengths(self, input_lengths: Union[torch.LongTensor, int], add_adapter: Optional[bool]=None):
'''
Computes the output ... | 9 | 4 | 43 | 6 | 25 | 11 | 6 | 0.45 | 1 | 15 | 6 | 7 | 6 | 3 | 6 | 6 | 314 | 51 | 181 | 49 | 169 | 82 | 123 | 44 | 115 | 17 | 1 | 3 | 45 |
6,046 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/modeling_wav2vec2.py | transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2SamePadLayer | from torch import nn
class Wav2Vec2SamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
super().__init__()
self.num_pad_remove = 1 if num_conv_pos_embeddings % 2 == 0 else 0
def forward(self, hidden_states):
if self.num_pad_remove > 0:
hidden_states = hidd... |
class Wav2Vec2SamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 2 | 1 | 1 | 4 |
6,047 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/processing_wav2vec2.py | transformers.models.wav2vec2.processing_wav2vec2.Wav2Vec2Processor | import warnings
from ...tokenization_utils_base import AudioInput, PreTokenizedInput, TextInput
from typing import Optional, Union
from contextlib import contextmanager
from .tokenization_wav2vec2 import Wav2Vec2CTCTokenizer
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
from .feature_extracti... |
class Wav2Vec2Processor(ProcessorMixin):
'''
Constructs a Wav2Vec2 processor which wraps a Wav2Vec2 feature extractor and a Wav2Vec2 CTC tokenizer into a single
processor.
[`Wav2Vec2Processor`] offers all the functionalities of [`Wav2Vec2FeatureExtractor`] and [`PreTrainedTokenizer`].
See the docst... | 10 | 4 | 18 | 1 | 13 | 4 | 3 | 0.39 | 1 | 8 | 3 | 0 | 6 | 2 | 7 | 24 | 151 | 20 | 94 | 28 | 77 | 37 | 61 | 19 | 53 | 8 | 2 | 1 | 21 |
6,048 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/processing_wav2vec2.py | transformers.models.wav2vec2.processing_wav2vec2.Wav2Vec2ProcessorKwargs | from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class Wav2Vec2ProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {} |
class Wav2Vec2ProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
6,049 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/tokenization_wav2vec2.py | transformers.models.wav2vec2.tokenization_wav2vec2.Wav2Vec2CTCTokenizer | from ...utils import ModelOutput, PaddingStrategy, TensorType, add_end_docstrings, logging, to_py_obj
from ...tokenization_utils_base import AddedToken, BatchEncoding
from typing import TYPE_CHECKING, Optional, Union
from ...tokenization_utils import PreTrainedTokenizer
import os
from itertools import groupby
import js... |
class Wav2Vec2CTCTokenizer(PreTrainedTokenizer):
'''
Constructs a Wav2Vec2CTC tokenizer.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains some of the main methods. Users should refer to
the superclass for more information regarding such methods.
Args:
vocab_file (`str`):
... | 28 | 11 | 23 | 3 | 13 | 7 | 3 | 0.65 | 1 | 13 | 1 | 0 | 18 | 7 | 20 | 109 | 530 | 88 | 268 | 117 | 192 | 174 | 153 | 60 | 132 | 11 | 3 | 3 | 56 |
6,050 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/tokenization_wav2vec2.py | transformers.models.wav2vec2.tokenization_wav2vec2.Wav2Vec2CTCTokenizerOutput | from dataclasses import dataclass
from ...utils import ModelOutput, PaddingStrategy, TensorType, add_end_docstrings, logging, to_py_obj
from typing import TYPE_CHECKING, Optional, Union
@dataclass
class Wav2Vec2CTCTokenizerOutput(ModelOutput):
"""
Output type of [` Wav2Vec2CTCTokenizer`], with transcription.
... | @dataclass
class Wav2Vec2CTCTokenizerOutput(ModelOutput):
'''
Output type of [` Wav2Vec2CTCTokenizer`], with transcription.
Args:
text (list of `str` or `str`):
Decoded logits in text from. Usually the speech transcription.
char_offsets (list of `list[dict[str, Union[int, str]]]`... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 3.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 19 | 2 | 4 | 3 | 3 | 13 | 4 | 3 | 3 | 0 | 1 | 0 | 0 |
6,051 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2/tokenization_wav2vec2.py | transformers.models.wav2vec2.tokenization_wav2vec2.Wav2Vec2Tokenizer | from ...utils import ModelOutput, PaddingStrategy, TensorType, add_end_docstrings, logging, to_py_obj
from typing import TYPE_CHECKING, Optional, Union
from ...tokenization_utils import PreTrainedTokenizer
from itertools import groupby
import warnings
from ...tokenization_utils_base import AddedToken, BatchEncoding
imp... |
class Wav2Vec2Tokenizer(PreTrainedTokenizer):
'''
Constructs a Wav2Vec2 tokenizer.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains some of the main methods. Users should refer to
the superclass for more information regarding such methods.
Args:
vocab_file (`str`):
... | 20 | 8 | 15 | 2 | 11 | 3 | 2 | 0.47 | 1 | 13 | 1 | 0 | 13 | 6 | 13 | 102 | 275 | 44 | 157 | 73 | 109 | 74 | 79 | 37 | 65 | 6 | 3 | 2 | 28 |
6,052 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/configuration_wav2vec2_bert.py | transformers.models.wav2vec2_bert.configuration_wav2vec2_bert.Wav2Vec2BertConfig | from ...configuration_utils import PretrainedConfig
class Wav2Vec2BertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Wav2Vec2BertModel`]. It is used to
instantiate an Wav2Vec2Bert model according to the specified arguments, defining the model architecture.
... | null | 4 | 1 | 64 | 4 | 57 | 3 | 3 | 1.31 | 1 | 3 | 0 | 0 | 2 | 44 | 2 | 2 | 287 | 17 | 117 | 100 | 63 | 153 | 57 | 49 | 54 | 4 | 1 | 1 | 6 |
6,053 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.TDNNLayer | import warnings
from torch import nn
from ...utils import auto_docstring, is_peft_available
import torch
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.tdnn_dim[layer_id - 1] if layer_id > 0 else config.tdnn_dim[layer_id]
se... |
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 14 | 2 | 11 | 1 | 3 | 0.04 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 29 | 5 | 23 | 11 | 19 | 1 | 20 | 11 | 16 | 3 | 1 | 2 | 5 |
6,054 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertAdapter | import torch
from torch import nn
class Wav2Vec2BertAdapter(nn.Module):
def __init__(self, config):
super().__init__()
if config.output_hidden_size != config.hidden_size:
self.proj = nn.Linear(config.hidden_size, config.output_hidden_size)
self.proj_layer_norm = nn.LayerNor... |
class Wav2Vec2BertAdapter(nn.Module):
def __init__(self, config):
pass
def _compute_sub_sample_lengths_from_attention_mask(self, seq_lens):
pass
def forward(self, hidden_states, attention_mask=None):
pass | 4 | 0 | 13 | 1 | 11 | 1 | 3 | 0.06 | 1 | 3 | 1 | 0 | 3 | 6 | 3 | 13 | 41 | 6 | 33 | 14 | 29 | 2 | 30 | 14 | 26 | 5 | 1 | 2 | 9 |
6,055 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertAdapterLayer | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
from typing import Optional, Union
import torch
from torch import nn
class Wav2Vec2BertAdapterLayer(nn.Module):
def __init__(self, config):
super().__init__()
embed_dim = config.output_hidden_size
dropout = config.conformer... |
class Wav2Vec2BertAdapterLayer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, sub_sampled_lengths: Optional[torch.Tensor]=None):
pass | 3 | 0 | 42 | 6 | 31 | 6 | 2 | 0.19 | 1 | 5 | 2 | 0 | 2 | 11 | 2 | 12 | 86 | 12 | 62 | 24 | 53 | 12 | 37 | 18 | 34 | 2 | 1 | 1 | 3 |
6,056 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertConvolutionModule | from ...activations import ACT2FN
import torch
from torch import nn
class Wav2Vec2BertConvolutionModule(nn.Module):
"""Convolution block used in the conformer block"""
def __init__(self, config):
super().__init__()
if (config.conv_depthwise_kernel_size - 1) % 2 == 1:
raise ValueErr... |
class Wav2Vec2BertConvolutionModule(nn.Module):
'''Convolution block used in the conformer block'''
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None):
pass | 3 | 1 | 33 | 5 | 25 | 4 | 2 | 0.18 | 1 | 2 | 0 | 0 | 2 | 8 | 2 | 12 | 70 | 11 | 50 | 11 | 47 | 9 | 28 | 11 | 25 | 2 | 1 | 1 | 4 |
6,057 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertEncoder | from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from torch import nn
import torch
from ...integrations.fsdp import is_fsdp_managed_module
class Wav2V... |
class Wav2Vec2BertEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True):
pass | 3 | 0 | 46 | 7 | 37 | 2 | 9 | 0.05 | 1 | 8 | 4 | 0 | 2 | 5 | 2 | 12 | 93 | 15 | 74 | 24 | 64 | 4 | 44 | 17 | 41 | 14 | 1 | 3 | 17 |
6,058 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertEncoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
import torch
from torch import nn
class Wav2Vec2BertEncoderLayer(GradientCheckpointingLayer):
"""Conformer block based on https://huggingface.co/papers/2005.08100."""
def __init__(self, config):
super().__init... |
class Wav2Vec2BertEncoderLayer(GradientCheckpointingLayer):
'''Conformer block based on https://huggingface.co/papers/2005.08100.'''
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask: Optional[torch.Tensor]=None, relative_position_embeddings: Optional[torch.Tensor]=... | 3 | 1 | 31 | 5 | 23 | 4 | 1 | 0.2 | 1 | 6 | 3 | 0 | 2 | 9 | 2 | 12 | 66 | 11 | 46 | 23 | 36 | 9 | 34 | 16 | 31 | 1 | 1 | 0 | 2 |
6,059 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertFeatureProjection | from torch import nn
class Wav2Vec2BertFeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_norm = nn.LayerNorm(config.feature_projection_input_dim, eps=config.layer_norm_eps)
self.projection = nn.Linear(config.feature_projection_input_dim, config.hidden_... |
class Wav2Vec2BertFeatureProjection(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.09 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 13 | 1 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
6,060 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertFeedForward | from ...activations import ACT2FN
from torch import nn
class Wav2Vec2BertFeedForward(nn.Module):
def __init__(self, config, act_fn=None, hidden_size=None):
super().__init__()
act_fn = act_fn if act_fn is not None else config.hidden_act
hidden_size = hidden_size if hidden_size is not None e... |
class Wav2Vec2BertFeedForward(nn.Module):
def __init__(self, config, act_fn=None, hidden_size=None):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 2 | 8 | 0 | 3 | 0.06 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 4 | 17 | 8 | 14 | 1 | 17 | 8 | 14 | 4 | 1 | 0 | 5 |
6,061 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertForAudioFrameClassification | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import auto_docstring, is_peft_available
from torch.nn import CrossEntropyLoss
from torch import nn
import torch
@aut... | @auto_docstring
class Wav2Vec2BertForAudioFrameClassification(Wav2Vec2BertPreTrainedModel):
def __init__(self, config):
pass
def freeze_base_model(self):
'''
Calling this function will disable the gradient computation for the base model so that its parameters will not
be update... | 6 | 2 | 25 | 3 | 18 | 4 | 4 | 0.22 | 1 | 6 | 2 | 0 | 3 | 4 | 3 | 6 | 87 | 11 | 63 | 26 | 44 | 14 | 34 | 17 | 30 | 6 | 2 | 1 | 11 |
6,062 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertForCTC | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import auto_docstring, is_peft_available
from torch import nn
import torch
@auto_docstring(custom_intro='\n Wav2Ve... | @auto_docstring(custom_intro='\n Wav2Vec2Bert Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ')
class Wav2Vec2BertForCTC(Wav2Vec2BertPreTrainedModel):
def __init__(self, config, target_lang: Optional[str]=None):
'''
target_lang (`str`, *optiona... | 5 | 2 | 47 | 7 | 34 | 6 | 5 | 0.17 | 1 | 7 | 2 | 0 | 2 | 4 | 2 | 5 | 104 | 15 | 76 | 27 | 57 | 13 | 33 | 18 | 30 | 7 | 2 | 2 | 10 |
6,063 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertForSequenceClassification | from torch import nn
import torch
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import auto_docstring, is_peft_available
from torch.nn import CrossEntropyLoss
@aut... | @auto_docstring(custom_intro='\n Wav2Vec2Bert Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like\n SUPERB Keyword Spotting.\n ')
class Wav2Vec2BertForSequenceClassification(Wav2Vec2BertPreTrainedModel):
def __init__(self, config):
pass
def ... | 6 | 2 | 28 | 3 | 21 | 4 | 4 | 0.2 | 1 | 6 | 2 | 0 | 3 | 4 | 3 | 6 | 96 | 12 | 71 | 29 | 52 | 14 | 41 | 20 | 37 | 8 | 2 | 1 | 13 |
6,064 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertForXVector | from torch import nn
import torch
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import auto_docstring, is_peft_available
@auto_docstring(custom_intro='\n Wav2Ve... | @auto_docstring(custom_intro='\n Wav2Vec2Bert Model with an XVector feature extraction head on top for tasks like Speaker Verification.\n ')
class Wav2Vec2BertForXVector(Wav2Vec2BertPreTrainedModel):
def __init__(self, config):
pass
def freeze_base_model(self):
'''
Calling this f... | 8 | 3 | 23 | 4 | 16 | 4 | 3 | 0.24 | 1 | 10 | 4 | 0 | 4 | 7 | 4 | 7 | 128 | 21 | 87 | 40 | 66 | 21 | 58 | 31 | 52 | 10 | 2 | 2 | 17 |
6,065 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertModel | from ...utils import auto_docstring, is_peft_available
from torch import nn
import torch
from .configuration_wav2vec2_bert import Wav2Vec2BertConfig
from typing import Optional, Union
@auto_docstring
class Wav2Vec2BertModel(Wav2Vec2BertPreTrainedModel):
def __init__(self, config: Wav2Vec2BertConfig):
supe... | @auto_docstring
class Wav2Vec2BertModel(Wav2Vec2BertPreTrainedModel):
def __init__(self, config: Wav2Vec2BertConfig):
pass
def _mask_hidden_states(self, hidden_states: torch.FloatTensor, mask_time_indices: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.LongTensor]=None):
'''
... | 6 | 2 | 37 | 6 | 28 | 3 | 5 | 0.12 | 1 | 9 | 6 | 0 | 3 | 6 | 3 | 6 | 122 | 19 | 92 | 29 | 67 | 11 | 44 | 15 | 40 | 7 | 2 | 1 | 16 |
6,066 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertPreTrainedModel | from ...modeling_utils import PreTrainedModel
from torch import nn
import math
import torch
from .configuration_wav2vec2_bert import Wav2Vec2BertConfig
from typing import Optional, Union
from ...utils import auto_docstring, is_peft_available
@auto_docstring
class Wav2Vec2BertPreTrainedModel(PreTrainedModel):
confi... | @auto_docstring
class Wav2Vec2BertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _get_feat_extract_output_lengths(self, input_lengths: Union[torch.LongTensor, int], add_adapter: Optional[bool]=None):
'''
Computes the out... | 6 | 2 | 18 | 2 | 13 | 3 | 4 | 0.28 | 1 | 5 | 2 | 5 | 3 | 0 | 3 | 3 | 81 | 13 | 53 | 19 | 44 | 15 | 41 | 15 | 36 | 10 | 1 | 2 | 16 |
6,067 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertRelPositionalEmbedding | from torch import nn
import math
import torch
class Wav2Vec2BertRelPositionalEmbedding(nn.Module):
"""Relative positional encoding module."""
def __init__(self, config):
super().__init__()
self.max_len = config.max_source_positions
self.d_model = config.hidden_size
self.pe = No... |
class Wav2Vec2BertRelPositionalEmbedding(nn.Module):
'''Relative positional encoding module.'''
def __init__(self, config):
pass
def extend_pe(self, x):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 4 | 1 | 14 | 1 | 11 | 3 | 2 | 0.3 | 1 | 2 | 0 | 0 | 3 | 3 | 3 | 13 | 48 | 5 | 33 | 15 | 29 | 10 | 31 | 15 | 27 | 4 | 1 | 3 | 6 |
6,068 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertRotaryPositionalEmbedding | import torch
from torch import nn
class Wav2Vec2BertRotaryPositionalEmbedding(nn.Module):
"""Rotary positional embedding
Reference : https://blog.eleuther.ai/rotary-embeddings/ Paper: https://huggingface.co/papers/2104.09864
"""
def __init__(self, config):
super().__init__()
dim = conf... |
class Wav2Vec2BertRotaryPositionalEmbedding(nn.Module):
'''Rotary positional embedding
Reference : https://blog.eleuther.ai/rotary-embeddings/ Paper: https://huggingface.co/papers/2104.09864
'''
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 14 | 2 | 10 | 2 | 2 | 0.29 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 33 | 6 | 21 | 14 | 18 | 6 | 21 | 14 | 18 | 2 | 1 | 1 | 3 |
6,069 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py | transformers.models.wav2vec2_bert.modeling_wav2vec2_bert.Wav2Vec2BertSelfAttention | from typing import Optional, Union
import torch
from torch import nn
import math
class Wav2Vec2BertSelfAttention(nn.Module):
"""Construct an Wav2Vec2BertSelfAttention object.
Can be enhanced with rotary or relative position embeddings.
"""
def __init__(self, config, is_adapter_attention=False):
... |
class Wav2Vec2BertSelfAttention(nn.Module):
'''Construct an Wav2Vec2BertSelfAttention object.
Can be enhanced with rotary or relative position embeddings.
'''
def __init__(self, config, is_adapter_attention=False):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Option... | 5 | 1 | 40 | 7 | 26 | 7 | 4 | 0.3 | 1 | 4 | 0 | 0 | 4 | 14 | 4 | 14 | 169 | 33 | 105 | 56 | 94 | 32 | 89 | 50 | 84 | 7 | 1 | 2 | 14 |
6,070 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/processing_wav2vec2_bert.py | transformers.models.wav2vec2_bert.processing_wav2vec2_bert.Wav2Vec2BertProcessor | import warnings
from ..wav2vec2.tokenization_wav2vec2 import Wav2Vec2CTCTokenizer
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
from ..seamless_m4t.feature_extraction_seamless_m4t import SeamlessM4TFeatureExtractor
from ...tokenization_utils_base import AudioInput, PreTokenizedInput, TextInpu... |
class Wav2Vec2BertProcessor(ProcessorMixin):
'''
Constructs a Wav2Vec2-BERT processor which wraps a Wav2Vec2-BERT feature extractor and a Wav2Vec2 CTC tokenizer into a single
processor.
[`Wav2Vec2Processor`] offers all the functionalities of [`SeamlessM4TFeatureExtractor`] and [`PreTrainedTokenizer`].
... | 8 | 3 | 18 | 2 | 10 | 6 | 3 | 0.71 | 1 | 8 | 3 | 0 | 5 | 0 | 6 | 23 | 129 | 18 | 65 | 22 | 50 | 46 | 42 | 14 | 35 | 6 | 2 | 1 | 17 |
6,071 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_bert/processing_wav2vec2_bert.py | transformers.models.wav2vec2_bert.processing_wav2vec2_bert.Wav2Vec2BertProcessorKwargs | from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class Wav2Vec2BertProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {} |
class Wav2Vec2BertProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
6,072 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/configuration_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.configuration_wav2vec2_conformer.Wav2Vec2ConformerConfig | from ...configuration_utils import PretrainedConfig
import operator
import functools
class Wav2Vec2ConformerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Wav2Vec2ConformerModel`]. It is used to
instantiate an Wav2Vec2Conformer model according to the specifi... | null | 4 | 1 | 74 | 4 | 66 | 4 | 2 | 1.31 | 1 | 3 | 0 | 0 | 2 | 56 | 2 | 2 | 331 | 19 | 135 | 122 | 70 | 177 | 64 | 60 | 61 | 2 | 1 | 1 | 3 |
6,073 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.AMSoftmaxLoss | import torch
from torch import nn
class AMSoftmaxLoss(nn.Module):
def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4):
super().__init__()
self.scale = scale
self.margin = margin
self.num_labels = num_labels
self.weight = nn.Parameter(torch.randn(input_dim, num... |
class AMSoftmaxLoss(nn.Module):
def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4):
pass
def forward(self, hidden_states, labels):
pass | 3 | 0 | 10 | 1 | 9 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 21 | 3 | 18 | 14 | 15 | 0 | 18 | 14 | 15 | 1 | 1 | 0 | 2 |
6,074 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.TDNNLayer | from ...utils import ModelOutput, auto_docstring, is_peft_available
import torch
from torch import nn
import warnings
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.tdnn_dim[layer_id - 1] if layer_id > 0 else config.tdnn_dim[layer_i... |
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 14 | 2 | 11 | 1 | 3 | 0.04 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 29 | 5 | 23 | 11 | 19 | 1 | 20 | 11 | 16 | 3 | 1 | 2 | 5 |
6,075 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerAdapter | import numpy as np
from torch import nn
class Wav2Vec2ConformerAdapter(nn.Module):
def __init__(self, config):
super().__init__()
if config.output_hidden_size != config.hidden_size:
self.proj = nn.Linear(config.hidden_size, config.output_hidden_size)
self.proj_layer_norm = ... |
class Wav2Vec2ConformerAdapter(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 14 | 3 | 10 | 1 | 3 | 0.1 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 29 | 6 | 21 | 9 | 18 | 2 | 20 | 9 | 17 | 4 | 1 | 2 | 6 |
6,076 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerAdapterLayer | from torch import nn
class Wav2Vec2ConformerAdapterLayer(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.output_hidden_size, 2 * config.output_hidden_size, config.adapter_kernel_size, stride=config.adapter_stride, padding=1)
def forward(self, hidden_sta... |
class Wav2Vec2ConformerAdapterLayer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 1 | 7 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 16 | 2 | 14 | 4 | 11 | 0 | 8 | 4 | 5 | 1 | 1 | 0 | 2 |
6,077 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerConvolutionModule | from ...activations import ACT2FN
from torch import nn
class Wav2Vec2ConformerConvolutionModule(nn.Module):
"""Convolution block used in the conformer block"""
def __init__(self, config):
super().__init__()
if (config.conv_depthwise_kernel_size - 1) % 2 == 1:
raise ValueError("`con... |
class Wav2Vec2ConformerConvolutionModule(nn.Module):
'''Convolution block used in the conformer block'''
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 27 | 2 | 23 | 3 | 2 | 0.13 | 1 | 2 | 0 | 0 | 2 | 8 | 2 | 12 | 58 | 5 | 47 | 11 | 44 | 6 | 25 | 11 | 22 | 2 | 1 | 1 | 3 |
6,078 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerEncoder | from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from torch import nn
import torch
from ...integrations.fsdp import is_fsdp_managed_module
class Wav2V... |
class Wav2Vec2ConformerEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True):
pass | 3 | 0 | 46 | 7 | 37 | 2 | 9 | 0.05 | 1 | 9 | 5 | 0 | 2 | 7 | 2 | 12 | 94 | 15 | 75 | 26 | 65 | 4 | 47 | 19 | 44 | 14 | 1 | 3 | 17 |
6,079 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerEncoderLayer | from typing import Optional, Union
import torch
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
class Wav2Vec2ConformerEncoderLayer(GradientCheckpointingLayer):
"""Conformer block based on https://huggingface.co/papers/2005.08100."""
def __init__(self, config):
super()._... |
class Wav2Vec2ConformerEncoderLayer(GradientCheckpointingLayer):
'''Conformer block based on https://huggingface.co/papers/2005.08100.'''
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask: Optional[torch.Tensor]=None, relative_position_embeddings: Optional[torch.Ten... | 3 | 1 | 31 | 5 | 22 | 4 | 1 | 0.2 | 1 | 6 | 3 | 0 | 2 | 9 | 2 | 12 | 65 | 11 | 45 | 22 | 36 | 9 | 34 | 16 | 31 | 1 | 1 | 0 | 2 |
6,080 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerFeatureEncoder | from torch import nn
class Wav2Vec2ConformerFeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
if config.feat_extract_norm == 'group':
conv_layers = [Wav2Vec2ConformerGroupNormConvLayer(config, layer_id=0)]... |
class Wav2Vec2ConformerFeatureEncoder(nn.Module):
'''Construct the features from raw audio waveform'''
def __init__(self, config):
pass
def _freeze_parameters(self):
pass
def forward(self, input_values):
pass | 4 | 1 | 13 | 1 | 12 | 0 | 3 | 0.06 | 1 | 6 | 3 | 0 | 3 | 3 | 3 | 13 | 45 | 7 | 36 | 11 | 32 | 2 | 23 | 11 | 19 | 4 | 1 | 2 | 9 |
6,081 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerFeatureProjection | from torch import nn
class Wav2Vec2ConformerFeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.layer_norm_eps)
self.projection = nn.Linear(config.conv_dim[-1], config.hidden_size)
self.dropout ... |
class Wav2Vec2ConformerFeatureProjection(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.09 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 13 | 1 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
6,082 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerFeedForward | from ...activations import ACT2FN
from torch import nn
class Wav2Vec2ConformerFeedForward(nn.Module):
def __init__(self, config):
super().__init__()
self.intermediate_dropout = nn.Dropout(config.activation_dropout)
self.intermediate_dense = nn.Linear(config.hidden_size, config.intermediate... |
class Wav2Vec2ConformerFeedForward(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 2 | 9 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 4 | 18 | 8 | 15 | 0 | 17 | 8 | 14 | 2 | 1 | 1 | 3 |
6,083 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForAudioFrameClassification | from typing import Optional, Union
from torch.nn import CrossEntropyLoss
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import ModelOutput, auto_docstring, is_peft_available
from torch import nn
impor... | @auto_docstring
class Wav2Vec2ConformerForAudioFrameClassification(Wav2Vec2ConformerPreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_encoder(self):
'''
Calling this function will disable the gradient computation for the feature encoder so that its parameter will
... | 7 | 3 | 20 | 2 | 14 | 4 | 3 | 0.29 | 1 | 6 | 2 | 0 | 4 | 4 | 4 | 7 | 95 | 12 | 65 | 27 | 45 | 19 | 36 | 18 | 31 | 6 | 2 | 1 | 12 |
6,084 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForCTC | from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import ModelOutput, auto_docstring, is_peft_available
from torch import nn
import torch
from typing import Optional, Union
@auto_docstring(custom_intro=... | @auto_docstring(custom_intro='\n Wav2Vec2Conformer Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ')
class Wav2Vec2ConformerForCTC(Wav2Vec2ConformerPreTrainedModel):
def __init__(self, config, target_lang: Optional[str]=None):
'''
target_lang (... | 6 | 3 | 32 | 5 | 22 | 5 | 4 | 0.25 | 1 | 7 | 2 | 0 | 3 | 4 | 3 | 6 | 111 | 16 | 76 | 28 | 56 | 19 | 35 | 19 | 31 | 7 | 2 | 2 | 11 |
6,085 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForPreTraining | from .configuration_wav2vec2_conformer import Wav2Vec2ConformerConfig
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_peft_available
from torch import nn
import torch
@auto_docstring(custom_intro='\n Wav2Vec2Conformer Model with a quantizer and `VQ` head on top.\n ')
class... | @auto_docstring(custom_intro='\n Wav2Vec2Conformer Model with a quantizer and `VQ` head on top.\n ')
class Wav2Vec2ConformerForPreTraining(Wav2Vec2ConformerPreTrainedModel):
def __init__(self, config: Wav2Vec2ConformerConfig):
pass
def set_gumbel_temperature(self, temperature: int):
'''
... | 9 | 4 | 40 | 7 | 19 | 15 | 2 | 0.81 | 1 | 9 | 4 | 0 | 4 | 5 | 5 | 8 | 214 | 37 | 98 | 39 | 75 | 79 | 50 | 23 | 44 | 8 | 2 | 2 | 12 |
6,086 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForPreTrainingOutput | from ...utils import ModelOutput, auto_docstring, is_peft_available
from dataclasses import dataclass
from typing import Optional, Union
import torch
@dataclass
@auto_docstring(custom_intro='\n Output type of [`Wav2Vec2ConformerForPreTraining`], with potential hidden states and attentions.\n ')
class Wav2Vec2Con... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`Wav2Vec2ConformerForPreTraining`], with potential hidden states and attentions.\n ')
class Wav2Vec2ConformerForPreTrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `sample_negative_indices` are passed, `torch.FloatTensor` of shape... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.89 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 39 | 4 | 9 | 9 | 8 | 26 | 9 | 9 | 8 | 0 | 1 | 0 | 0 |
6,087 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForSequenceClassification | from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import ModelOutput, auto_docstring, is_peft_available
from torch import nn
import torch
from typing import Optional, Union
from torch.nn import CrossEntr... | @auto_docstring(custom_intro='\n Wav2Vec2Conformer Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like\n SUPERB Keyword Spotting.\n ')
class Wav2Vec2ConformerForSequenceClassification(Wav2Vec2ConformerPreTrainedModel):
def __init__(self, config):
... | 7 | 3 | 23 | 3 | 16 | 4 | 4 | 0.26 | 1 | 6 | 2 | 0 | 4 | 4 | 4 | 7 | 104 | 13 | 73 | 30 | 53 | 19 | 43 | 21 | 38 | 8 | 2 | 1 | 14 |
6,088 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForXVector | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import ModelOutput, auto_docstring, is_peft_available
from torch import nn
import torch
@auto_docstring(custom_intro=... | @auto_docstring(custom_intro='\n Wav2Vec2Conformer Model with an XVector feature extraction head on top for tasks like Speaker Verification.\n ')
class Wav2Vec2ConformerForXVector(Wav2Vec2ConformerPreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_encoder(self):
'''
... | 9 | 4 | 21 | 3 | 14 | 4 | 3 | 0.28 | 1 | 10 | 4 | 0 | 5 | 7 | 5 | 8 | 135 | 22 | 89 | 41 | 67 | 25 | 60 | 32 | 53 | 10 | 2 | 2 | 18 |
6,089 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerGroupNormConvLayer | from ...activations import ACT2FN
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
class Wav2Vec2ConformerGroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if lay... |
class Wav2Vec2ConformerGroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 1 | 9 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 3 | 19 | 8 | 16 | 0 | 13 | 8 | 10 | 2 | 1 | 0 | 3 |
6,090 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerGumbelVectorQuantizer | import torch
from torch import nn
class Wav2Vec2ConformerGumbelVectorQuantizer(nn.Module):
"""
Vector quantization using gumbel softmax. See `[CATEGORICAL REPARAMETERIZATION WITH
GUMBEL-SOFTMAX](https://huggingface.co/papers/1611.01144) for more information.
"""
def __init__(self, config):
... |
class Wav2Vec2ConformerGumbelVectorQuantizer(nn.Module):
'''
Vector quantization using gumbel softmax. See `[CATEGORICAL REPARAMETERIZATION WITH
GUMBEL-SOFTMAX](https://huggingface.co/papers/1611.01144) for more information.
'''
def __init__(self, config):
pass
@staticmethod
def _c... | 5 | 1 | 22 | 3 | 16 | 3 | 2 | 0.24 | 1 | 2 | 0 | 0 | 2 | 5 | 3 | 13 | 74 | 13 | 49 | 20 | 44 | 12 | 35 | 19 | 31 | 2 | 1 | 1 | 6 |
6,091 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerLayerNormConvLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...activations import ACT2FN
from torch import nn
class Wav2Vec2ConformerLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if lay... |
class Wav2Vec2ConformerLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 12 | 2 | 10 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 25 | 4 | 21 | 8 | 18 | 0 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
6,092 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerModel | from ...utils import ModelOutput, auto_docstring, is_peft_available
from torch import nn
import torch
from .configuration_wav2vec2_conformer import Wav2Vec2ConformerConfig
from typing import Optional, Union
@auto_docstring
class Wav2Vec2ConformerModel(Wav2Vec2ConformerPreTrainedModel):
def __init__(self, config: ... | @auto_docstring
class Wav2Vec2ConformerModel(Wav2Vec2ConformerPreTrainedModel):
def __init__(self, config: Wav2Vec2ConformerConfig):
pass
def freeze_feature_encoder(self):
'''
Calling this function will disable the gradient computation for the feature encoder so that its parameter will... | 7 | 3 | 30 | 4 | 22 | 4 | 4 | 0.19 | 1 | 9 | 6 | 0 | 4 | 6 | 4 | 7 | 133 | 20 | 95 | 30 | 69 | 18 | 45 | 16 | 40 | 7 | 2 | 1 | 16 |
6,093 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerNoLayerNormConvLayer | from ...activations import ACT2FN
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
class Wav2Vec2ConformerNoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if l... |
class Wav2Vec2ConformerNoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 19 | 2 | 17 | 7 | 14 | 0 | 11 | 7 | 8 | 2 | 1 | 0 | 3 |
6,094 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerPositionalConvEmbedding | from ...activations import ACT2FN
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from torch import nn
class Wav2Vec2ConformerPositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_siz... |
class Wav2Vec2ConformerPositionalConvEmbedding(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 21 | 3 | 18 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 43 | 7 | 36 | 10 | 32 | 0 | 28 | 10 | 24 | 4 | 1 | 2 | 5 |
6,095 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerPreTrainedModel | from ...utils import ModelOutput, auto_docstring, is_peft_available
from torch import nn
from ...modeling_utils import PreTrainedModel
import torch
import math
from .configuration_wav2vec2_conformer import Wav2Vec2ConformerConfig
from typing import Optional, Union
@auto_docstring
class Wav2Vec2ConformerPreTrainedModel... | @auto_docstring
class Wav2Vec2ConformerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _get_feat_extract_output_lengths(self, input_lengths: Union[torch.LongTensor, int], add_adapter: Optional[bool]=None):
'''
Computes th... | 6 | 2 | 22 | 3 | 16 | 3 | 5 | 0.22 | 1 | 9 | 5 | 6 | 3 | 0 | 3 | 3 | 97 | 14 | 68 | 19 | 59 | 15 | 51 | 15 | 46 | 13 | 1 | 2 | 20 |
6,096 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerRelPositionalEmbedding | import torch
import math
from torch import nn
class Wav2Vec2ConformerRelPositionalEmbedding(nn.Module):
"""Relative positional encoding module."""
def __init__(self, config):
super().__init__()
self.max_len = config.max_source_positions
self.d_model = config.hidden_size
self.pe... |
class Wav2Vec2ConformerRelPositionalEmbedding(nn.Module):
'''Relative positional encoding module.'''
def __init__(self, config):
pass
def extend_pe(self, x):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 4 | 1 | 14 | 1 | 11 | 3 | 2 | 0.3 | 1 | 2 | 0 | 0 | 3 | 3 | 3 | 13 | 48 | 5 | 33 | 15 | 29 | 10 | 31 | 15 | 27 | 4 | 1 | 3 | 6 |
6,097 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerRotaryPositionalEmbedding | import torch
from torch import nn
class Wav2Vec2ConformerRotaryPositionalEmbedding(nn.Module):
"""Rotary positional embedding
Reference : https://blog.eleuther.ai/rotary-embeddings/ Paper: https://huggingface.co/papers/2104.09864
"""
def __init__(self, config):
super().__init__()
dim =... |
class Wav2Vec2ConformerRotaryPositionalEmbedding(nn.Module):
'''Rotary positional embedding
Reference : https://blog.eleuther.ai/rotary-embeddings/ Paper: https://huggingface.co/papers/2104.09864
'''
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 13 | 2 | 10 | 1 | 2 | 0.24 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 32 | 6 | 21 | 14 | 18 | 5 | 21 | 14 | 18 | 2 | 1 | 1 | 3 |
6,098 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerSamePadLayer | from torch import nn
class Wav2Vec2ConformerSamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
super().__init__()
self.num_pad_remove = 1 if num_conv_pos_embeddings % 2 == 0 else 0
def forward(self, hidden_states):
if self.num_pad_remove > 0:
hidden_stat... |
class Wav2Vec2ConformerSamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 2 | 1 | 1 | 4 |
6,099 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py | transformers.models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerSelfAttention | from typing import Optional, Union
import torch
import math
from torch import nn
class Wav2Vec2ConformerSelfAttention(nn.Module):
"""Construct an Wav2Vec2ConformerSelfAttention object.
Can be enhanced with rotary or relative position embeddings.
"""
def __init__(self, config):
super().__init__... |
class Wav2Vec2ConformerSelfAttention(nn.Module):
'''Construct an Wav2Vec2ConformerSelfAttention object.
Can be enhanced with rotary or relative position embeddings.
'''
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=N... | 5 | 1 | 35 | 6 | 22 | 7 | 3 | 0.33 | 1 | 4 | 0 | 0 | 4 | 11 | 4 | 14 | 146 | 28 | 89 | 45 | 78 | 29 | 73 | 39 | 68 | 6 | 1 | 2 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.