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
4,100
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenDecoder
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, ModelOutput, Seq2SeqLMOutput from typing import TYPE_CHECKING, Any, Callable, Optional, Union import torch.nn as nn import torch import random from .configuration_musicgen import MusicgenConfig...
class MusicgenDecoder(MusicgenPreTrainedModel): ''' Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`MusicgenDecoderLayer`] ''' def __init__(self, config: MusicgenDecoderConfig): pass @auto_docstring def forward(self, input_ids: Optional[torch.Long...
6
2
51
6
41
4
12
0.11
1
12
4
0
4
12
4
5
212
27
166
49
146
19
85
33
80
42
2
3
46
4,101
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenDecoderLayer
from ...activations import ACT2FN from ...modeling_layers import GradientCheckpointingLayer from .configuration_musicgen import MusicgenConfig, MusicgenDecoderConfig from typing import TYPE_CHECKING, Any, Callable, Optional, Union from ...utils.deprecation import deprecate_kwarg import torch.nn as nn import torch from ...
class MusicgenDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: MusicgenDecoderConfig, 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,...
4
1
59
6
41
13
4
0.31
1
4
1
0
2
11
2
12
121
12
83
32
69
26
44
21
41
6
1
1
7
4,102
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenForCausalLM
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, ModelOutput, Seq2SeqLMOutput import copy from torch.nn import CrossEntropyLoss from typing import TYPE_CHECKING, Any, Callable, Optional, Union import torch.nn as nn from ...generation import C...
null
17
4
36
5
21
10
3
0.47
2
11
5
0
11
3
12
13
448
71
257
91
202
121
130
49
117
10
2
2
38
4,103
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenForConditionalGeneration
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, ModelOutput, Seq2SeqLMOutput import inspect from ..auto.modeling_auto import AutoModel import copy from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from typing import TYPE...
null
27
9
44
6
28
9
5
0.32
2
21
10
0
22
6
24
24
1,086
177
690
196
581
221
349
114
322
18
1
3
115
4,104
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, ModelOutput, Seq2SeqLMOutput from typing import TYPE_CHECKING, Any, Callable, Optional, Union import torch.nn as nn from .configuration_musicgen import MusicgenConfig, MusicgenDecoderConfig imp...
@auto_docstring class MusicgenModel(MusicgenPreTrainedModel): def __init__(self, config: MusicgenDecoderConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=No...
7
1
12
1
11
0
2
0.04
1
6
3
0
5
1
5
6
65
7
56
23
35
2
20
8
14
6
2
1
10
4,105
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenPreTrainedModel
import torch.nn as nn from .configuration_musicgen import MusicgenConfig, MusicgenDecoderConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils import auto_docstring, is_torch_flex_attn_available, logging @auto_docstring class MusicgenPreTrainedModel(PreTrainedModel): config: M...
@auto_docstring class MusicgenPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
10
0
10
0
5
0.24
1
0
0
3
1
0
1
1
23
2
17
9
15
4
16
9
14
5
1
2
5
4,106
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenSinusoidalPositionalEmbedding
import torch.nn as nn import math import torch class MusicgenSinusoidalPositionalEmbedding(nn.Module): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int): super().__init__() self.embedding_dim = embedding_dim ...
class MusicgenSinusoidalPositionalEmbedding(nn.Module): '''This module produces sinusoidal positional embeddings of any length.''' def __init__(self, num_positions: int, embedding_dim: int): pass def make_weights(self, num_embeddings: int, embedding_dim: int): pass @staticmethod d...
7
2
9
0
7
2
2
0.31
1
3
0
0
3
2
4
14
43
5
29
14
22
9
27
12
22
2
1
1
7
4,107
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py
transformers.models.musicgen.modeling_musicgen.MusicgenUnconditionalInput
import torch.nn as nn from dataclasses import dataclass import torch from ...utils import auto_docstring, is_torch_flex_attn_available, logging from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, ModelOutput, Seq2SeqLMOutput from typing import T...
@dataclass @auto_docstring class MusicgenUnconditionalInput(ModelOutput): ''' encoder_outputs (`tuple[torch.FloatTensor]` of length 1, with tensor shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of the text encoder model. attention_mask ...
3
1
0
0
0
0
0
2.75
1
0
0
0
0
0
0
0
16
1
4
4
3
11
4
4
3
0
1
0
0
4,108
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/processing_musicgen.py
transformers.models.musicgen.processing_musicgen.MusicgenProcessor
import numpy as np from typing import Any from ...processing_utils import ProcessorMixin from ...utils import to_numpy class MusicgenProcessor(ProcessorMixin): """ Constructs a MusicGen processor which wraps an EnCodec feature extractor and a T5 tokenizer into a single processor class. [`MusicgenProce...
class MusicgenProcessor(ProcessorMixin): ''' Constructs a MusicGen processor which wraps an EnCodec feature extractor and a T5 tokenizer into a single processor class. [`MusicgenProcessor`] offers all the functionalities of [`EncodecFeatureExtractor`] and [`TTokenizer`]. See [`~MusicgenProcessor.__...
6
4
15
2
10
3
3
0.51
1
4
0
0
6
2
6
23
115
23
61
23
54
31
56
23
49
9
2
2
18
4,109
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/configuration_musicgen_melody.py
transformers.models.musicgen_melody.configuration_musicgen_melody.MusicgenMelodyConfig
from ..auto.configuration_auto import AutoConfig from ...configuration_utils import PretrainedConfig class MusicgenMelodyConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MusicgenMelodyModel`]. It is used to instantiate a Musicgen Melody model according to the ...
class MusicgenMelodyConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MusicgenMelodyModel`]. It is used to instantiate a Musicgen Melody model according to the specified arguments, defining the text encoder, audio encoder and Musicgen Melody decoder configs...
6
2
16
2
12
2
1
1.22
1
4
2
0
2
6
3
3
122
22
45
31
28
55
23
18
19
2
1
1
4
4,110
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/configuration_musicgen_melody.py
transformers.models.musicgen_melody.configuration_musicgen_melody.MusicgenMelodyDecoderConfig
from ...configuration_utils import PretrainedConfig class MusicgenMelodyDecoderConfig(PretrainedConfig): """ This is the configuration class to store the configuration of an [`MusicgenMelodyDecoder`]. It is used to instantiate a Musicgen Melody decoder according to the specified arguments, defining the mod...
class MusicgenMelodyDecoderConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of an [`MusicgenMelodyDecoder`]. It is used to instantiate a Musicgen Melody decoder according to the specified arguments, defining the model architecture. Instantiating a configuration w...
2
1
51
2
49
1
2
0.96
1
2
0
0
1
16
1
1
110
7
53
44
28
51
24
21
22
2
1
1
2
4,111
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/feature_extraction_musicgen_melody.py
transformers.models.musicgen_melody.feature_extraction_musicgen_melody.MusicgenMelodyFeatureExtractor
from ...utils.import_utils import requires from ...feature_extraction_sequence_utils import SequenceFeatureExtractor import copy from ...feature_extraction_utils import BatchFeature from ...audio_utils import chroma_filter_bank from ...utils import TensorType, is_torch_available, is_torchaudio_available, logging import...
@requires(backends=('torchaudio',)) class MusicgenMelodyFeatureExtractor(SequenceFeatureExtractor): ''' Constructs a MusicgenMelody feature extractor. This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains most of the main methods. Users shoul...
7
5
49
7
27
15
5
0.77
1
10
1
0
5
8
5
22
293
48
139
51
110
107
76
28
70
13
3
1
25
4,112
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyAttention
from typing import TYPE_CHECKING, Any, Callable, Optional, Union from .configuration_musicgen_melody import MusicgenMelodyConfig, MusicgenMelodyDecoderConfig import torch.nn as nn from ...modeling_flash_attention_utils import FlashAttentionKwargs from ...processing_utils import Unpack import torch from ...modeling_util...
class MusicgenMelodyAttention(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, is_causal: Optional[bool]=False, config: Optional[Musicgen...
4
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
4,113
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyDecoder
from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput from typing import TYPE_CHECKING, Any, Callable, Optional, Union from .configuration_musicgen_melody import MusicgenMelodyConfig, MusicgenMelodyDecoderConfig from ...utils import auto_docstring, is_torch_flex_attn_available, logging import torch.nn as...
class MusicgenMelodyDecoder(MusicgenMelodyPreTrainedModel): ''' Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`MusicgenMelodyDecoderLayer`] ''' def __init__(self, config: MusicgenMelodyDecoderConfig): pass @auto_docstring def forward(self, input_...
6
2
45
7
36
3
10
0.12
1
11
4
0
4
12
4
5
191
30
144
46
125
17
85
31
80
37
2
3
41
4,114
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyDecoderLayer
from ...modeling_layers import GradientCheckpointingLayer from typing import TYPE_CHECKING, Any, Callable, Optional, Union from .configuration_musicgen_melody import MusicgenMelodyConfig, MusicgenMelodyDecoderConfig from ...utils.deprecation import deprecate_kwarg from ...activations import ACT2FN import torch from ......
class MusicgenMelodyDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: MusicgenMelodyDecoderConfig, 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.T...
4
1
39
5
27
8
3
0.28
1
4
1
0
2
9
2
12
79
10
54
24
43
15
32
16
29
4
1
1
5
4,115
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyForCausalLM
import copy from torch.nn import CrossEntropyLoss from typing import TYPE_CHECKING, Any, Callable, Optional, Union from .configuration_musicgen_melody import MusicgenMelodyConfig, MusicgenMelodyDecoderConfig from ...utils import auto_docstring, is_torch_flex_attn_available, logging import torch.nn as nn from ...generat...
null
17
4
37
5
21
10
3
0.48
2
11
5
0
11
3
12
13
458
74
260
88
208
125
135
49
122
10
2
2
40
4,116
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyForConditionalGeneration
from ...generation import ClassifierFreeGuidanceLogitsProcessor, GenerationConfig, GenerationMixin, GenerationMode, LogitsProcessorList, StoppingCriteriaList from ..auto.modeling_auto import AutoModel, AutoModelForTextEncoding import torch from ..auto.configuration_auto import AutoConfig from ...modeling_utils import A...
null
25
8
44
6
28
9
5
0.33
2
17
8
0
21
7
22
22
995
160
627
177
522
210
330
95
307
18
1
3
116
4,117
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyModel
from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput from typing import TYPE_CHECKING, Any, Callable, Optional, Union from .configuration_musicgen_melody import MusicgenMelodyConfig, MusicgenMelodyDecoderConfig from ...utils import auto_docstring, is_torch_flex_attn_available, logging import torch.nn as...
@auto_docstring class MusicgenMelodyModel(MusicgenMelodyPreTrainedModel): def __init__(self, config: MusicgenMelodyDecoderConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass @auto_docstring def forward(self, input_ids: Optional[to...
7
1
11
1
10
0
2
0.06
1
6
3
0
5
1
5
6
63
7
53
22
33
3
20
8
14
6
2
1
10
4,118
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyOutputWithPast
from ...utils import auto_docstring, is_torch_flex_attn_available, logging from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Callable, Optional, Union import torch.nn as nn from ...modeling_outputs import BaseModelOu...
@dataclass @auto_docstring(custom_intro='\n Base class for Musicgen Melody autoregressive outputs.\n ') class MusicgenMelodyOutputWithPast(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-token prediction...
3
1
0
0
0
0
0
3.57
1
0
0
0
0
0
0
0
37
5
7
7
6
25
7
7
6
0
1
0
0
4,119
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodyPreTrainedModel
from .configuration_musicgen_melody import MusicgenMelodyConfig, MusicgenMelodyDecoderConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils import auto_docstring, is_torch_flex_attn_available, logging import torch.nn as nn @auto_docstring class MusicgenMelodyPreTrainedModel(PreTra...
@auto_docstring class MusicgenMelodyPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
10
0
10
0
5
0.24
1
0
0
3
1
0
1
1
23
2
17
9
15
4
16
9
14
5
1
2
5
4,120
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
transformers.models.musicgen_melody.modeling_musicgen_melody.MusicgenMelodySinusoidalPositionalEmbedding
import math import torch import torch.nn as nn class MusicgenMelodySinusoidalPositionalEmbedding(nn.Module): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int): super().__init__() self.embedding_dim = embedding_...
class MusicgenMelodySinusoidalPositionalEmbedding(nn.Module): '''This module produces sinusoidal positional embeddings of any length.''' def __init__(self, num_positions: int, embedding_dim: int): pass def make_weights(self, num_embeddings: int, embedding_dim: int): pass @staticmethod...
7
2
9
0
7
2
2
0.34
1
3
0
0
3
2
4
14
44
5
29
14
22
10
27
12
22
2
1
1
7
4,121
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen_melody/processing_musicgen_melody.py
transformers.models.musicgen_melody.processing_musicgen_melody.MusicgenMelodyProcessor
from ...utils import to_numpy import numpy as np from ...processing_utils import ProcessorMixin from typing import Any from ...utils.import_utils import requires @requires(backends=('torchaudio',)) class MusicgenMelodyProcessor(ProcessorMixin): """ Constructs a MusicGen Melody processor which wraps a Wav2Vec2 ...
@requires(backends=('torchaudio',)) class MusicgenMelodyProcessor(ProcessorMixin): ''' Constructs a MusicGen Melody processor which wraps a Wav2Vec2 feature extractor - for raw audio waveform processing - and a T5 tokenizer into a single processor class. [`MusicgenProcessor`] offers all the functionalit...
8
5
17
3
7
7
2
1.24
1
4
0
0
7
0
7
24
149
28
54
21
46
67
49
21
41
6
2
1
16
4,122
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/configuration_mvp.py
transformers.models.mvp.configuration_mvp.MvpConfig
import warnings from ...configuration_utils import PretrainedConfig class MvpConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MvpModel`]. It is used to instantiate a MVP model according to the specified arguments, defining the model architecture. Instantiating...
class MvpConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MvpModel`]. It is used to instantiate a MVP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configur...
2
1
72
2
70
1
2
0.96
1
1
0
0
1
24
1
1
155
11
74
60
41
71
32
29
30
2
1
1
2
4,123
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpAttention
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 MvpAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, embed_...
class MvpAttention(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('p...
4
2
49
7
35
7
6
0.22
1
6
0
0
3
10
3
13
153
24
106
42
86
23
72
26
68
14
1
2
17
4,124
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpClassificationHead
import torch from torch import nn class MvpClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, input_dim: int, inner_dim: int, num_classes: int, pooler_dropout: float): super().__init__() self.dense = nn.Linear(input_dim, inner_dim) sel...
class MvpClassificationHead(nn.Module): '''Head for sentence-level classification tasks.''' def __init__(self, input_dim: int, inner_dim: int, num_classes: int, pooler_dropout: float): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
1
9
0
9
0
1
0.05
1
4
0
0
2
3
2
12
22
2
19
12
10
1
13
6
10
1
1
0
2
4,125
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpDecoder
from .configuration_mvp import MvpConfig from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput from ...cach...
class MvpDecoder(MvpPreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`MvpDecoderLayer`] Args: config: MvpConfig embed_tokens (nn.Embedding): output embedding use_prompt (bool): whether to use prompt ''' def __init__(se...
3
2
67
9
42
16
12
0.42
1
13
5
0
4
14
4
6
280
41
168
52
147
71
88
36
83
42
2
3
48
4,126
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpDecoderLayer
from .configuration_mvp import MvpConfig from torch import nn from ...utils.deprecation import deprecate_kwarg import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_layers import GradientCheckpointingLayer from ...activations import ACT2FN from typing import Optional, Union ...
class MvpDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: MvpConfig, 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_s...
4
1
61
6
41
15
4
0.35
1
5
2
0
2
11
2
12
123
12
82
34
66
29
44
21
41
6
1
1
7
4,127
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpDecoderWrapper
class MvpDecoderWrapper(MvpPreTrainedModel): """ 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) s...
class MvpDecoderWrapper(MvpPreTrainedModel): ''' 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 forward(self, *args,...
3
1
3
0
3
0
1
0.67
1
2
1
0
2
1
2
4
12
2
6
4
3
4
6
4
3
1
2
0
2
4,128
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpEncoder
from .configuration_mvp import MvpConfig from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput from typing ...
class MvpEncoder(MvpPreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`MvpEncoderLayer`]. Args: config: MvpConfig embed_tokens (nn.Embedding): output embedding use_prompt (bool): whether to use prompt ''' ...
3
2
45
7
29
10
8
0.39
1
12
5
0
4
13
4
6
194
31
118
41
102
46
74
30
69
27
2
3
33
4,129
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpEncoderLayer
from .configuration_mvp import MvpConfig from torch import nn import torch from ...modeling_layers import GradientCheckpointingLayer from ...activations import ACT2FN from typing import Optional, Union class MvpEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: MvpConfig): super().__init...
class MvpEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: MvpConfig): pass def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, layer_head_mask: torch.FloatTensor, self_attn_prompt: torch.FloatTensor, output_attentions: Optional[bool]=False) -> tu...
3
1
34
3
25
7
2
0.25
1
4
2
0
2
9
2
12
70
6
51
23
41
13
32
16
29
3
1
1
4
4,130
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpForCausalLM
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...generation import GenerationMixin from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestio...
class MvpForCausalLM(MvpPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def set_decoder(self, decoder): pass def get_decoder(self): pass def set_lig...
9
1
17
3
8
7
2
0.8
2
6
2
0
9
2
10
12
188
35
85
38
57
68
44
21
33
7
2
1
17
4,131
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpForConditionalGeneration
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from .configuration_mvp import MvpConfig from ...generation import GenerationMixin from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMO...
@auto_docstring(custom_intro='\n The MVP Model with a language modeling head. Can be used for various text generation tasks.\n ') class MvpForConditionalGeneration(MvpPreTrainedModel, GenerationMixin): def __init__(self, config: MvpConfig): pass def get_encoder(self): pass def get_d...
11
1
11
1
10
1
2
0.08
2
8
3
0
10
3
11
13
138
18
111
49
75
9
55
26
43
8
2
2
20
4,132
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpForQuestionAnswering
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClas...
@auto_docstring class MvpForQuestionAnswering(MvpPreTrainedModel): def __init__(self, config): pass def set_lightweight_tuning(self): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, decoder_input_ids: Optional[...
6
1
36
3
28
4
3
0.15
1
5
2
0
3
3
3
5
114
13
88
37
64
13
39
18
35
8
2
2
10
4,133
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpForSequenceClassification
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from .configuration_mvp import MvpConfig import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput,...
@auto_docstring(custom_intro='\n Mvp model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g. for GLUE\n tasks.\n ') class MvpForSequenceClassification(MvpPreTrainedModel): def __init__(self, config: MvpConfig, **kwargs): pass def set_lightweight_tuni...
6
1
37
3
32
2
6
0.07
1
10
4
0
3
2
3
5
118
11
101
33
78
7
43
15
39
15
2
3
17
4,134
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpLearnedPositionalEmbedding
import torch from typing import Optional, Union from torch import nn class MvpLearnedPositionalEmbedding(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. """ def __init__(self, num_embeddings: int, embedding_dim: int): self.offset = 2 super().__in...
class MvpLearnedPositionalEmbedding(nn.Embedding): ''' This module learns positional embeddings up to a fixed maximum size. ''' def __init__(self, num_embeddings: int, embedding_dim: int): pass def forward(self, input_ids: torch.Tensor, past_key_values_length: int=0, position_ids: Optiona...
3
2
7
1
5
2
1
0.6
1
3
0
0
2
1
2
2
20
4
10
6
7
6
8
6
5
1
1
0
2
4,135
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpModel
from .configuration_mvp import MvpConfig from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput from ...cach...
@auto_docstring class MvpModel(MvpPreTrainedModel): def __init__(self, config: MvpConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def get_encoder(self): pass def set_lightweight_tuning(self): pass @auto_d...
9
1
16
1
14
1
3
0.05
1
9
5
0
7
4
7
9
132
17
110
34
78
5
43
16
35
12
2
2
18
4,136
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpPreTrainedModel
from .configuration_mvp import MvpConfig from torch import nn import torch from ...utils import auto_docstring, logging from ...modeling_utils import PreTrainedModel @auto_docstring class MvpPreTrainedModel(PreTrainedModel): config: MvpConfig base_model_prefix = 'model' supports_gradient_checkpointing = Tr...
@auto_docstring class MvpPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass @property def dummy_inputs(self): pass
5
0
9
0
9
0
3
0
1
0
0
8
2
0
2
2
25
2
23
11
19
0
18
10
15
5
1
2
6
4,137
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/modeling_mvp.py
transformers.models.mvp.modeling_mvp.MvpPrompt
from torch import nn import torch class MvpPrompt(nn.Module): """Layer-wise prompt for encoder or decoder.""" def __init__(self, config, num_layers, num_heads): super().__init__() self.prompt_length = config.prompt_length self.num_layers = num_layers self.num_heads = num_heads ...
class MvpPrompt(nn.Module): '''Layer-wise prompt for encoder or decoder.''' def __init__(self, config, num_layers, num_heads): pass def forward(self, prompt_ids: torch.Tensor) -> tuple[torch.Tensor]: pass
3
1
10
0
10
0
1
0.05
1
2
0
0
2
7
2
12
23
2
20
11
17
1
16
11
13
1
1
0
2
4,138
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/tokenization_mvp.py
transformers.models.mvp.tokenization_mvp.MvpTokenizer
from ...tokenization_utils import AddedToken, PreTrainedTokenizer import json import os import regex as re from typing import Optional class MvpTokenizer(PreTrainedTokenizer): """ Constructs a MVP tokenizer, which is smilar to the RoBERTa tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer has ...
class MvpTokenizer(PreTrainedTokenizer): ''' Constructs a MVP tokenizer, which is smilar to the RoBERTa tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will be encoded differently whether it is...
15
8
17
1
13
4
3
0.62
1
11
0
0
13
9
13
102
318
50
167
71
132
104
122
46
108
9
3
3
39
4,139
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mvp/tokenization_mvp_fast.py
transformers.models.mvp.tokenization_mvp_fast.MvpTokenizerFast
from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...tokenization_utils_base import AddedToken, BatchEncoding from tokenizers import processors from typing import Optional import json from .tokenization_mvp import MvpTokenizer class MvpTokenizerFast(PreTrainedTokenizerFast): """ Construct a "...
class MvpTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" MVP tokenizer (backed by HuggingFace's *tokenizers* library), derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece...
11
4
18
2
13
3
4
0.82
1
6
1
0
8
1
8
96
237
44
106
45
77
87
65
25
56
14
3
2
28
4,140
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/myt5/tokenization_myt5.py
transformers.models.myt5.tokenization_myt5.ByteRewriter
import json from collections import defaultdict from typing import Optional, Union class ByteRewriter: """ Byte rewriter class for MyT5 tokenizer. This class is used to rewrite bytes using a hash tree. The hash tree is constructed from a set of rewriting rules. Args: rewriting_rules (`str` or ...
class ByteRewriter: ''' Byte rewriter class for MyT5 tokenizer. This class is used to rewrite bytes using a hash tree. The hash tree is constructed from a set of rewriting rules. Args: rewriting_rules (`str` or `dict[str, str]`): A path to a json file containing the rewriting rules ...
6
5
17
2
11
3
4
0.41
0
5
0
0
5
2
5
5
100
17
59
27
53
24
53
26
47
7
0
3
19
4,141
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/myt5/tokenization_myt5.py
transformers.models.myt5.tokenization_myt5.MyT5Tokenizer
import json import warnings from ...tokenization_utils import AddedToken, PreTrainedTokenizer from typing import Optional, Union import os class MyT5Tokenizer(PreTrainedTokenizer): """ Construct a MyT5 tokenizer. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods....
class MyT5Tokenizer(PreTrainedTokenizer): ''' Construct a MyT5 tokenizer. 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 (`str`): The file cont...
16
9
14
1
9
4
2
0.58
1
10
1
0
14
6
14
103
243
36
132
52
101
76
90
35
75
7
3
2
34
4,142
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/configuration_nemotron.py
transformers.models.nemotron.configuration_nemotron.NemotronConfig
from ...modeling_rope_utils import rope_config_validation from ...configuration_utils import PretrainedConfig class NemotronConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`NemotronModel`]. It is used to instantiate an Nemotron model according to the specified...
class NemotronConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`NemotronModel`]. It is used to instantiate an Nemotron model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a ...
2
1
51
1
50
0
2
1.25
1
1
0
0
1
17
1
1
128
9
53
45
27
66
23
21
21
2
1
0
2
4,143
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronAttention
import torch.nn.functional as F import torch import math from ...utils.deprecation import deprecate_kwarg from typing import Optional, Union from torch import Size, Tensor, nn from ...cache_utils import Cache, DynamicCache, StaticCache from .configuration_nemotron import NemotronConfig class NemotronAttention(nn.Modul...
class NemotronAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: NemotronConfig, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states...
4
1
40
8
32
2
4
0.06
1
6
2
2
2
16
2
12
84
17
64
38
51
4
50
28
47
5
1
1
7
4,144
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronDecoderLayer
from typing import Optional, Union from ...utils.deprecation import deprecate_kwarg from ...cache_utils import Cache, DynamicCache, StaticCache import torch import torch.nn.functional as F from .configuration_nemotron import NemotronConfig from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceCl...
class NemotronDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: NemotronConfig, layer_idx: int): 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, positi...
4
1
38
5
22
13
2
0.59
1
8
4
0
2
5
2
12
79
10
44
22
30
26
23
11
20
3
1
1
4
4,145
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronFlashAttention2
from ...cache_utils import Cache, DynamicCache, StaticCache from typing import Optional, Union from ...utils.deprecation import deprecate_kwarg import torch.nn.functional as F import torch from ...modeling_flash_attention_utils import _flash_attention_forward, flash_attn_supports_top_left_mask class NemotronFlashAtten...
class NemotronFlashAttention2(NemotronAttention): ''' Nemotron flash attention module. This module inherits from `NemotronAttention` as the weights of the module stays untouched. The only required change would be on the forward pass where it needs to correctly call the public API of flash attention and...
4
1
51
9
35
8
5
0.3
1
6
2
0
2
1
2
14
111
19
71
25
58
21
41
15
38
9
2
2
10
4,146
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronForCausalLM
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging from ...cache_utils import Cache, DynamicCache, StaticCache import torch.nn.functional as F from typing import Optional, Union import torch from torch import Size, Tensor, nn from ...generation import GenerationMixin from ...mo...
class NemotronForCausalLM(NemotronPreTrainedModel, GenerationMixin): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past...
5
1
14
2
8
4
2
0.4
2
8
3
0
8
3
8
9
122
21
72
35
45
29
35
19
26
8
2
1
15
4,147
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronForQuestionAnswering
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class NemotronForQuestionAnswering(GenericForQuestionAnswering, NemotronPreTrainedModel): base_model_prefix = 'transformer'
class NemotronForQuestionAnswering(GenericForQuestionAnswering, NemotronPreTrainedModel): pass
1
0
18
2
13
3
2
0.22
1
5
3
0
4
2
4
5
78
11
55
28
36
12
26
14
21
5
2
1
8
4,148
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronForSequenceClassification
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class NemotronForSequenceClassification(GenericForSequenceClassification, NemotronPreTrainedModel): ...
class NemotronForSequenceClassification(GenericForSequenceClassification, NemotronPreTrainedModel): pass
1
0
21
2
17
2
3
0.11
1
7
3
0
4
3
4
5
90
11
71
31
53
8
36
18
31
9
2
1
12
4,149
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronForTokenClassification
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class NemotronForTokenClassification(GenericForTokenClassification, NemotronPreTrainedModel): ...
class NemotronForTokenClassification(GenericForTokenClassification, NemotronPreTrainedModel): pass
1
0
17
1
14
2
3
0.11
1
5
2
0
4
4
4
5
79
8
64
28
41
7
29
15
24
5
2
1
10
4,150
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronLayerNorm1P
import torch.nn.functional as F import torch from typing import Optional, Union from torch import Size, Tensor, nn class NemotronLayerNorm1P(nn.LayerNorm): def __init__(self, normalized_shape: Union[int, list[int], Size], eps: float=1e-05, elementwise_affine: bool=True, bias: bool=True, device=None, dtype=None): ...
class NemotronLayerNorm1P(nn.LayerNorm): def __init__(self, normalized_shape: Union[int, list[int], Size], eps: float=1e-05, elementwise_affine: bool=True, bias: bool=True, device=None, dtype=None): pass def forward(self, input: Tensor) -> Tensor: pass
3
0
7
0
7
0
1
0
1
6
0
0
2
0
2
2
16
1
15
12
4
0
7
4
4
1
1
1
2
4,151
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronMLP
from ...activations import ACT2FN from torch import Size, Tensor, nn class NemotronMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.hidden_size = config.hidden_size self.intermediate_size = config.intermediate_size self.up_proj = nn.L...
class NemotronMLP(nn.Module): def __init__(self, config): pass def forward(self, x): pass
3
0
5
0
5
0
1
0
1
1
0
0
2
6
2
12
12
1
11
9
8
0
11
9
8
1
1
0
2
4,152
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronModel
from typing import Optional, Union from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast import torch from .configuration_nemotron import NemotronConfig from ...modeling_attn_mask_utils import AttentionMaskConverter from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_avai...
@auto_docstring class NemotronModel(NemotronPreTrainedModel): ''' Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`NemotronDecoderLayer`] Args: config: NemotronConfig ''' def __init__(self, config: NemotronConfig): pass @can_return_tuple ...
9
2
42
5
31
6
7
0.23
1
16
9
0
5
7
6
7
267
36
189
65
152
43
96
35
89
24
2
2
40
4,153
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronPreTrainedModel
from ...modeling_utils import PreTrainedModel from .configuration_nemotron import NemotronConfig from torch import Size, Tensor, nn from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging @auto_docstring class NemotronPreTrainedModel(PreTrainedModel): config: NemotronConfig ...
@auto_docstring class NemotronPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
10
0
10
0
5
0
1
0
0
5
1
0
1
1
22
1
21
13
19
0
20
13
18
5
1
2
5
4,154
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronRotaryEmbedding
import torch from torch import Size, Tensor, nn import torch.nn.functional as F from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update from .configuration_nemotron import NemotronConfig class NemotronRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: NemotronCon...
class NemotronRotaryEmbedding(nn.Module): def __init__(self, config: NemotronConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
19
2
13
4
2
0.34
1
4
1
0
3
7
3
13
61
9
41
25
32
14
36
20
32
3
1
1
7
4,155
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nemotron/modeling_nemotron.py
transformers.models.nemotron.modeling_nemotron.NemotronSdpaAttention
import torch.nn.functional as F import torch from ...cache_utils import Cache, DynamicCache, StaticCache from ...utils.deprecation import deprecate_kwarg from typing import Optional, Union class NemotronSdpaAttention(NemotronAttention): """ Nemotron attention module using torch.nn.functional.scaled_dot_product...
class NemotronSdpaAttention(NemotronAttention): ''' Nemotron attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from `NemotronAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to SDPA API. ''' @d...
3
1
81
13
62
6
8
0.19
1
4
1
0
1
0
1
13
89
14
63
22
50
12
33
11
31
8
2
1
8
4,156
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb/tokenization_nllb.py
transformers.models.nllb.tokenization_nllb.NllbTokenizer
from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from shutil import copyfile import os import sentencepiece as spm from typing import Any, Optional from ...utils.import_utils import requires @requires(backends=('sentencepiece',)) class NllbTokenizer(PreTrainedTokenizer): """ Con...
@requires(backends=('sentencepiece',)) class NllbTokenizer(PreTrainedTokenizer): ''' Construct an NLLB tokenizer. Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). The tokenization method is `<tokens> <eos> <language code>` f...
26
10
12
1
8
3
2
0.66
1
8
1
0
21
12
21
110
354
59
178
86
121
117
117
50
95
9
3
2
42
4,157
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb/tokenization_nllb_fast.py
transformers.models.nllb.tokenization_nllb_fast.NllbTokenizerFast
from ...tokenization_utils_fast import PreTrainedTokenizerFast from tokenizers import processors from shutil import copyfile import os from typing import Optional from ...tokenization_utils import AddedToken, BatchEncoding class NllbTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" NLLB tokenizer ...
class NllbTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" NLLB tokenizer (backed by HuggingFace's *tokenizers* library). Based on [BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] whi...
15
6
15
2
11
3
2
0.63
1
8
1
0
13
5
13
101
287
49
146
65
100
92
80
33
66
5
3
1
26
4,158
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/configuration_nllb_moe.py
transformers.models.nllb_moe.configuration_nllb_moe.NllbMoeConfig
from ...configuration_utils import PretrainedConfig class NllbMoeConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`NllbMoeModel`]. It is used to instantiate an NLLB-MoE model according to the specified arguments, defining the model architecture. Instantiating a...
class NllbMoeConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`NllbMoeModel`]. It is used to instantiate an NLLB-MoE model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a si...
2
1
87
1
86
1
2
1.03
1
2
0
0
1
34
1
1
193
11
90
80
47
93
42
39
40
2
1
1
2
4,159
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeAttention
from ...processing_utils import Unpack import torch.nn as nn from ...modeling_flash_attention_utils import FlashAttentionKwargs from .configuration_nllb_moe import NllbMoeConfig import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils.deprecation import deprecate_kwarg from ...c...
class NllbMoeAttention(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, is_causal: Optional[bool]=False, config: Optional[NllbMoeConfig]=...
4
2
50
7
35
8
5
0.24
1
7
1
0
3
12
3
13
156
23
107
44
86
26
68
27
64
12
1
2
15
4,160
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeDecoder
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask, _prepare_4d_causal_attention_mask_for_sdpa from typing import Callable, Optional, Union from ...modeling_outputs...
class NllbMoeDecoder(NllbMoePreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`NllbMoeDecoderLayer`] Args: config: NllbMoeConfig embed_tokens (nn.Embedding): output embedding ''' def __init__(self, confi...
5
2
137
21
82
35
21
0.48
1
13
5
0
2
9
2
3
286
45
164
50
146
78
86
35
83
36
2
4
41
4,161
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeDecoderLayer
from ...modeling_layers import GradientCheckpointingLayer import torch.nn as nn from .configuration_nllb_moe import NllbMoeConfig import torch from ...utils.deprecation import deprecate_kwarg from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...activat...
class NllbMoeDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: NllbMoeConfig, is_sparse: bool=False, 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:...
4
1
64
7
42
15
5
0.36
1
7
4
0
2
12
2
12
129
15
84
36
69
30
50
24
47
8
1
1
10
4,162
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeDenseActDense
from ...activations import ACT2FN from .configuration_nllb_moe import NllbMoeConfig import torch import torch.nn as nn class NllbMoeDenseActDense(nn.Module): def __init__(self, config: NllbMoeConfig, ffn_dim: int): super().__init__() self.fc1 = nn.Linear(config.d_model, ffn_dim) self.fc2 =...
class NllbMoeDenseActDense(nn.Module): def __init__(self, config: NllbMoeConfig, ffn_dim: int): pass def forward(self, hidden_states): pass
3
0
9
0
9
0
2
0
1
4
1
0
2
4
2
12
20
1
19
7
16
0
15
7
12
2
1
1
3
4,163
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeEncoder
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask, _prepare_4d_causal_attention_mask_for_sdpa from typing import Callable, Optional, Union from ...modeling_outputs import MoEModelOutput, MoEModelOutputWithPastAndCrossAttentions, Se...
class NllbMoeEncoder(NllbMoePreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`NllbMoeEncoderLayer`]. Args: config: NllbMoeConfig embed_tokens (nn.Embedding): output embedding ''' def ...
4
2
89
14
55
20
15
0.44
1
12
5
0
2
9
2
3
190
31
111
37
98
49
66
27
63
24
2
3
29
4,164
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeEncoderLayer
from ...modeling_layers import GradientCheckpointingLayer from .configuration_nllb_moe import NllbMoeConfig import torch import torch.nn as nn class NllbMoeEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: NllbMoeConfig, is_sparse: bool=False): super().__init__() self.embed_dim ...
class NllbMoeEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: NllbMoeConfig, is_sparse: bool=False): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool=False, output_router_logits: bool=False) ->...
3
1
39
5
27
7
4
0.25
1
7
4
0
2
8
2
12
79
10
55
23
45
14
35
16
32
5
1
1
7
4,165
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeForConditionalGeneration
from ...generation import GenerationMixin from .configuration_nllb_moe import NllbMoeConfig import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...modeling_outputs import MoEModelOutput, MoEModelOutputWithPastAndCrossAttentions, Seq2SeqMoEMo...
@auto_docstring(custom_intro='\n The NllbMoe Model with a language modeling head. Can be used for summarization.\n ') class NllbMoeForConditionalGeneration(NllbMoePreTrainedModel, GenerationMixin): def __init__(self, config: NllbMoeConfig): pass def get_encoder(self): pass def get_d...
8
1
19
2
16
1
3
0.08
2
7
3
0
7
4
8
9
164
22
132
54
100
11
67
33
58
13
2
2
25
4,166
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeModel
import math import torch.nn as nn from .configuration_nllb_moe import NllbMoeConfig import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...modeling_outputs import MoEModelOutput, MoEModelOutputWithPastAndCrossAttentions, Seq2SeqMoEModelOutpu...
@auto_docstring class NllbMoeModel(NllbMoePreTrainedModel): def __init__(self, config: NllbMoeConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def _tie_weights(self): pass def get_encoder(self): pass @auto...
9
1
17
2
13
3
2
0.21
1
9
6
0
7
3
7
8
133
19
94
34
65
20
33
15
25
8
2
1
16
4,167
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoePreTrainedModel
from ...utils import auto_docstring, is_torch_flex_attn_available, logging import torch.nn as nn from .configuration_nllb_moe import NllbMoeConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel @auto_docstring class NllbMoePreTrainedModel(PreTrainedModel): config: NllbMoeConfig base_mod...
@auto_docstring class NllbMoePreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module): '''Initialize the weights''' pass
3
1
11
0
10
1
5
0.07
1
0
0
4
1
0
1
1
17
1
15
7
13
1
14
7
12
5
1
2
5
4,168
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeScaledWordEmbedding
from typing import Callable, Optional, Union import torch import torch.nn as nn class NllbMoeScaledWordEmbedding(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...
class NllbMoeScaledWordEmbedding(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: tor...
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
4,169
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeSinusoidalPositionalEmbedding
from typing import Callable, Optional, Union import torch import torch.nn as nn import math class NllbMoeSinusoidalPositionalEmbedding(nn.Module): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=No...
class NllbMoeSinusoidalPositionalEmbedding(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, paddi...
11
4
13
2
9
3
2
0.34
1
3
0
0
4
3
5
15
76
13
47
22
37
16
38
18
32
3
1
1
10
4,170
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeSparseMLP
import torch.nn as nn from typing import Callable, Optional, Union from .configuration_nllb_moe import NllbMoeConfig import torch class NllbMoeSparseMLP(nn.Module): """ Implementation of the NLLB-MoE sparse MLP module. """ def __init__(self, config: NllbMoeConfig, ffn_dim: int, expert_class: nn.Module...
class NllbMoeSparseMLP(nn.Module): ''' Implementation of the NLLB-MoE sparse MLP module. ''' def __init__(self, config: NllbMoeConfig, ffn_dim: int, expert_class: nn.Module=NllbMoeDenseActDense): pass def forward(self, hidden_states: torch.Tensor, padding_mask: Optional[torch.Tensor]=Fals...
3
2
29
4
14
11
3
0.83
1
8
3
0
2
5
2
12
63
10
29
18
26
24
28
18
25
4
1
3
6
4,171
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nllb_moe/modeling_nllb_moe.py
transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeTop2Router
from .configuration_nllb_moe import NllbMoeConfig import torch from typing import Callable, Optional, Union import math import torch.nn as nn class NllbMoeTop2Router(nn.Module): """ Router using tokens choose top-2 experts assignment. This router uses the same mechanism as in NLLB-MoE from the fairseq rep...
class NllbMoeTop2Router(nn.Module): ''' Router using tokens choose top-2 experts assignment. This router uses the same mechanism as in NLLB-MoE from the fairseq repository. Items are sorted by router_probs and then routed to their choice of expert until the expert's expert_capacity is reached. **There ...
6
4
27
3
18
7
3
0.46
1
4
1
0
5
10
5
15
153
23
89
48
78
41
78
43
72
10
1
2
15
4,172
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nougat/image_processing_nougat.py
transformers.models.nougat.image_processing_nougat.NougatImageProcessor
from ...utils import TensorType, filter_out_non_signature_kwargs, logging from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import get_resize_output_image_size, pad, resize, to_channel_dimension_format, to_pil_image from typing import Optional, Union import n...
class NougatImageProcessor(BaseImageProcessor): ''' Constructs a Nougat image processor. Args: do_crop_margin (`bool`, *optional*, defaults to `True`): Whether to crop the image margins. do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image'...
11
9
45
4
27
14
5
0.65
1
8
2
0
9
12
9
29
454
48
247
123
169
160
125
55
115
23
3
1
43
4,173
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nougat/processing_nougat.py
transformers.models.nougat.processing_nougat.NougatProcessor
from typing import Optional, Union from transformers.tokenization_utils_base import PreTokenizedInput, TextInput, TruncationStrategy from ...utils import PaddingStrategy, TensorType from ...processing_utils import ProcessorMixin class NougatProcessor(ProcessorMixin): """ Constructs a Nougat processor which wra...
class NougatProcessor(ProcessorMixin): ''' Constructs a Nougat processor which wraps a Nougat image processor and a Nougat tokenizer into a single processor. [`NougatProcessor`] offers all the functionalities of [`NougatImageProcessor`] and [`NougatTokenizerFast`]. See the [`~NougatProcessor.__call__`]...
4
2
22
0
20
3
2
0.25
1
7
0
0
5
1
5
22
134
10
102
50
58
25
25
12
19
6
2
1
10
4,174
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nougat/tokenization_nougat_fast.py
transformers.models.nougat.tokenization_nougat_fast.NougatTokenizerFast
from transformers.tokenization_utils_fast import PreTrainedTokenizerFast from functools import partial from ...utils import is_levenshtein_available, is_nltk_available, logging, requires_backends from typing import Optional, Union from transformers.utils import add_end_docstrings from transformers.tokenization_utils_ba...
@add_end_docstrings(INIT_TOKENIZER_DOCSTRING) class NougatTokenizerFast(PreTrainedTokenizerFast): ''' Fast tokenizer for Nougat (backed by HuggingFace tokenizers library). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this supercl...
7
5
43
4
25
16
4
0.81
1
8
0
0
5
1
5
93
256
32
128
34
107
104
80
18
74
9
3
3
20
4,175
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/configuration_nystromformer.py
transformers.models.nystromformer.configuration_nystromformer.NystromformerConfig
from ...configuration_utils import PretrainedConfig class NystromformerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`NystromformerModel`]. It is used to instantiate an Nystromformer model according to the specified arguments, defining the model architecture...
class NystromformerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`NystromformerModel`]. It is used to instantiate an Nystromformer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the default...
2
1
40
0
40
0
1
1.31
1
1
0
0
1
16
1
1
106
9
42
41
18
55
20
19
18
1
1
0
1
4,176
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerAttention
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from torch import nn class NystromformerAttention(nn.Module): def __init__(self, config, position_embedding_type=None): super().__init__() self.self = NystromformerSelfAttention(config, pos...
class NystromformerAttention(nn.Module): def __init__(self, config, position_embedding_type=None): pass def prune_heads(self, heads): pass def forward(self, hidden_states, attention_mask=None, output_attentions=False): pass
4
0
9
1
8
1
1
0.13
1
4
2
0
3
3
3
13
30
4
24
11
20
3
22
11
18
2
1
1
4
4,177
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerClassificationHead
from ...activations import ACT2FN from torch import nn class NystromformerClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dropout = nn.D...
class NystromformerClassificationHead(nn.Module): '''Head for sentence-level classification tasks.''' def __init__(self, config): pass def forward(self, features, **kwargs): pass
3
1
8
1
7
1
1
0.13
1
1
0
0
2
4
2
12
19
3
15
8
12
2
15
8
12
1
1
0
2
4,178
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerEmbeddings
from torch import nn import torch class NystromformerEmbeddings(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config...
class NystromformerEmbeddings(nn.Module): '''Construct the embeddings from word, position and token_type embeddings.''' def __init__(self, config): pass def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None): pass
3
1
27
4
21
3
4
0.17
1
1
0
0
2
6
2
12
58
9
42
16
39
7
34
16
31
7
1
2
8
4,179
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerEncoder
from typing import Optional, Union from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput import torch class NystromformerEncoder(nn.Module): def __init...
class NystromformerEncoder(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=True): ...
3
0
23
3
20
0
5
0
1
8
2
0
2
3
2
12
47
6
41
18
30
0
23
10
20
9
1
2
10
4,180
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerForMaskedLM
from typing import Optional, Union from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...utils import au...
@auto_docstring class NystromformerForMaskedLM(NystromformerPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor...
7
1
16
2
13
2
2
0.14
1
6
3
0
4
2
4
5
76
11
58
27
35
8
25
14
20
5
2
1
8
4,181
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerForMultipleChoice
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from typing import Optional, Union from torch import nn import torch from ...utils import auto_docstring, logging from torch...
@auto_docstring class NystromformerForMultipleChoice(NystromformerPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, posit...
5
1
38
5
30
6
6
0.16
1
5
2
0
2
3
2
3
86
10
69
30
46
11
30
15
27
11
2
1
12
4,182
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerForQuestionAnswering
import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn from typing import Optional, Union from ...utils import auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModel...
@auto_docstring class NystromformerForQuestionAnswering(NystromformerPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, po...
5
0
42
5
31
7
4
0.19
1
5
2
0
2
3
2
3
92
11
68
30
46
13
33
16
30
7
2
2
8
4,183
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerForSequenceClassification
import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from typing import Optional, Union from ...utils import auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClass...
@auto_docstring(custom_intro='\n Nyströmformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ') class NystromformerForSequenceClassification(NystromformerPreTrainedModel): def __init__(self, config): pa...
5
1
38
3
32
4
7
0.1
1
7
3
0
2
3
2
3
84
7
70
25
49
7
32
12
29
12
2
3
13
4,184
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerForTokenClassification
from typing import Optional, Union from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn from ...utils import auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, Seque...
@auto_docstring class NystromformerForTokenClassification(NystromformerPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, ...
5
1
31
4
24
3
3
0.09
1
5
2
0
2
4
2
3
69
9
55
26
34
5
22
13
19
5
2
1
6
4,185
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerIntermediate
from ...activations import ACT2FN import torch from torch import nn class NystromformerIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.interm...
class NystromformerIntermediate(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
2
0
1
3
0
0
2
2
2
12
13
1
12
5
9
0
11
5
8
2
1
1
3
4,186
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerLMPredictionHead
from torch import nn import torch class NystromformerLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = NystromformerPredictionHeadTransform(config) self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.bias = nn....
class NystromformerLMPredictionHead(nn.Module): def __init__(self, config): pass def _tie_weights(self): pass def forward(self, hidden_states): pass
4
0
6
1
4
1
1
0.23
1
2
1
0
3
3
3
13
21
5
13
7
9
3
13
7
9
1
1
0
3
4,187
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerLayer
from ...modeling_layers import GradientCheckpointingLayer from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer class NystromformerLayer(GradientCheckpointingLayer): def __init__(self, config): super().__init__() self.chunk_size_feed_forward =...
class NystromformerLayer(GradientCheckpointingLayer): def __init__(self, config): pass def forward(self, hidden_states, attention_mask=None, output_attentions=False): pass def feed_forward_chunk(self, attention_output): pass
4
0
8
1
7
0
1
0.05
1
4
3
0
3
6
3
13
27
5
22
16
18
1
20
16
16
1
1
0
3
4,188
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerModel
from ...utils import auto_docstring, logging from typing import Optional, Union from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput import torch @auto_docstring class Nystromf...
@auto_docstring class NystromformerModel(NystromformerPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def _prune_heads(self, heads_to_prune): ''' Prunes heads of the model. hea...
8
1
20
2
15
2
3
0.15
1
7
3
0
5
3
5
6
109
15
82
31
59
12
42
19
36
12
2
2
17
4,189
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerOnlyMLMHead
from torch import nn import torch class NystromformerOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = NystromformerLMPredictionHead(config) def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: prediction_scores = self.predictions(s...
class NystromformerOnlyMLMHead(nn.Module): def __init__(self, config): pass def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: pass
3
0
3
0
3
0
1
0
1
3
1
0
2
1
2
12
8
1
7
5
4
0
7
5
4
1
1
0
2
4,190
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerOutput
from torch import nn import torch class NystromformerOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn...
class NystromformerOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
4,191
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerPreTrainedModel
from ...modeling_utils import PreTrainedModel from ...utils import auto_docstring, logging from .configuration_nystromformer import NystromformerConfig from torch import nn @auto_docstring class NystromformerPreTrainedModel(PreTrainedModel): config: NystromformerConfig base_model_prefix = 'nystromformer' s...
@auto_docstring class NystromformerPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.44
1
0
0
6
1
0
1
1
25
2
16
5
14
7
14
5
12
6
1
2
6
4,192
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerPredictionHeadTransform
from torch import nn import torch from ...activations import ACT2FN class NystromformerPredictionHeadTransform(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) if isinstance(config.hidden_act, str): self.t...
class NystromformerPredictionHeadTransform(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
7
0
7
0
2
0
1
3
0
0
2
3
2
12
15
1
14
6
11
0
13
6
10
2
1
1
3
4,193
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerSelfAttention
from torch import nn import math import torch class NystromformerSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')): raise ValueError(...
class NystromformerSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None): pass def iterative_inv(self, mat, n_iter=6): pass def forward(self, hidden_states, attention_mask=None, output_attentions=False): pass
4
0
31
6
24
1
4
0.06
1
4
0
0
4
13
4
14
128
25
97
39
92
6
66
39
61
6
1
2
14
4,194
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/nystromformer/modeling_nystromformer.py
transformers.models.nystromformer.modeling_nystromformer.NystromformerSelfOutput
import torch from torch import nn class NystromformerSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.D...
class NystromformerSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
4,195
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/configuration_olmo.py
transformers.models.olmo.configuration_olmo.OlmoConfig
from ...configuration_utils import PretrainedConfig class OlmoConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`OlmoModel`]. It is used to instantiate an OLMo model according to the specified arguments, defining the model architecture. Instantiating a configura...
class OlmoConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`OlmoModel`]. It is used to instantiate an OLMo model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar conf...
3
2
36
2
32
2
4
0.97
1
4
0
1
2
15
2
2
162
14
75
45
50
73
35
23
32
5
1
1
7
4,196
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py
transformers.models.olmo.modeling_olmo.OlmoAttention
import torch.nn as nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils.deprecation import deprecate_kwarg import torch import torch.nn.functional as F from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache from .configuration_olmo import OlmoConfi...
class OlmoAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: OlmoConfig, layer_idx: int): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, positio...
4
1
40
5
35
1
4
0.03
1
5
2
1
2
11
2
12
83
11
70
31
59
2
41
23
38
6
1
2
7
4,197
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py
transformers.models.olmo.modeling_olmo.OlmoDecoderLayer
from ...cache_utils import Cache, DynamicCache from ...modeling_layers import GradientCheckpointingLayer import torch.nn.functional as F from ...utils.deprecation import deprecate_kwarg from .configuration_olmo import OlmoConfig import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple impo...
class OlmoDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: OlmoConfig, layer_idx: int): 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, position_ids: ...
4
0
25
3
21
2
2
0.07
1
10
6
1
2
5
2
12
51
7
42
22
28
3
21
11
18
2
1
1
3
4,198
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py
transformers.models.olmo.modeling_olmo.OlmoForCausalLM
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from ...cache_utils import Cache, DynamicCache from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...generation import GenerationMixin import torch.nn.functional as F import torch from typing import Callable, Opt...
@auto_docstring class OlmoForCausalLM(OlmoPreTrainedModel, GenerationMixin): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=Non...
6
1
14
2
9
4
2
0.38
2
9
4
1
8
3
8
9
123
21
74
36
47
28
36
20
27
8
2
1
15
4,199
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py
transformers.models.olmo.modeling_olmo.OlmoLayerNorm
import torch import torch.nn.functional as F import torch.nn as nn class OlmoLayerNorm(nn.Module): """LayerNorm but with no learnable weight or bias.""" def __init__(self, hidden_size: int) -> None: super().__init__() self.normalized_shape = (hidden_size,) def forward(self, hidden_states:...
class OlmoLayerNorm(nn.Module): '''LayerNorm but with no learnable weight or bias.''' def __init__(self, hidden_size: int) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
1
4
0
4
0
1
0.11
1
3
0
0
2
1
2
12
12
2
9
5
6
1
7
5
4
1
1
0
2