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,100
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py
transformers.models.wav2vec2_phoneme.tokenization_wav2vec2_phoneme.Wav2Vec2PhonemeCTCTokenizer
import json from ...utils import ModelOutput, logging, requires_backends, to_py_obj from ...tokenization_utils_base import AddedToken from itertools import groupby import os from ...tokenization_utils import PreTrainedTokenizer import numpy as np from typing import TYPE_CHECKING, Any, Optional, Union class Wav2Vec2Pho...
class Wav2Vec2PhonemeCTCTokenizer(PreTrainedTokenizer): ''' Constructs a Wav2Vec2PhonemeCTC 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_...
35
14
18
2
11
5
2
0.57
1
13
1
0
23
9
24
113
498
82
265
125
177
151
149
61
122
7
3
2
54
6,101
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py
transformers.models.wav2vec2_phoneme.tokenization_wav2vec2_phoneme.Wav2Vec2PhonemeCTCTokenizerOutput
from ...utils import ModelOutput, logging, requires_backends, to_py_obj from typing import TYPE_CHECKING, Any, Optional, Union from dataclasses import dataclass @dataclass class Wav2Vec2PhonemeCTCTokenizerOutput(ModelOutput): """ Output type of [` Wav2Vec2PhonemeCTCTokenizer`], with transcription. Args: ...
@dataclass class Wav2Vec2PhonemeCTCTokenizerOutput(ModelOutput): ''' Output type of [` Wav2Vec2PhonemeCTCTokenizer`], 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, Unio...
2
1
0
0
0
0
0
3.33
1
0
0
0
0
0
0
0
15
2
3
2
2
10
3
2
2
0
1
0
0
6,102
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py
transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput
from ...utils import ModelOutput, logging, requires_backends from typing import TYPE_CHECKING, Optional, Union from dataclasses import dataclass @dataclass class Wav2Vec2DecoderWithLMOutput(ModelOutput): """ Output type of [`Wav2Vec2DecoderWithLM`], with transcription. Args: text (list of `str` or...
@dataclass class Wav2Vec2DecoderWithLMOutput(ModelOutput): ''' Output type of [`Wav2Vec2DecoderWithLM`], with transcription. Args: text (list of `str` or `str`): Decoded logits in text from. Usually the speech transcription. logit_score (list of `float` or `float`): T...
2
1
0
0
0
0
0
2.6
1
0
0
0
0
0
0
0
20
2
5
4
4
13
5
4
4
0
1
0
0
6,103
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py
transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2ProcessorWithLM
import warnings from ...processing_utils import ProcessorMixin from multiprocessing import Pool, get_context, get_start_method import os from collections.abc import Iterable from typing import TYPE_CHECKING, Optional, Union from ...utils import ModelOutput, logging, requires_backends import numpy as np from contextlib ...
class Wav2Vec2ProcessorWithLM(ProcessorMixin): ''' Constructs a Wav2Vec2 processor which wraps a Wav2Vec2 feature extractor, a Wav2Vec2 CTC tokenizer and a decoder with language model support into a single processor for language model boosted speech recognition decoding. Args: feature_extractor...
17
7
51
7
25
18
5
0.73
1
13
1
0
8
3
11
28
588
91
287
103
220
210
151
53
134
13
2
2
57
6,104
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/configuration_wavlm.py
transformers.models.wavlm.configuration_wavlm.WavLMConfig
import operator from ...configuration_utils import PretrainedConfig import functools class WavLMConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`WavLMModel`]. It is used to instantiate an WavLM model according to the specified arguments, defining the model arc...
null
4
1
70
4
64
3
2
1.21
1
3
0
0
2
53
2
2
308
21
130
116
68
157
62
57
59
2
1
1
3
6,105
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.AMSoftmaxLoss
import torch.nn as nn import torch.nn.functional as F 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.Par...
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,106
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.TDNNLayer
from ...utils import auto_docstring, is_peft_available, logging import torch.nn.functional as F import warnings import torch.nn as nn 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...
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,107
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMAdapter
import torch.nn as nn import numpy as np class WavLMAdapter(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 WavLMAdapter(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,108
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMAdapterLayer
import torch.nn as nn class WavLMAdapterLayer(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 WavLMAdapterLayer(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,109
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMAttention
from typing import Optional, Union import torch.nn.functional as F import torch.nn as nn import math import torch class WavLMAttention(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, num_buckets: int=320, ma...
class WavLMAttention(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, num_buckets: int=320, max_distance: int=800, has_relative_position_bias: bool=True): pass def forward(self, hidden_states: to...
6
3
31
4
24
3
2
0.14
1
6
0
0
5
15
5
15
164
26
121
65
94
17
67
43
61
3
1
1
10
6,110
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMEncoder
from ...integrations.deepspeed import is_deepspeed_zero3_enabled from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput import torch.nn.functional as F import torch.nn as nn from ...integrations.fsdp import is_fsdp_managed...
class WavLMEncoder(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
40
6
33
2
7
0.05
1
7
3
0
2
6
2
12
81
12
66
26
56
3
40
19
37
12
1
3
13
6,111
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMEncoderLayer
from ...modeling_layers import GradientCheckpointingLayer from .configuration_wavlm import WavLMConfig import torch.nn as nn class WavLMEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: WavLMConfig, has_relative_position_bias: bool=True): super().__init__() self.attention = WavL...
class WavLMEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: WavLMConfig, has_relative_position_bias: bool=True): pass def forward(self, hidden_states, attention_mask=None, position_bias=None, output_attentions=False, index=0): pass
3
0
19
3
16
0
2
0
1
5
3
0
2
5
2
12
39
6
33
11
30
0
20
11
17
2
1
1
3
6,112
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMEncoderLayerStableLayerNorm
import torch.nn as nn from .configuration_wavlm import WavLMConfig from ...modeling_layers import GradientCheckpointingLayer class WavLMEncoderLayerStableLayerNorm(GradientCheckpointingLayer): def __init__(self, config: WavLMConfig, has_relative_position_bias: bool=True): super().__init__() self.a...
class WavLMEncoderLayerStableLayerNorm(GradientCheckpointingLayer): def __init__(self, config: WavLMConfig, has_relative_position_bias: bool=True): pass def forward(self, hidden_states, attention_mask=None, position_bias=None, output_attentions=False): pass
3
0
17
2
15
0
2
0
1
5
3
0
2
5
2
12
35
4
31
11
28
0
19
11
16
2
1
1
3
6,113
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMEncoderStableLayerNorm
from ...integrations.deepspeed import is_deepspeed_zero3_enabled from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput import torch.nn.functional as F import torch.nn as nn from ...integrations.fsdp import is_fsdp_managed...
class WavLMEncoderStableLayerNorm(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
40
6
33
2
7
0.06
1
7
3
0
2
6
2
12
82
12
66
26
56
4
40
19
37
12
1
3
13
6,114
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMFeatureEncoder
import torch.nn as nn class WavLMFeatureEncoder(nn.Module): """Construct the features from raw audio waveform""" def __init__(self, config): super().__init__() if config.feat_extract_norm == 'group': conv_layers = [WavLMGroupNormConvLayer(config, layer_id=0)] + [WavLMNoLayerNormCon...
class WavLMFeatureEncoder(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
12
1
11
0
3
0.06
1
6
3
1
3
3
3
13
42
7
33
11
29
2
23
11
19
4
1
2
9
6,115
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMFeatureProjection
import torch.nn as nn class WavLMFeatureProjection(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.Dropou...
class WavLMFeatureProjection(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,116
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMFeedForward
import torch.nn as nn from ...activations import ACT2FN class WavLMFeedForward(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 WavLMFeedForward(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,117
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMForAudioFrameClassification
from torch.nn import CrossEntropyLoss from typing import Optional, Union from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput from ...utils import auto_docstring, is_peft_available, logging import torch.nn.functional as ...
@auto_docstring class WavLMForAudioFrameClassification(WavLMPreTrainedModel): 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 updated d...
8
4
18
2
13
4
3
0.26
1
7
2
0
5
4
5
8
104
13
73
28
51
19
39
19
33
6
2
1
13
6,118
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMForCTC
from typing import Optional, Union from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput from ...utils import auto_docstring, is_peft_available, logging import torch.nn.functional as F import warnings import torch.nn as n...
@auto_docstring(custom_intro='\n WavLM Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ') class WavLMForCTC(WavLMPreTrainedModel): def __init__(self, config, target_lang: Optional[str]=None): ''' target_lang (`str`, *optional*): Lang...
9
6
23
3
14
6
3
0.35
1
8
2
0
6
4
6
9
149
22
94
33
71
33
47
24
40
7
2
2
18
6,119
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMForSequenceClassification
from torch.nn import CrossEntropyLoss from typing import Optional, Union from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput from ...utils import auto_docstring, is_peft_available, logging import torch.nn.functional as ...
@auto_docstring(custom_intro='\n WavLM Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like\n SUPERB Keyword Spotting.\n ') class WavLMForSequenceClassification(WavLMPreTrainedModel): def __init__(self, config): pass def freeze_feature_extrac...
8
4
20
2
14
4
3
0.3
1
7
2
0
5
4
5
8
117
14
80
31
59
24
46
22
40
8
2
1
15
6,120
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMForXVector
from typing import Optional, Union from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput from ...utils import auto_docstring, is_peft_available, logging import torch.nn.functional as F import warnings import torch.nn as n...
@auto_docstring(custom_intro='\n WavLM Model with an XVector feature extraction head on top for tasks like Speaker Verification.\n ') class WavLMForXVector(WavLMPreTrainedModel): def __init__(self, config): pass def freeze_feature_extractor(self): ''' Calling this function will d...
10
5
19
3
13
4
3
0.26
1
11
4
0
6
7
6
9
144
23
97
42
73
25
63
33
55
10
2
2
19
6,121
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMGroupNormConvLayer
from ...modeling_layers import GradientCheckpointingLayer from ...activations import ACT2FN import torch.nn as nn class WavLMGroupNormConvLayer(GradientCheckpointingLayer): def __init__(self, config, layer_id=0): super().__init__() self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 e...
class WavLMGroupNormConvLayer(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,122
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMGumbelVectorQuantizer
import torch import torch.nn as nn import torch.nn.functional as F class WavLMGumbelVectorQuantizer(nn.Module): """ Vector quantization using gumbel softmax. See [CATEGORICAL REPARAMETERIZATION WITH GUMBEL-SOFTMAX](https://huggingface.co/papers/1611.01144) for more information. """ def __init__(se...
class WavLMGumbelVectorQuantizer(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_perple...
5
1
20
3
14
3
2
0.27
1
2
0
0
2
5
3
13
68
12
44
19
39
12
32
18
28
2
1
1
5
6,123
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMLayerNormConvLayer
from ...modeling_layers import GradientCheckpointingLayer from ...activations import ACT2FN import torch.nn as nn class WavLMLayerNormConvLayer(GradientCheckpointingLayer): def __init__(self, config, layer_id=0): super().__init__() self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 e...
class WavLMLayerNormConvLayer(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,124
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMModel
from .configuration_wavlm import WavLMConfig from typing import Optional, Union from ...utils import auto_docstring, is_peft_available, logging import torch.nn.functional as F import warnings import torch.nn as nn import torch @auto_docstring class WavLMModel(WavLMPreTrainedModel): def __init__(self, config: WavL...
@auto_docstring class WavLMModel(WavLMPreTrainedModel): def __init__(self, config: WavLMConfig): 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 during tr...
8
4
26
3
19
4
4
0.18
1
11
7
0
5
6
5
8
145
21
105
31
78
19
50
17
44
7
2
1
18
6,125
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMNoLayerNormConvLayer
from ...modeling_layers import GradientCheckpointingLayer from ...activations import ACT2FN import torch.nn as nn class WavLMNoLayerNormConvLayer(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 WavLMNoLayerNormConvLayer(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,126
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMPositionalConvEmbedding
import torch.nn as nn from ...integrations.deepspeed import is_deepspeed_zero3_enabled from ...activations import ACT2FN class WavLMPositionalConvEmbedding(nn.Module): def __init__(self, config): super().__init__() self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_size=config.nu...
class WavLMPositionalConvEmbedding(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,127
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMPreTrainedModel
from ...utils import auto_docstring, is_peft_available, logging import torch.nn.functional as F from ...modeling_utils import PreTrainedModel import torch.nn as nn import math import torch from .configuration_wavlm import WavLMConfig from typing import Optional, Union @auto_docstring class WavLMPreTrainedModel(PreTrai...
@auto_docstring class WavLMPreTrainedModel(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 len...
6
2
19
3
14
3
4
0.24
1
7
3
5
3
0
3
3
86
14
58
19
49
14
43
15
38
9
1
2
16
6,128
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/wavlm/modeling_wavlm.py
transformers.models.wavlm.modeling_wavlm.WavLMSamePadLayer
import torch.nn as nn class WavLMSamePadLayer(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 = hidden...
class WavLMSamePadLayer(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,129
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/configuration_whisper.py
transformers.models.whisper.configuration_whisper.WhisperConfig
from ...configuration_utils import PretrainedConfig class WhisperConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`WhisperModel`]. It is used to instantiate a Whisper model according to the specified arguments, defining the model architecture. Instantiating a c...
class WhisperConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`WhisperModel`]. It is used to instantiate a Whisper model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simi...
2
1
88
4
82
3
1
1.38
1
1
0
0
1
31
1
1
227
14
90
76
48
124
37
36
35
1
1
0
1
6,130
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/configuration_whisper.py
transformers.models.whisper.configuration_whisper.WhisperOnnxConfig
from collections.abc import Mapping from ...onnx import OnnxConfig, OnnxSeq2SeqConfigWithPast from typing import TYPE_CHECKING, Any, Union from collections import OrderedDict class WhisperOnnxConfig(OnnxSeq2SeqConfigWithPast): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: common_input...
class WhisperOnnxConfig(OnnxSeq2SeqConfigWithPast): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass def generate_dummy_inputs(self, preprocessor: Union['PreTrainedTokenizerBase', 'FeatureExtractionMixin'], batch_size: int=-1, seq_length: int=-1, is_pair: bool=False, sampling_r...
6
0
17
2
15
0
2
0
1
7
0
0
3
0
3
3
57
8
49
21
33
0
22
9
18
3
1
1
7
6,131
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/english_normalizer.py
transformers.models.whisper.english_normalizer.BasicTextNormalizer
import re import regex class BasicTextNormalizer: def __init__(self, remove_diacritics: bool=False, split_letters: bool=False): self.clean = remove_symbols_and_diacritics if remove_diacritics else remove_symbols self.split_letters = split_letters def __call__(self, s: str): s = s.lowe...
class BasicTextNormalizer: def __init__(self, remove_diacritics: bool=False, split_letters: bool=False): pass def __call__(self, s: str): pass
3
0
8
2
6
2
2
0.23
0
2
0
0
2
2
2
2
17
4
13
5
10
3
13
5
10
2
0
1
4
6,132
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/english_normalizer.py
transformers.models.whisper.english_normalizer.EnglishNumberNormalizer
import re from fractions import Fraction from re import Match from typing import Optional, Union from collections.abc import Iterator class EnglishNumberNormalizer: """ Convert any spelled-out numbers into arabic numbers, while handling: - remove any commas - keep the suffixes such as: `1960s`, `274th...
class EnglishNumberNormalizer: ''' Convert any spelled-out numbers into arabic numbers, while handling: - remove any commas - keep the suffixes such as: `1960s`, `274th`, `32nd`, etc. - spell out currency symbols after the number. e.g. `$20 million` -> `20000000 dollars` - spell out `one` and `...
10
1
46
3
41
3
10
0.09
0
9
0
0
5
21
5
5
400
31
342
57
331
32
216
56
205
70
0
5
88
6,133
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/english_normalizer.py
transformers.models.whisper.english_normalizer.EnglishSpellingNormalizer
class EnglishSpellingNormalizer: """ Applies British-American spelling mappings as listed in [1]. [1] https://www.tysto.com/uk-us-spelling-list.html """ def __init__(self, english_spelling_mapping): self.mapping = english_spelling_mapping def __call__(self, s: str): return ' '...
class EnglishSpellingNormalizer: ''' Applies British-American spelling mappings as listed in [1]. [1] https://www.tysto.com/uk-us-spelling-list.html ''' def __init__(self, english_spelling_mapping): pass def __call__(self, s: str): pass
3
1
2
0
2
0
1
0.8
0
1
0
0
2
1
2
2
12
3
5
4
2
4
5
4
2
1
0
0
2
6,134
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/english_normalizer.py
transformers.models.whisper.english_normalizer.EnglishTextNormalizer
import re class EnglishTextNormalizer: def __init__(self, english_spelling_mapping): self.ignore_patterns = '\\b(hmm|mm|mhm|mmm|uh|um)\\b' self.replacers = {"\\bwon't\\b": 'will not', "\\bcan't\\b": 'can not', "\\blet's\\b": 'let us', "\\bain't\\b": 'aint', "\\by'all\\b": 'you all', '\\bwanna\\b':...
class EnglishTextNormalizer: def __init__(self, english_spelling_mapping): pass def __call__(self, s: str): pass
3
0
42
4
36
7
2
0.18
0
3
2
0
2
4
2
2
86
8
73
8
70
13
23
8
20
2
0
1
3
6,135
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/feature_extraction_whisper.py
transformers.models.whisper.feature_extraction_whisper.WhisperFeatureExtractor
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorType, logging from ...audio_utils import mel_filter_bank, spectrogram, window_function import numpy as np from ... import is_torch_available from typing import Option...
class WhisperFeatureExtractor(SequenceFeatureExtractor): ''' Constructs a Whisper 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 r...
7
5
50
6
32
12
5
0.5
1
10
1
0
4
7
5
22
284
39
164
60
131
82
83
33
77
15
3
3
26
6,136
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/generation_whisper.py
transformers.models.whisper.generation_whisper.WhisperGenerationMixin
import zlib from ...generation.logits_process import LogitsProcessorList, SuppressTokensAtBeginLogitsProcessor, SuppressTokensLogitsProcessor, WhisperNoSpeechDetection, WhisperTimeStampLogitsProcessor import torch import warnings from ...modeling_outputs import BaseModelOutput import numpy as np from ...generation impo...
null
52
5
54
6
38
10
7
0.27
1
25
8
1
12
2
30
30
1,760
220
1,217
337
1,051
330
616
197
582
27
1
5
238
6,137
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperAttention
from torch import nn from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...processing_utils import Unpack from .configuration_whisper import WhisperConfig from ...modeling_flash_attention_utils import FlashAttentionKwargs from ...utils.deprecation import deprecate_kwarg import torch from ...modeli...
class WhisperAttention(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, layer_idx: Optional[int]=None, config: Optional[WhisperConfig]=None): ...
4
2
40
5
31
4
5
0.14
1
8
2
2
3
13
3
13
125
19
94
47
71
13
58
28
54
11
1
2
15
6,138
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperDecoder
from .configuration_whisper import WhisperConfig from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, SequenceClassifierOutput import math import torch from ...masking_utils import create_causal_mask from ...c...
null
3
2
64
6
42
16
10
0.4
1
18
9
0
5
13
6
8
401
46
256
79
217
102
130
47
123
42
2
3
59
6,139
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperDecoderLayer
from ...activations import ACT2FN from ...utils.deprecation import deprecate_kwarg import torch from typing import Callable, Optional, Union from torch import nn from ...modeling_layers import GradientCheckpointingLayer from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from .configuration_whisper impo...
class WhisperDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: WhisperConfig, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]...
4
1
57
5
41
11
3
0.27
1
6
2
0
2
11
2
12
115
11
82
31
67
22
41
19
38
4
1
1
5
6,140
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperDecoderWrapper
class WhisperDecoderWrapper(WhisperPreTrainedModel): """ This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is used in combination with the [`EncoderDecoderModel`] framework. """ def __init__(self, config): super().__init__(config) ...
class WhisperDecoderWrapper(WhisperPreTrainedModel): ''' This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is used in combination with the [`EncoderDecoderModel`] framework. ''' def __init__(self, config): pass def get_input_em...
5
1
3
0
3
0
1
0.36
1
2
1
0
4
1
4
6
19
4
11
6
6
4
11
6
6
1
2
0
4
6,141
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperEncoder
from torch import nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, SequenceClassifierOutput from .configuration_whisper import WhisperConfig import math import torch class WhisperEncoder(WhisperPreTrai...
class WhisperEncoder(WhisperPreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`WhisperEncoderLayer`]. Args: config: WhisperConfig ''' def __init__(self, config: WhisperConfig): pass def _freeze_parameter...
6
2
28
4
19
6
5
0.36
1
8
3
0
5
13
5
7
151
24
94
39
80
34
65
31
59
19
2
3
25
6,142
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperEncoderLayer
from ...modeling_layers import GradientCheckpointingLayer from torch import nn import torch from .configuration_whisper import WhisperConfig from ...activations import ACT2FN class WhisperEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: WhisperConfig): super().__init__() self.e...
class WhisperEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: WhisperConfig): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor: ''' Args: hidd...
3
1
33
3
25
6
2
0.22
1
4
1
0
2
9
2
12
68
7
50
22
41
11
32
16
29
3
1
1
4
6,143
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperForAudioClassification
from torch import nn from ...utils import auto_docstring, logging from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, SequenceClassifierOutput from torch.nn import...
@auto_docstring(custom_intro='\n Whisper Encoder Model with a sequence classification head on top (a linear layer over the pooled output) for tasks\n like SUPERB Keyword Spotting.\n ') class WhisperForAudioClassification(WhisperPreTrainedModel): def __init__(self, config): pass def freeze_enc...
8
2
24
4
13
7
3
0.48
1
5
2
0
5
4
5
7
125
24
69
28
52
33
43
18
37
11
2
1
16
6,144
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperForCausalLM
from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from torch.nn import CrossEntropyLoss from ...generation import GenerationMixin from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, ...
@auto_docstring(custom_intro='\n Whisper decoder with a language modeling head on top (linear layer with weights tied to the input embeddings).\n ') class WhisperForCausalLM(WhisperPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass ...
11
1
19
2
9
9
2
0.94
2
8
3
0
8
2
9
11
188
25
84
38
57
79
43
21
33
8
2
1
17
6,145
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperForConditionalGeneration
from typing import Callable, Optional, Union from torch.nn import CrossEntropyLoss from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from .generation_whisper import WhisperGenerationMixin from .configuration_whisper import WhisperConfig from torch import nn from ...utils import auto_docstring, logging...
@auto_docstring(custom_intro='\n The Whisper Model with a language modeling head. Can be used for automatic speech recognition.\n ') class WhisperForConditionalGeneration(WhisperGenerationMixin, WhisperPreTrainedModel): def __init__(self, config: WhisperConfig): pass def get_encoder(self): ...
11
2
16
2
11
3
2
0.3
2
8
4
0
8
3
8
40
140
22
91
39
61
27
39
19
30
8
2
2
15
6,146
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperModel
import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, SequenceClassifierOutput from ...
@auto_docstring class WhisperModel(WhisperPreTrainedModel): def __init__(self, config: WhisperConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def get_encoder(self): pass def freeze_encoder(self): ''' ...
10
3
20
2
14
4
3
0.28
1
9
6
1
8
2
8
10
166
20
114
38
81
32
43
15
34
10
2
1
20
6,147
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperPositionalEmbedding
from typing import Callable, Optional, Union from torch import nn class WhisperPositionalEmbedding(nn.Embedding): def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): super().__init__(num_positions, embedding_dim) def forward(self, input_ids, past_key_values_le...
class WhisperPositionalEmbedding(nn.Embedding): def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): pass def forward(self, input_ids, past_key_values_length=0, position_ids=None): pass
3
0
4
0
4
0
2
0
1
2
0
0
2
0
2
2
9
1
8
3
5
0
7
3
4
2
1
1
3
6,148
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/modeling_whisper.py
transformers.models.whisper.modeling_whisper.WhisperPreTrainedModel
import torch from ...utils import auto_docstring, logging from torch import nn from .configuration_whisper import WhisperConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel @auto_docstring class WhisperPreTrainedModel(PreTrainedModel): config: WhisperConfig base_model_prefix = 'model'...
@auto_docstring class WhisperPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTensor): ''' Computes the output length of the convolutional layers ''' pass
4
1
11
1
9
2
4
0.11
1
1
1
7
2
0
2
2
33
3
27
14
24
3
25
14
22
6
1
2
7
6,149
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/processing_whisper.py
transformers.models.whisper.processing_whisper.WhisperProcessor
from ...processing_utils import ProcessorMixin class WhisperProcessor(ProcessorMixin): """ Constructs a Whisper processor which wraps a Whisper feature extractor and a Whisper tokenizer into a single processor. [`WhisperProcessor`] offers all the functionalities of [`WhisperFeatureExtractor`] and [`Wh...
class WhisperProcessor(ProcessorMixin): ''' Constructs a Whisper processor which wraps a Whisper feature extractor and a Whisper tokenizer into a single processor. [`WhisperProcessor`] offers all the functionalities of [`WhisperFeatureExtractor`] and [`WhisperTokenizer`]. See the [`~WhisperProcesso...
5
2
9
1
6
2
2
0.68
1
3
0
0
6
2
6
23
76
14
37
16
30
25
35
16
28
8
2
1
13
6,150
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/tokenization_whisper.py
transformers.models.whisper.tokenization_whisper.WhisperTokenizer
import numpy as np from functools import lru_cache import json import warnings from .english_normalizer import BasicTextNormalizer, EnglishTextNormalizer import os from ...tokenization_utils import AddedToken, PreTrainedTokenizer import regex as re from typing import Optional, Union class WhisperTokenizer(PreTrainedTo...
null
36
16
20
2
14
5
3
0.41
1
16
2
0
28
15
30
119
699
81
441
165
366
180
300
117
269
11
3
4
101
6,151
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/whisper/tokenization_whisper_fast.py
transformers.models.whisper.tokenization_whisper_fast.WhisperTokenizerFast
from .tokenization_whisper import LANGUAGES, TASK_IDS, TO_LANGUAGE_CODE, WhisperTokenizer, _decode_asr from typing import Optional import re from ...tokenization_utils_fast import PreTrainedTokenizerFast from .english_normalizer import BasicTextNormalizer, EnglishTextNormalizer from functools import lru_cache import nu...
null
29
12
21
2
14
5
3
0.51
1
15
3
0
22
6
24
112
591
73
342
128
281
176
211
90
186
11
3
4
74
6,152
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/configuration_x_clip.py
transformers.models.x_clip.configuration_x_clip.XCLIPConfig
from ...configuration_utils import PretrainedConfig class XCLIPConfig(PretrainedConfig): """ [`XCLIPConfig`] is the configuration class to store the configuration of a [`XCLIPModel`]. It is used to instantiate X-CLIP model according to the specified arguments, defining the text model and vision model confi...
class XCLIPConfig(PretrainedConfig): ''' [`XCLIPConfig`] is the configuration class to store the configuration of a [`XCLIPModel`]. It is used to instantiate X-CLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating a configuration with the defau...
2
1
57
8
38
12
8
0.69
1
4
2
0
1
11
2
2
155
20
80
36
63
55
50
22
47
14
1
4
15
6,153
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/configuration_x_clip.py
transformers.models.x_clip.configuration_x_clip.XCLIPTextConfig
from ...configuration_utils import PretrainedConfig class XCLIPTextConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`XCLIPModel`]. It is used to instantiate an X-CLIP model according to the specified arguments, defining the model architecture. Instantiating a c...
class XCLIPTextConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`XCLIPModel`]. It is used to instantiate an X-CLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simi...
2
1
31
1
30
0
1
1.33
1
1
0
0
1
11
1
1
88
11
33
32
14
44
16
15
14
1
1
0
1
6,154
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/configuration_x_clip.py
transformers.models.x_clip.configuration_x_clip.XCLIPVisionConfig
from ...configuration_utils import PretrainedConfig class XCLIPVisionConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`XCLIPModel`]. It is used to instantiate an X-CLIP model according to the specified arguments, defining the model architecture. Instantiating a...
class XCLIPVisionConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`XCLIPModel`]. It is used to instantiate an X-CLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a si...
2
1
42
1
41
0
1
1.2
1
1
0
0
1
18
1
1
108
11
44
43
21
53
23
22
21
1
1
0
1
6,155
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.PromptGeneratorLayer
from ...activations import ACT2FN from torch import nn class PromptGeneratorLayer(nn.Module): def __init__(self, config): super().__init__() embed_dim = config.projection_dim self.cross_attn = XCLIPCrossAttention(config) self.norm1 = nn.LayerNorm(embed_dim, eps=config.text_config.l...
class PromptGeneratorLayer(nn.Module): def __init__(self, config): pass def forward(self, x, visual): pass
3
0
9
1
8
0
1
0
1
2
1
0
2
4
2
12
19
2
17
8
14
0
12
8
9
1
1
0
2
6,156
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPAttention
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn import torch from typing import Any, Callable, Optional, Union class XCLIPAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__init__()...
class XCLIPAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, causal_attention_mask: Optional[torch.Tensor]=None, output_attentions: ...
3
2
32
5
25
2
4
0.11
1
5
0
0
3
10
3
13
102
19
75
30
65
8
54
24
50
8
1
2
11
6,157
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPCrossAttention
from torch import nn import torch class XCLIPCrossAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__init__() self.num_heads = config.prompt_num_attention_heads dim = config.projection_dim head_dim = d...
class XCLIPCrossAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config): pass def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): pass def forward(self, queries, keys, values): '''Input shape: Bat...
4
2
15
2
13
0
1
0.05
1
3
0
0
3
8
3
13
50
8
40
18
36
2
28
18
24
1
1
0
3
6,158
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPDropPath
from torch import nn import torch from typing import Any, Callable, Optional, Union class XCLIPDropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).""" def __init__(self, drop_prob: Optional[float]=None) -> None: super().__init__() sel...
class XCLIPDropPath(nn.Module): '''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).''' def __init__(self, drop_prob: Optional[float]=None) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass def extra_repr(self) -...
4
1
2
0
2
0
1
0.13
1
4
0
0
3
1
3
13
12
3
8
5
4
1
8
5
4
1
1
0
3
6,159
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPEncoder
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int import torch from torch import nn from typing import Any, Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling from .configuration_x_clip import XCLIPC...
class XCLIPEncoder(nn.Module): ''' Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a [`XCLIPEncoderLayer`]. Args: config: XCLIPConfig ''' def __init__(self, config: XCLIPConfig): pass @can_return_tuple def forward(self, ...
4
2
43
5
25
13
7
0.61
1
9
3
0
2
3
2
12
95
13
51
19
40
31
27
11
24
12
1
2
13
6,160
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPEncoderLayer
import torch from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig from torch import nn from ...modeling_layers import GradientCheckpointingLayer from typing import Any, Callable, Optional, Union class XCLIPEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: XCLIPConfi...
class XCLIPEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: XCLIPConfig): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]: ''' ...
3
1
23
3
16
5
2
0.31
1
6
3
0
2
5
2
12
48
6
32
17
23
10
21
11
18
2
1
1
3
6,161
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPMLP
from torch import nn from ...activations import ACT2FN import torch class XCLIPMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.activation_fn = ACT2FN[config.hidden_act] self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size) ...
class XCLIPMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
1
0
1
2
0
0
2
4
2
12
13
1
12
7
9
0
12
7
9
1
1
0
2
6,162
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int import copy from typing import Any, Callable, Optional, Union from torch import nn from .configuration_x_clip import XCLIPCo...
@auto_docstring class XCLIPModel(XCLIPPreTrainedModel): def __init__(self, config: XCLIPConfig): pass @filter_out_non_signature_kwargs() @auto_docstring def get_text_features(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch....
11
3
94
17
41
37
5
0.88
1
13
8
0
4
12
4
5
386
70
168
69
134
148
83
41
78
7
2
1
18
6,163
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPMultiframeIntegrationTransformer
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling from torch import nn from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig import torch from typing import Any, Callable, Optional, Union class XCLIPMultiframeIntegrationTransformer(nn.Module): """ This corr...
class XCLIPMultiframeIntegrationTransformer(nn.Module): ''' This corresponds to the `MultiframeIntegrationTransformer` class in the original implementation. ''' def __init__(self, config: XCLIPVisionConfig): pass def forward(self, hidden_states, output_attentions: Optional[bool]=None,...
3
1
19
4
15
1
2
0.13
1
6
4
0
2
2
2
12
44
9
31
15
22
4
15
9
12
2
1
1
3
6,164
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPOutput
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from dataclasses import dataclass from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling import torch from typing import Any, Callable, Optional, Union @dataclass @auto_docstring...
@dataclass @auto_docstring class XCLIPOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`): Contrastive loss for video-text similarity. logits_per_video (`torch.FloatTensor` of shape `(video_batch_size, text_batch_size)`): The...
4
1
7
0
7
0
2
1.38
1
2
0
0
1
0
1
1
40
2
16
10
14
22
11
10
9
2
1
0
2
6,165
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPPreTrainedModel
from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig from torch import nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int @auto_docstring class XCL...
@auto_docstring class XCLIPPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
46
1
44
1
10
0.1
1
6
6
3
1
0
1
1
56
3
48
9
46
5
37
9
35
10
1
2
10
6,166
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPPromptGenerator
import torch from torch import nn class XCLIPPromptGenerator(nn.Module): """This corresponds to the `VideoSpecificPrompt` class in the original implementation.""" def __init__(self, config): super().__init__() embed_dim = config.projection_dim self.layernorm = nn.LayerNorm(embed_dim, e...
class XCLIPPromptGenerator(nn.Module): '''This corresponds to the `VideoSpecificPrompt` class in the original implementation.''' def __init__(self, config): pass def forward(self, text, visual): pass
3
1
6
1
6
0
2
0.08
1
3
1
0
2
3
2
12
16
3
12
8
9
1
12
8
9
2
1
1
3
6,167
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPTextEmbeddings
import torch from torch import nn from typing import Any, Callable, Optional, Union from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig class XCLIPTextEmbeddings(nn.Module): def __init__(self, config: XCLIPTextConfig): super().__init__() embed_dim = config.hidden_size...
class XCLIPTextEmbeddings(nn.Module): def __init__(self, config: XCLIPTextConfig): pass def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None) -> torch.Tensor: pass
3
0
18
4
14
1
3
0.03
1
4
1
0
2
2
2
12
38
8
29
15
21
1
19
10
16
5
1
1
6
6,168
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPTextModel
from typing import Any, Callable, Optional, Union from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisio...
class XCLIPTextModel(XCLIPPreTrainedModel): def __init__(self, config: XCLIPTextConfig): pass def get_input_embeddings(self) -> nn.Module: pass def set_input_embeddings(self, value): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_...
6
1
11
1
6
3
1
0.45
1
6
3
0
4
1
4
5
51
9
29
16
14
13
12
7
7
1
2
0
4
6,169
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPTextTransformer
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int import torch from torch import nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig from ......
class XCLIPTextTransformer(nn.Module): def __init__(self, config: XCLIPTextConfig): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, output_attentions: Optional[bool]=None, output_...
4
0
35
5
25
5
4
0.17
1
8
4
0
2
4
2
12
73
11
53
23
40
9
27
14
24
7
1
1
8
6,170
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPVisionEmbeddings
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from torch import nn import torch from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig class XCLIPVisionEmbeddings(nn.Module): def __init__(self, config: XCLIPVision...
class XCLIPVisionEmbeddings(nn.Module): def __init__(self, config: XCLIPVisionConfig): pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor: ''' This method allows to interpolate the pre-trained position encodings, to be able to us...
4
1
26
5
19
3
2
0.16
1
5
1
0
3
9
3
13
81
16
57
27
53
9
43
27
39
3
1
1
6
6,171
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPVisionEncoder
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling import torch from torch import nn from typing import Any, Callable, Optional, Union from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig class XCLIPVisionEncoder(nn.Module): """ Transformer encoder consisti...
class XCLIPVisionEncoder(nn.Module): ''' Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a [`XCLIPVisionEncoderLayer`]. Args: config: XCLIPConfig ''' def __init__(self, config: XCLIPConfig): pass def forward(self, inputs_em...
3
2
43
5
25
13
7
0.61
1
9
3
0
2
3
2
12
95
13
51
19
40
31
27
11
24
12
1
2
13
6,172
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPVisionEncoderLayer
from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig import torch from typing import Any, Callable, Optional, Union from ...modeling_layers import GradientCheckpointingLayer from torch import nn class XCLIPVisionEncoderLayer(GradientCheckpointingLayer): """ This corresponds to the ...
class XCLIPVisionEncoderLayer(GradientCheckpointingLayer): ''' This corresponds to the `CrossFramelAttentionBlock` class in the original implementation. ''' def __init__(self, config: XCLIPConfig): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causa...
3
2
36
6
22
8
2
0.42
1
7
4
0
2
10
2
12
78
14
45
25
36
19
34
19
31
2
1
1
4
6,173
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPVisionModel
from typing import Any, Callable, Optional, Union from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig from ...modeling_outputs import BaseModelOutput, BaseModelOutputWith...
class XCLIPVisionModel(XCLIPPreTrainedModel): def __init__(self, config: XCLIPVisionConfig): pass def get_input_embeddings(self) -> nn.Module: pass @auto_docstring def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidden_s...
5
1
32
5
6
21
1
2.58
1
5
3
0
3
1
3
4
104
18
24
14
12
62
11
7
7
1
2
0
3
6,174
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/modeling_x_clip.py
transformers.models.x_clip.modeling_x_clip.XCLIPVisionTransformer
from .configuration_x_clip import XCLIPConfig, XCLIPTextConfig, XCLIPVisionConfig from torch import nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling from typing import Any, Callable, Optional, Union from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signatur...
class XCLIPVisionTransformer(nn.Module): ''' This corresponds to the `CrossFrameCommunicationTransformer` class in the original implementation. ''' def __init__(self, config: XCLIPVisionConfig): pass @auto_docstring def forward(self, pixel_values: torch.FloatTensor, output_attentio...
4
1
25
4
20
2
3
0.14
1
6
4
0
2
5
2
12
58
9
43
21
31
6
22
13
19
5
1
1
6
6,175
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/x_clip/processing_x_clip.py
transformers.models.x_clip.processing_x_clip.XCLIPProcessor
import warnings from ...processing_utils import ProcessorMixin class XCLIPProcessor(ProcessorMixin): """ Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor. [`XCLIPProcessor`] offers all the functionalities of [`VideoMAEImageProcessor`] and [...
class XCLIPProcessor(ProcessorMixin): ''' Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor. [`XCLIPProcessor`] offers all the functionalities of [`VideoMAEImageProcessor`] and [`CLIPTokenizerFast`]. See the [`~XCLIPProcessor.__call__`] a...
6
1
14
2
7
5
2
0.87
1
5
1
0
7
1
7
24
124
21
55
18
44
48
40
15
32
6
2
1
16
6,176
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/configuration_xglm.py
transformers.models.xglm.configuration_xglm.XGLMConfig
from ...configuration_utils import PretrainedConfig class XGLMConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`XGLMModel`]. It is used to instantiate an XGLM model according to the specified arguments, defining the model architecture. Instantiating a configura...
class XGLMConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`XGLMModel`]. It is used to instantiate an XGLM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar conf...
2
1
44
1
43
1
1
1
1
1
0
0
1
14
1
1
113
12
51
40
28
51
20
19
18
1
1
0
1
6,177
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/modeling_xglm.py
transformers.models.xglm.modeling_xglm.XGLMAttention
from ...utils.deprecation import deprecate_kwarg from torch import nn import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union class XGLMAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, embed...
class XGLMAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, embed_dim: int, num_heads: int, dropout: Optional[float]=0.0, is_decoder: Optional[bool]=False, bias: Optional[bool]=True, layer_idx: Optional[bool]=None): pass @deprecate_kwarg('...
4
2
49
7
35
8
5
0.23
1
6
0
0
3
10
3
13
152
23
105
40
86
24
69
25
65
13
1
2
16
6,178
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/modeling_xglm.py
transformers.models.xglm.modeling_xglm.XGLMDecoderLayer
from typing import Optional, Union from torch import nn import torch from ...utils.deprecation import deprecate_kwarg from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from .configuration_xglm import XGLMConfig from ...modeling_layers import GradientCheckpointingLayer from ...activations import ACT2FN...
class XGLMDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: XGLMConfig, layer_idx=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, encoder_hidden...
4
1
58
6
39
13
4
0.33
1
5
2
0
2
11
2
12
118
13
79
32
65
26
45
21
42
6
1
1
8
6,179
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/modeling_xglm.py
transformers.models.xglm.modeling_xglm.XGLMForCausalLM
from torch import nn from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch from ...utils import auto_docstring, logging from typing import Optional, Union from ...generation import GenerationMixin from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCro...
@auto_docstring(custom_intro='\n The XGLM Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ') class XGLMForCausalLM(XGLMPreTrainedModel, GenerationMixin): def __init__(self, config): pass @auto_docstring def forward(self, ...
5
1
14
1
11
1
2
0.09
2
6
2
0
6
3
7
8
113
15
90
38
58
8
35
19
27
7
2
1
14
6,180
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/modeling_xglm.py
transformers.models.xglm.modeling_xglm.XGLMModel
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions import math from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask import torch from typing import Optional, Union from ...utils import auto_docstring, logging from...
@auto_docstring class XGLMModel(XGLMPreTrainedModel): def __init__(self, config: XGLMConfig, embed_tokens: Optional[nn.Embedding]=None): ''' embed_tokens (`nn.Embedding`, *optional*): output embeddings ''' pass @auto_docstring def forward(self, input_ids: Optiona...
5
2
46
5
39
2
11
0.09
1
14
5
0
4
9
4
5
202
26
162
44
136
14
80
28
75
39
2
3
44
6,181
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/modeling_xglm.py
transformers.models.xglm.modeling_xglm.XGLMPreTrainedModel
from torch import nn from .configuration_xglm import XGLMConfig from ...utils import auto_docstring, logging from ...modeling_utils import PreTrainedModel @auto_docstring class XGLMPreTrainedModel(PreTrainedModel): config: XGLMConfig base_model_prefix = 'model' supports_gradient_checkpointing = True _n...
@auto_docstring class XGLMPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
10
0
10
0
5
0
1
0
0
2
1
0
1
1
16
1
15
7
13
0
14
7
12
5
1
2
5
6,182
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/modeling_xglm.py
transformers.models.xglm.modeling_xglm.XGLMScaledWordEmbedding
from torch import nn from typing import Optional, Union import torch class XGLMScaledWordEmbedding(nn.Embedding): """ This module overrides nn.Embeddings' forward by multiplying with embeddings scale. """ def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Option...
class XGLMScaledWordEmbedding(nn.Embedding): ''' This module overrides nn.Embeddings' forward by multiplying with embeddings scale. ''' def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0): pass def forward(self, input_ids: torch....
3
1
3
0
3
0
1
0.5
1
4
0
0
2
1
2
2
11
2
6
4
3
3
6
4
3
1
1
0
2
6,183
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/modeling_xglm.py
transformers.models.xglm.modeling_xglm.XGLMSinusoidalPositionalEmbedding
from torch import nn from typing import Optional, Union import torch import math class XGLMSinusoidalPositionalEmbedding(nn.Module): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): s...
class XGLMSinusoidalPositionalEmbedding(nn.Module): '''This module produces sinusoidal positional embeddings of any length.''' def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): pass def make_weights(self, num_embeddings: int, embedding_dim: int, padding_...
7
2
11
1
7
2
2
0.28
1
3
0
0
3
3
4
14
50
9
32
15
25
9
30
13
25
3
1
1
8
6,184
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/tokenization_xglm.py
transformers.models.xglm.tokenization_xglm.XGLMTokenizer
from typing import Any, Optional from shutil import copyfile import sentencepiece as spm from ...utils.import_utils import requires import os from ...tokenization_utils import PreTrainedTokenizer @requires(backends=('sentencepiece',)) class XGLMTokenizer(PreTrainedTokenizer): """ Adapted from [`RobertaTokenize...
@requires(backends=('sentencepiece',)) class XGLMTokenizer(PreTrainedTokenizer): ''' Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. ...
16
7
14
2
8
4
2
0.88
1
6
0
0
13
8
13
102
264
55
111
53
79
98
77
34
63
5
3
2
26
6,185
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xglm/tokenization_xglm_fast.py
transformers.models.xglm.tokenization_xglm_fast.XGLMTokenizerFast
from typing import Optional import os from shutil import copyfile from ...tokenization_utils_fast import PreTrainedTokenizerFast class XGLMTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" XGLM tokenizer (backed by HuggingFace's *tokenizers* library). Adapted from [`RobertaTokenizer`] and [`XL...
class XGLMTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" XGLM tokenizer (backed by HuggingFace's *tokenizers* library). Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on [BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models). ...
5
3
20
3
12
5
2
0.92
1
6
0
0
5
2
5
93
158
31
66
31
44
61
33
15
27
5
3
1
12
6,186
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/configuration_xlm.py
transformers.models.xlm.configuration_xlm.XLMConfig
from ...configuration_utils import PretrainedConfig class XLMConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`XLMModel`] or a [`TFXLMModel`]. It is used to instantiate a XLM model according to the specified arguments, defining the model architecture. Instantia...
class XLMConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`XLMModel`] or a [`TFXLMModel`]. It is used to instantiate a XLM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yiel...
2
2
74
2
71
1
2
1.25
1
1
0
0
1
32
1
1
194
17
79
72
41
99
38
36
36
2
1
1
2
6,187
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/configuration_xlm.py
transformers.models.xlm.configuration_xlm.XLMOnnxConfig
from collections import OrderedDict from ...onnx import OnnxConfig from collections.abc import Mapping class XLMOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: if self.task == 'multiple-choice': dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequence'} ...
class XLMOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass
3
0
12
0
12
0
2
0
1
3
0
0
1
0
1
1
14
0
14
4
11
0
6
3
4
2
1
1
2
6,188
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.MultiHeadAttention
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from torch import nn import math from ...cache_utils import DynamicCache, EncoderDecoderCache import torch class MultiHeadAttention(nn.Module): def __init__(self, n_heads, dim, config, layer_idx: int=0): ...
class MultiHeadAttention(nn.Module): def __init__(self, n_heads, dim, config, layer_idx: int=0): pass def prune_heads(self, heads): pass def forward(self, input, mask, kv=None, cache=None, head_mask=None, output_attentions=False, cache_position=None): ''' Self-attention (...
4
1
19
2
14
6
3
0.37
1
2
0
0
3
9
3
13
94
13
70
31
64
26
67
31
61
11
1
3
16
6,189
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.TransformerFFN
from ...activations import gelu, get_activation from torch import nn from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer class TransformerFFN(nn.Module): def __init__(self, in_dim, dim_hidden, out_dim, config): super().__init__() self.dropou...
class TransformerFFN(nn.Module): def __init__(self, in_dim, dim_hidden, out_dim, config): pass def forward(self, input): pass def ff_chunk(self, input): pass
4
0
5
0
5
0
1
0
1
1
0
0
3
6
3
13
19
2
17
11
13
0
17
11
13
2
1
0
4
6,190
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMForMultipleChoice
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...utils import ModelOutput, auto_...
@auto_docstring class XLMForMultipleChoice(XLMPreTrainedModel): def __init__(self, config, *inputs, **kwargs): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, langs: Optional[torch.Tensor]=None, token_type_ids: Optional[tor...
5
1
43
4
36
4
7
0.09
1
6
2
0
2
3
2
5
94
9
78
29
54
7
32
13
29
13
2
1
14
6,191
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMForQuestionAnswering
import torch from typing import Callable, Optional, Union from ...utils import ModelOutput, auto_docstring, logging @auto_docstring class XLMForQuestionAnswering(XLMPreTrainedModel): def __init__(self, config): super().__init__(config) self.transformer = XLMModel(config) self.qa_outputs = ...
@auto_docstring class XLMForQuestionAnswering(XLMPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, langs: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None,...
5
1
54
7
31
17
2
0.51
1
6
2
0
2
2
2
5
112
14
65
28
41
33
14
8
11
3
2
1
4
6,192
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMForQuestionAnsweringSimple
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...utils import ModelOutput, auto_...
@auto_docstring(custom_intro='\n XLM Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear\n layers on top of the hidden-states output to compute `span start logits` and `span end logits`).\n ') class XLMForQuestionAnsweringSimple(XLMPreTrainedModel): de...
5
1
44
5
33
7
4
0.18
1
6
2
0
2
2
2
5
95
10
72
32
47
13
31
15
28
7
2
2
8
6,193
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMForSequenceClassification
from ...utils import ModelOutput, auto_docstring, logging from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from torch.nn import BCEWithLogitsLoss, CrossEn...
@auto_docstring(custom_intro='\n XLM Model with a sequence classification/regression head on top (a linear layer on top of the pooled output) e.g.\n for GLUE tasks.\n ') class XLMForSequenceClassification(XLMPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(sel...
5
1
43
4
35
4
7
0.09
1
7
2
0
2
4
2
5
93
9
77
28
53
7
33
12
30
12
2
3
13
6,194
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMForTokenClassification
from ...utils import ModelOutput, auto_docstring, logging import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOut...
@auto_docstring class XLMForTokenClassification(XLMPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, langs: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=Non...
5
1
34
4
27
3
3
0.08
1
6
2
0
2
4
2
5
75
9
61
29
37
5
22
13
19
5
2
1
6
6,195
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMModel
from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils import Dynamic...
@auto_docstring class XLMModel(XLMPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings): pass def _prune_heads(self, heads_to_prune): ''' Prunes heads of the model. heads_to_prune...
8
2
43
5
27
12
7
0.4
1
13
3
0
5
22
5
8
227
31
144
58
117
58
110
42
104
23
2
3
34
6,196
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMPreTrainedModel
from ...modeling_utils import PreTrainedModel from torch import nn from .configuration_xlm import XLMConfig import torch from ...utils import ModelOutput, auto_docstring, logging @auto_docstring class XLMPreTrainedModel(PreTrainedModel): config: XLMConfig base_model_prefix = 'transformer' def __init__(sel...
@auto_docstring class XLMPreTrainedModel(PreTrainedModel): def __init__(self, *inputs, **kwargs): pass @property def dummy_inputs(self): pass def _init_weights(self, module): '''Initialize the weights.''' pass
6
1
10
0
9
0
4
0.15
1
2
1
7
3
0
3
3
42
4
33
11
28
5
29
10
25
9
1
3
12
6,197
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMPredLayer
from torch import nn class XLMPredLayer(nn.Module): """ Prediction layer (cross_entropy or adaptive_softmax). """ def __init__(self, config): super().__init__() self.asm = config.asm self.n_words = config.n_words self.pad_index = config.pad_index dim = config.em...
class XLMPredLayer(nn.Module): ''' Prediction layer (cross_entropy or adaptive_softmax). ''' def __init__(self, config): pass def forward(self, x, y=None): '''Compute the loss, and optionally the scores.''' pass
3
2
17
1
16
1
3
0.16
1
1
0
0
2
4
2
12
40
4
32
12
29
5
24
12
21
4
1
2
6
6,198
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/modeling_xlm.py
transformers.models.xlm.modeling_xlm.XLMWithLMHeadModel
from ...generation import GenerationMixin from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...utils import ModelOutput, auto_docstring, logging impor...
@auto_docstring(custom_intro='\n The XLM Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ') class XLMWithLMHeadModel(XLMPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): ...
8
1
16
1
13
2
2
0.13
2
7
3
0
5
2
5
8
92
12
72
34
43
9
29
17
23
5
2
1
10
6,199
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/xlm/tokenization_xlm.py
transformers.models.xlm.tokenization_xlm.XLMTokenizer
from typing import Optional import json import os import sys from ...tokenization_utils import PreTrainedTokenizer class XLMTokenizer(PreTrainedTokenizer): """ Construct an XLM tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following: - Moses preprocessing and tokenization for mos...
class XLMTokenizer(PreTrainedTokenizer): ''' Construct an XLM tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following: - Moses preprocessing and tokenization for most supported languages. - Language specific tokenization for Chinese (Jieba), Japanese (KyTea) and Thai (PyThaiNL...
21
7
21
2
14
4
3
0.46
1
13
0
0
19
14
19
108
468
64
277
101
218
127
195
63
170
15
3
3
58