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
2,800
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodeModel
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, SequenceClassifierOutputWithPast, TokenClassifierOutput from torch import nn from typing import Callable, Optional, Union import torch from ...utils import auto_docstring, can_return_tuple, logging from ...mask...
@auto_docstring class GPTBigCodeModel(GPTBigCodePreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Te...
8
1
58
8
45
5
11
0.11
1
11
3
0
4
10
4
6
243
36
186
51
160
21
108
35
103
42
2
3
45
2,801
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodePreTrainedModel
from .configuration_gpt_bigcode import GPTBigCodeConfig from ...utils import auto_docstring, can_return_tuple, logging from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel import math from torch import nn @auto_docstring class GPTBigCodePreTrainedModel(PreTrainedModel): config: GPTBigCodeConfig ...
@auto_docstring class GPTBigCodePreTrainedModel(PreTrainedModel): def __init__(self, *inputs, **kwargs): pass def _init_weights(self, module): '''Initialize the weights.''' pass
4
1
14
0
10
5
4
0.48
1
3
2
4
2
0
2
2
43
3
27
10
24
13
22
10
19
7
1
2
8
2,802
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/configuration_gpt_neo.py
transformers.models.gpt_neo.configuration_gpt_neo.GPTNeoConfig
from ...configuration_utils import PretrainedConfig class GPTNeoConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GPTNeoModel`]. It is used to instantiate a GPT Neo model according to the specified arguments, defining the model architecture. Instantiating a con...
null
4
1
31
2
29
0
3
1
1
3
0
0
1
19
2
2
139
15
62
50
37
62
33
28
30
3
1
2
5
2,803
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/configuration_gpt_neo.py
transformers.models.gpt_neo.configuration_gpt_neo.GPTNeoOnnxConfig
from ...onnx import OnnxConfigWithPast from typing import Any from collections import OrderedDict from collections.abc import Mapping from ... import PreTrainedTokenizer, is_torch_available class GPTNeoOnnxConfig(OnnxConfigWithPast): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: commo...
class GPTNeoOnnxConfig(OnnxConfigWithPast): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def num_attention_heads(self) -> int: pass def generate_dummy_inputs(self, tokenizer: PreTrainedTokenizer, batch_size: int=-1, seq_length: int=-1, is_pair: boo...
8
0
14
2
12
1
2
0.06
1
8
0
0
4
0
4
4
63
9
51
24
35
3
28
13
22
4
1
2
8
2,804
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoAttention
from torch import nn class GPTNeoAttention(nn.Module): def __init__(self, config, layer_id=0): super().__init__() self.layer_id = layer_id self.attention_layers = config.attention_layers self.attention_type = self.attention_layers[layer_id] if self.attention_type in ['globa...
class GPTNeoAttention(nn.Module): def __init__(self, config, layer_id=0): pass def forward(self, hidden_states, layer_past=None, attention_mask=None, head_mask=None, use_cache=False, output_attentions=False, cache_position=None): pass
3
0
17
1
17
0
2
0
1
2
0
0
2
4
2
12
36
2
34
16
22
0
11
7
8
2
1
1
3
2,805
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoBlock
from torch import nn from ...modeling_layers import GradientCheckpointingLayer class GPTNeoBlock(GradientCheckpointingLayer): def __init__(self, config, layer_id=None): super().__init__() hidden_size = config.hidden_size inner_dim = config.intermediate_size if config.intermediate_size is n...
class GPTNeoBlock(GradientCheckpointingLayer): def __init__(self, config, layer_id=None): pass def forward(self, hidden_states, layer_past=None, attention_mask=None, head_mask=None, use_cache=False, output_attentions=False, cache_position=None): pass
3
0
23
2
21
2
2
0.1
1
3
2
0
2
4
2
12
48
4
42
23
30
4
24
14
21
2
1
1
4
2,806
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoFlashAttention2
import torch from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available class GPTNeoFlashAttention2(GPTNeoSelfAttention): """ GPTNeo flash attention module. This module inherits from `GPTNeoSelfAttention` as the weights of the module stays untouched. The only r...
class GPTNeoFlashAttention2(GPTNeoSelfAttention): ''' GPTNeo flash attention module. This module inherits from `GPTNeoSelfAttention` 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...
3
1
46
8
32
6
5
0.26
1
1
0
0
2
2
2
17
99
18
65
26
53
17
40
16
37
8
2
2
9
2,807
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoForCausalLM
from ...modeling_outputs import BaseModelOutputWithPast, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput from ...utils import auto_docstring, is_torch_flex_attn_available, logging ...
@auto_docstring(custom_intro='\n The GPT Neo Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ') class GPTNeoForCausalLM(GPTNeoPreTrainedModel, GenerationMixin): def __init__(self, config): pass @auto_docstring def forward...
5
1
19
2
14
3
2
0.2
2
8
4
0
4
2
5
7
110
13
81
34
50
16
29
14
23
5
2
1
9
2,808
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoForQuestionAnswering
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import auto_docstring, is_torch_flex_attn_available, logging from typing import Optional, Union import torch from ...modeling_outputs import BaseModelOutputWithPast, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentio...
@auto_docstring class GPTNeoForQuestionAnswering(GPTNeoPreTrainedModel): 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, position_ids: Op...
5
1
41
4
30
7
4
0.19
1
4
2
0
2
3
2
4
90
9
68
30
45
13
32
16
29
7
2
2
8
2,809
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoForSequenceClassification
from typing import Optional, Union from torch import nn from ...utils import auto_docstring, is_torch_flex_attn_available, logging from ...cache_utils import Cache, DynamicCache from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutputWithPast, BaseModelOutputWith...
null
5
1
52
4
44
4
9
0.09
1
8
3
0
2
3
2
4
111
9
94
32
71
8
45
17
42
16
2
3
17
2,810
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoForTokenClassification
from torch import nn from ...cache_utils import Cache, DynamicCache import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import auto_docstring, is_torch_flex_attn_available, logging from typing import Optional, Union from ...modeling_outputs import BaseModelOutputWithPast, BaseMo...
@auto_docstring class GPTNeoForTokenClassification(GPTNeoPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Union[Cache, tuple[tuple[torch.Tensor]]]]=None, attention_mask: Optional[torch.FloatTen...
5
1
34
4
27
4
3
0.11
1
6
3
0
2
4
2
4
76
8
61
28
37
7
23
13
20
5
2
1
6
2,811
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoMLP
from ...activations import ACT2FN from torch import nn class GPTNeoMLP(nn.Module): def __init__(self, intermediate_size, config): super().__init__() embed_dim = config.hidden_size self.c_fc = nn.Linear(embed_dim, intermediate_size) self.c_proj = nn.Linear(intermediate_size, embed_d...
class GPTNeoMLP(nn.Module): def __init__(self, intermediate_size, config): pass def forward(self, hidden_states): pass
3
0
7
0
7
1
1
0.07
1
2
0
0
2
4
2
12
15
1
14
8
11
1
14
8
11
1
1
0
2
2,812
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoModel
from torch import nn import torch from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_causal_attention_mask from typing import Optional, Union from ...modeling_outputs import BaseModelOutputWithPast, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, CausalLMOutputWith...
@auto_docstring class GPTNeoModel(GPTNeoPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, past_key_values: O...
10
2
45
5
34
7
7
0.19
1
16
7
0
5
7
6
8
285
34
212
71
168
41
111
39
104
27
2
2
43
2,813
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoPreTrainedModel
from ...modeling_utils import PreTrainedModel from .configuration_gpt_neo import GPTNeoConfig from torch import nn from ...utils import auto_docstring, is_torch_flex_attn_available, logging @auto_docstring class GPTNeoPreTrainedModel(PreTrainedModel): config: GPTNeoConfig base_model_prefix = 'transformer' ...
@auto_docstring class GPTNeoPreTrainedModel(PreTrainedModel): def __init__(self, *inputs, **kwargs): pass def _init_weights(self, module): '''Initialize the weights.''' pass
4
1
9
0
7
2
4
0.32
1
1
0
5
2
0
2
2
35
3
25
13
22
8
23
13
20
6
1
2
7
2,814
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neo/modeling_gpt_neo.py
transformers.models.gpt_neo.modeling_gpt_neo.GPTNeoSelfAttention
from torch import nn import torch class GPTNeoSelfAttention(nn.Module): def __init__(self, config, attention_type, layer_id=None): super().__init__() self.config = config max_positions = config.max_position_embeddings bias = torch.tril(torch.ones((max_positions, max_positions), dty...
class GPTNeoSelfAttention(nn.Module): def __init__(self, config, attention_type, layer_id=None): pass def _split_heads(self, tensor, num_heads, attn_head_size): ''' Splits hidden_size dim into attn_head_size and num_heads ''' pass def _merge_heads(self, tensor, nu...
6
2
23
4
16
3
2
0.21
1
4
0
1
5
12
5
15
119
23
82
42
67
17
68
33
62
3
1
1
11
2,815
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/configuration_gpt_neox.py
transformers.models.gpt_neox.configuration_gpt_neox.GPTNeoXConfig
from ...configuration_utils import PretrainedConfig from ...modeling_rope_utils import rope_config_validation class GPTNeoXConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GPTNeoXModel`]. It is used to instantiate an GPTNeoX model according to the specified ar...
class GPTNeoXConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GPTNeoXModel`]. It is used to instantiate an GPTNeoX model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a sim...
2
1
57
1
54
2
3
1.56
1
2
0
0
1
21
1
1
173
12
63
50
37
98
32
26
30
3
1
1
3
2,816
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXAttention
import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...cache_utils import Cache, DynamicCache from typing import Callable, Optional, Union from ...modeling_flash_attention_utils import FlashAttentionKwargs from ...processing_utils import Unpack from torch import nn class GPTNeoXAtt...
class GPTNeoXAttention(nn.Module): def __init__(self, config, layer_idx=None): pass def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, head_mask: Optional[torch.FloatTensor]=None, layer_past: Optional[Cache]=None, output_attentions: Optional[bool]=False, cache_posi...
3
0
42
5
35
3
4
0.07
1
6
2
0
2
9
2
12
85
11
70
31
57
5
34
21
31
6
1
1
7
2,817
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXForCausalLM
from ...cache_utils import Cache, DynamicCache from torch import nn from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...processing_utils import Unpack import torch from ...generation import GenerationMixin from typing import Callable, Optional, Union from ...modeling_outputs impor...
@auto_docstring(custom_intro='\n GPTNeoX Model with a `language modeling` head on top for CLM fine-tuning.\n ') class GPTNeoXForCausalLM(GPTNeoXPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, n...
8
1
23
3
14
6
2
0.37
2
9
4
0
4
2
4
5
102
17
62
32
39
23
25
15
20
6
2
1
9
2,818
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXForQuestionAnswering
from typing import Callable, Optional, Union import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput from torch i...
@auto_docstring class GPTNeoXForQuestionAnswering(GPTNeoXPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor...
6
0
34
4
25
6
3
0.19
1
4
2
0
2
3
2
3
76
8
57
26
34
11
22
12
19
5
2
1
6
2,819
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXForSequenceClassification
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...cache_utils import Cache, DynamicCache from typing import Callable, Optional, Union import torch from torch import nn from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, ...
null
6
1
40
4
32
4
5
0.11
1
7
3
0
2
3
2
3
87
8
71
30
49
8
30
16
27
8
2
1
9
2,820
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXForTokenClassification
from torch import nn from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging import torch from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifi...
class GPTNeoXForTokenClassification(GPTNeoXPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Union[Cache, tuple[tuple[torch.Tensor]]]]=None, attention_mask: Optional[torch...
5
1
32
4
25
4
3
0.12
1
6
3
0
2
4
2
3
73
8
58
27
34
7
21
12
18
5
2
1
6
2,821
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXLayer
from ...modeling_layers import GradientCheckpointingLayer import torch from typing import Callable, Optional, Union from ...modeling_flash_attention_utils import FlashAttentionKwargs from ...processing_utils import Unpack from torch import nn from ...cache_utils import Cache, DynamicCache class GPTNeoXLayer(GradientCh...
class GPTNeoXLayer(GradientCheckpointingLayer): def __init__(self, config, layer_idx): pass def forward(self, hidden_states: Optional[torch.FloatTensor], attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Optional[torch.FloatTensor]=None, use_c...
3
0
28
2
24
3
2
0.12
1
7
4
0
2
7
2
12
58
4
49
25
34
6
25
13
22
3
1
1
4
2,822
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXMLP
from ...activations import ACT2FN from torch import nn class GPTNeoXMLP(nn.Module): def __init__(self, config): super().__init__() self.dense_h_to_4h = nn.Linear(config.hidden_size, config.intermediate_size) self.dense_4h_to_h = nn.Linear(config.intermediate_size, config.hidden_size) ...
class GPTNeoXMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
5
0
5
0
1
0
1
1
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
2,823
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXModel
from ...cache_utils import Cache, DynamicCache from ...masking_utils import create_causal_mask from ...utils.generic import check_model_inputs from typing import Callable, Optional, Union from ...processing_utils import Unpack import torch from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast,...
@auto_docstring class GPTNeoXModel(GPTNeoXPreTrainedModel): def __init__(self, config): pass @check_model_inputs @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_ma...
8
0
42
4
31
7
6
0.23
1
15
8
0
5
8
6
7
273
32
197
68
152
45
95
35
88
22
2
2
38
2,824
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXPreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_gpt_neox import GPTNeoXConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging @auto_docstring class GPTNeoXPreTrainedModel(PreTrainedModel): config: GPTNeoXConfig base_model_prefix = 'g...
@auto_docstring class GPTNeoXPreTrainedModel(PreTrainedModel): pass
2
0
13
0
12
1
6
0.04
1
0
0
5
1
0
1
1
28
1
26
15
24
1
24
15
22
6
1
2
6
2,825
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modeling_gpt_neox.py
transformers.models.gpt_neox.modeling_gpt_neox.GPTNeoXRotaryEmbedding
from .configuration_gpt_neox import GPTNeoXConfig import torch from torch import nn from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update class GPTNeoXRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: GPTNeoXConfig, device=None): super().__init__() ...
class GPTNeoXRotaryEmbedding(nn.Module): def __init__(self, config: GPTNeoXConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
18
2
13
5
3
0.35
1
4
1
0
3
7
3
13
59
8
40
21
35
14
38
20
34
3
1
1
8
2,826
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXAttention
from ...modeling_flash_attention_utils import FlashAttentionKwargs import torch from ...cache_utils import Cache, DynamicCache from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn class GPTNeoXAtt...
class GPTNeoXAttention(nn.Module): def __init__(self, config, layer_idx=None): pass def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, head_mask: Optional[torch.FloatTensor]=None, layer_past: Optional[Cache]=None, output_attentions: Optional[bool]=False, cache_posi...
3
0
42
5
35
3
4
0.07
1
6
2
0
2
9
2
12
85
11
70
31
57
5
34
21
31
6
1
1
7
2,827
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXForCausalLM
import torch from torch import nn from typing import Callable, Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifi...
@auto_docstring(custom_intro='\n GPTNeoX Model with a `language modeling` head on top for CLM fine-tuning.\n ') class GPTNeoXForCausalLM(GPTNeoXPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, n...
8
1
23
3
14
6
2
0.37
2
9
4
0
4
2
4
44
102
17
62
32
39
23
25
15
20
6
3
1
9
2,828
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXForQuestionAnswering
from typing import Callable, Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from torch import nn from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput impo...
@auto_docstring class GPTNeoXForQuestionAnswering(GPTNeoXPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor...
6
0
34
4
25
6
3
0.19
1
4
2
0
2
3
2
4
76
8
57
26
34
11
22
12
19
5
3
1
6
2,829
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXForSequenceClassification
import torch from torch import nn from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifi...
null
6
1
40
4
32
4
5
0.11
1
7
3
0
2
3
2
4
87
8
71
30
49
8
30
16
27
8
3
1
9
2,830
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXForTokenClassification
from ...cache_utils import Cache, DynamicCache from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput import torch from torch...
class GPTNeoXForTokenClassification(GPTNeoXPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Union[Cache, tuple[tuple[torch.Tensor]]]]=None, attention_mask: Optional[torch...
5
1
32
4
25
4
3
0.12
1
6
3
0
2
4
2
4
73
8
58
27
34
7
21
12
18
5
3
1
6
2,831
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXLayer
from ...modeling_flash_attention_utils import FlashAttentionKwargs import torch from torch import nn from ...cache_utils import Cache, DynamicCache from ...modeling_layers import GradientCheckpointingLayer from ...processing_utils import Unpack from typing import Callable, Optional, Union class GPTNeoXLayer(GradientCh...
class GPTNeoXLayer(GradientCheckpointingLayer): def __init__(self, config, layer_idx): pass def forward(self, hidden_states: Optional[torch.FloatTensor], attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Optional[torch.FloatTensor]=None, use_c...
3
0
28
2
24
3
2
0.12
1
7
4
0
2
7
2
12
58
4
49
25
34
6
25
13
22
3
1
1
4
2,832
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXMLP
from torch import nn from ...activations import ACT2FN class GPTNeoXMLP(nn.Module): def __init__(self, config): super().__init__() self.dense_h_to_4h = nn.Linear(config.hidden_size, config.intermediate_size) self.dense_4h_to_h = nn.Linear(config.intermediate_size, config.hidden_size) ...
class GPTNeoXMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
5
0
5
0
1
0
1
1
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
2,833
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXModel
from ...cache_utils import Cache, DynamicCache import torch from ..llama.modeling_llama import LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding, rotate_half from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...processing_utils import Unpack from torch import nn from ...modeli...
class GPTNeoXModel(LlamaModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Opt...
5
0
34
4
27
2
6
0.08
2
10
6
0
4
8
4
21
145
20
116
38
90
9
59
22
54
22
3
2
25
2,834
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXPreTrainedModel
from ..llama.modeling_llama import LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding, rotate_half class GPTNeoXPreTrainedModel(LlamaPreTrainedModel): base_model_prefix = 'gpt_neox' _no_split_modules = ['GPTNeoXLayer'] _keys_to_ignore_on_load_unexpected = ['attention.bias', 'attention.masked_bias']
class GPTNeoXPreTrainedModel(LlamaPreTrainedModel): pass
1
0
13
0
12
1
6
0.06
1
0
0
4
1
0
1
2
18
1
16
5
14
1
14
5
12
6
2
2
6
2,835
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/modular_gpt_neox.py
transformers.models.gpt_neox.modular_gpt_neox.GPTNeoXRotaryEmbedding
from ..llama.modeling_llama import LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding, rotate_half class GPTNeoXRotaryEmbedding(LlamaRotaryEmbedding): pass
class GPTNeoXRotaryEmbedding(LlamaRotaryEmbedding): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
13
2
0
2
1
1
0
2
1
1
0
2
0
0
2,836
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py
transformers.models.gpt_neox.tokenization_gpt_neox_fast.GPTNeoXTokenizerFast
from tokenizers import processors from ...tokenization_utils_fast import PreTrainedTokenizerFast from typing import Optional class GPTNeoXTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" GPT-NeoX-20B tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level Byte-Pair-Encod...
class GPTNeoXTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" GPT-NeoX-20B tokenizer (backed by HuggingFace's *tokenizers* library). Based on 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 ...
14
3
13
1
10
2
3
0.69
1
6
0
0
9
2
9
97
192
31
95
46
66
66
53
27
43
9
3
1
24
2,837
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/configuration_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.configuration_gpt_neox_japanese.GPTNeoXJapaneseConfig
from ...modeling_rope_utils import rope_config_validation from ...configuration_utils import PretrainedConfig class GPTNeoXJapaneseConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GPTNeoXModelJapanese`]. It is used to instantiate a GPTNeoX model according to t...
class GPTNeoXJapaneseConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GPTNeoXModelJapanese`]. It is used to instantiate a GPTNeoX model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults w...
2
1
44
0
42
2
2
2
1
1
0
0
1
17
1
1
140
8
44
40
22
88
24
20
22
2
1
1
2
2,838
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.modeling_gpt_neox_japanese.GPTNeoXJapaneseAttention
import torch import math from torch import Tensor, nn from ...cache_utils import Cache, DynamicCache from typing import Optional, Union class GPTNeoXJapaneseAttention(nn.Module): def __init__(self, config, use_bias=False, layer_idx=None): super().__init__() self.num_attention_heads = config.num_at...
class GPTNeoXJapaneseAttention(nn.Module): def __init__(self, config, use_bias=False, layer_idx=None): pass def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, position_ids: torch.LongTensor, head_mask: Optional[torch.FloatTensor]=None, layer_past: Optional[Cache]=N...
8
2
29
3
20
6
2
0.28
1
6
2
0
3
13
5
15
152
21
104
53
85
29
70
40
64
3
1
1
11
2,839
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.modeling_gpt_neox_japanese.GPTNeoXJapaneseForCausalLM
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from ...generation import GenerationMixin from torch import Tensor, nn from typing import Optional, Union from ...cache_utils import Cache, DynamicCache from ...utils import auto_docstring, is_torch_flex_attn_available, logging import torch...
@auto_docstring(custom_intro='\n GPTNeoXJapanese Model with a `language modeling` head on top for Classifier Model fine-tuning.\n ') class GPTNeoXJapaneseForCausalLM(GPTNeoXJapanesePreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass ...
7
1
21
3
14
4
2
0.29
2
6
3
0
5
3
5
6
113
19
73
33
50
21
30
17
24
5
2
1
10
2,840
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.modeling_gpt_neox_japanese.GPTNeoXJapaneseLayer
from typing import Optional, Union from torch import Tensor, nn import torch from ...cache_utils import Cache, DynamicCache class GPTNeoXJapaneseLayer(nn.Module): def __init__(self, config, layer_number): super().__init__() self.layer_number = layer_number self.input_layernorm = nn.LayerNo...
class GPTNeoXJapaneseLayer(nn.Module): def __init__(self, config, layer_number): pass def forward(self, hidden_states: Optional[torch.FloatTensor], attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Optional[torch.FloatTensor]=None, use_cache: ...
3
0
30
2
27
3
2
0.11
1
6
3
0
2
6
2
12
62
5
54
26
40
6
22
15
19
3
1
1
4
2,841
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.modeling_gpt_neox_japanese.GPTNeoXJapaneseMLP
from torch import Tensor, nn from ...activations import ACT2FN class GPTNeoXJapaneseMLP(nn.Module): def __init__(self, config): super().__init__() intermediate_size = int(config.hidden_size * config.intermediate_multiple_size) self.dense_h_to_4h = nn.Linear(config.hidden_size, intermediate...
class GPTNeoXJapaneseMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
6
0
6
1
1
0.08
1
2
0
0
2
3
2
12
14
1
12
9
9
1
12
9
9
1
1
0
2
2,842
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.modeling_gpt_neox_japanese.GPTNeoXJapaneseModel
import torch from ...utils import auto_docstring, is_torch_flex_attn_available, logging from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from torch import Tensor, nn from typing import Optional, Union from ...cache_utils import Cache, DynamicCache from ...modeling_attn_mask_utils import A...
@auto_docstring class GPTNeoXJapaneseModel(GPTNeoXJapanesePreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, atten...
10
2
43
5
30
9
7
0.31
1
15
7
0
5
5
6
7
270
34
182
66
143
56
96
35
89
23
2
2
39
2,843
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.modeling_gpt_neox_japanese.GPTNeoXJapanesePreTrainedModel
from .configuration_gpt_neox_japanese import GPTNeoXJapaneseConfig from ...utils import auto_docstring, is_torch_flex_attn_available, logging from ...modeling_utils import PreTrainedModel from torch import Tensor, nn @auto_docstring class GPTNeoXJapanesePreTrainedModel(PreTrainedModel): config: GPTNeoXJapaneseConf...
@auto_docstring class GPTNeoXJapanesePreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
13
0
12
1
6
0.3
1
0
0
2
1
0
1
1
27
2
20
9
18
6
18
9
16
6
1
2
6
2,844
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.modeling_gpt_neox_japanese.GPTNeoXJapaneseRotaryEmbedding
from .configuration_gpt_neox_japanese import GPTNeoXJapaneseConfig import torch from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update from torch import Tensor, nn class GPTNeoXJapaneseRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: GPTNeoXJapaneseConfig, dev...
class GPTNeoXJapaneseRotaryEmbedding(nn.Module): def __init__(self, config: GPTNeoXJapaneseConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
18
2
13
5
3
0.35
1
4
1
0
3
7
3
13
59
8
40
21
35
14
38
20
34
3
1
1
8
2,845
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/tokenization_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese.GPTNeoXJapaneseTokenizer
import os from typing import Optional from ...tokenization_utils_fast import PreTrainedTokenizer import json class GPTNeoXJapaneseTokenizer(PreTrainedTokenizer): """ This tokenizer inherits from [`PreTrainedTokenizer`] and is based on Japanese special Sub-Word-Encoding that is used in this repository (http...
class GPTNeoXJapaneseTokenizer(PreTrainedTokenizer): ''' This tokenizer inherits from [`PreTrainedTokenizer`] and is based on Japanese special Sub-Word-Encoding that is used in this repository (https://github.com/tanreinama/Japanese-BPEEncoder_V2). Check the repository for details. Japanese has a relat...
10
4
10
0
10
1
2
0.56
1
5
1
0
8
6
8
97
139
14
80
31
60
45
42
19
33
8
3
3
17
2,846
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_neox_japanese/tokenization_gpt_neox_japanese.py
transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese.SubWordJapaneseTokenizer
import sys import re import numpy as np class SubWordJapaneseTokenizer: """ https://github.com/tanreinama/Japanese-BPEEncoder_V2 This tokenizer class is under MIT License according to the original repository. MIT License Copyright (c) 2020 tanreinama Permission is hereby granted, free of cha...
class SubWordJapaneseTokenizer: ''' https://github.com/tanreinama/Japanese-BPEEncoder_V2 This tokenizer class is under MIT License according to the original repository. MIT License Copyright (c) 2020 tanreinama Permission is hereby granted, free of charge, to any person obtaining a copy of this...
8
1
21
0
21
1
5
0.17
0
4
0
0
5
11
5
5
157
13
126
38
118
22
103
38
95
13
0
4
34
2,847
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_sw3/tokenization_gpt_sw3.py
transformers.models.gpt_sw3.tokenization_gpt_sw3.GPTSw3Tokenizer
import unicodedata import sentencepiece as spm from typing import Any, Optional, Union from ...utils.import_utils import requires import re from ...tokenization_utils import PreTrainedTokenizer from shutil import copyfile import os @requires(backends=('sentencepiece',)) class GPTSw3Tokenizer(PreTrainedTokenizer): ...
@requires(backends=('sentencepiece',)) class GPTSw3Tokenizer(PreTrainedTokenizer): ''' Construct an GPTSw3 tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to thi...
18
8
14
2
9
3
2
0.74
1
8
0
0
13
9
14
103
274
50
129
53
98
95
92
36
77
10
3
3
34
2,848
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/configuration_gptj.py
transformers.models.gptj.configuration_gptj.GPTJConfig
from ...configuration_utils import PretrainedConfig class GPTJConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GPTJModel`]. It is used to instantiate a GPT-J model according to the specified arguments, defining the model architecture. Instantiating a configura...
class GPTJConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GPTJModel`]. It is used to instantiate a GPT-J model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar conf...
2
1
42
2
40
0
1
1
1
1
0
0
1
16
1
1
106
10
48
40
26
48
21
20
19
1
1
0
1
2,849
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/configuration_gptj.py
transformers.models.gptj.configuration_gptj.GPTJOnnxConfig
from collections.abc import Mapping from ...onnx import OnnxConfigWithPast, PatchingSpec from typing import Any, Optional from ...configuration_utils import PretrainedConfig from ... import PreTrainedTokenizer, is_torch_available from collections import OrderedDict class GPTJOnnxConfig(OnnxConfigWithPast): def __...
class GPTJOnnxConfig(OnnxConfigWithPast): def __init__(self, config: PretrainedConfig, task: str='default', patching_specs: Optional[list[PatchingSpec]]=None, use_past: bool=False): pass @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def num_layers(se...
11
0
12
1
10
1
2
0.06
1
8
0
0
6
0
6
6
79
11
64
33
39
4
34
15
26
4
1
2
11
2,850
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJAttention
from typing import Optional, Union import torch import torch.fx from ...utils import add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, logging from torch import nn from ...cache_utils import Cache, DynamicCache class GPTJAttention(nn.Module): def __init__(self, config, layer_i...
class GPTJAttention(nn.Module): def __init__(self, config, layer_idx=None): pass def _split_heads(self, tensor, num_attention_heads, attn_head_size, rotary): ''' Splits hidden dim into attn_head_size and num_attention_heads ''' pass def _merge_heads(self, tensor, ...
7
2
28
4
23
3
3
0.11
1
5
1
1
6
15
6
16
175
28
136
64
109
15
98
44
91
5
1
1
20
2,851
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJBlock
import torch from ...modeling_layers import GradientCheckpointingLayer from typing import Optional, Union from torch import nn import torch.fx from ...cache_utils import Cache, DynamicCache class GPTJBlock(GradientCheckpointingLayer): def __init__(self, config, layer_idx=None): super().__init__() ...
class GPTJBlock(GradientCheckpointingLayer): def __init__(self, config, layer_idx=None): pass def forward(self, hidden_states: Optional[torch.FloatTensor], layer_past: Optional[Cache]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Opt...
3
0
21
2
19
1
2
0.05
1
5
2
0
2
3
2
12
43
4
39
22
26
2
19
12
16
2
1
1
4
2,852
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJFlashAttention2
from ...utils import add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, logging import torch from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available import torch.fx from ...cache_utils import Cache, DynamicCache from typing import Opti...
class GPTJFlashAttention2(GPTJAttention): ''' GPTJ flash attention module. This module inherits from `GPTJAttention` 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 deal with paddi...
3
1
67
11
46
11
5
0.29
1
4
1
0
2
2
2
18
142
23
93
37
77
27
56
23
53
9
2
2
10
2,853
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJForCausalLM
import torch.fx from ...utils import add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, logging import warnings from torch import nn from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast from .....
@auto_docstring(custom_intro='\n The GPT-J Model transformer with a language modeling head on top.\n ') class GPTJForCausalLM(GPTJPreTrainedModel, GenerationMixin): def __init__(self, config): pass @add_start_docstrings(PARALLELIZE_DOCSTRING) def parallelize(self, device_map=None): pa...
9
1
19
1
15
3
2
0.17
2
9
3
0
6
4
7
9
149
16
114
40
78
19
46
18
38
6
2
1
13
2,854
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJForQuestionAnswering
import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast from ...utils import add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch...
@auto_docstring class GPTJForQuestionAnswering(GPTJPreTrainedModel): 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, position_ids: Option...
5
1
43
5
31
7
4
0.2
1
4
2
0
2
5
2
4
94
10
70
32
47
14
34
18
31
7
2
2
8
2,855
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJForSequenceClassification
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast from torch import nn from ...cache_utils import Cache, DynamicCache import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import add_star...
null
5
1
54
5
45
5
9
0.09
1
7
2
0
2
5
2
4
117
10
98
34
74
9
48
19
45
16
2
3
17
2,856
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJMLP
from typing import Optional, Union from torch import nn import torch import torch.fx from ...activations import ACT2FN class GPTJMLP(nn.Module): def __init__(self, intermediate_size, config): super().__init__() embed_dim = config.n_embd self.fc_in = nn.Linear(embed_dim, intermediate_size) ...
class GPTJMLP(nn.Module): def __init__(self, intermediate_size, config): pass def forward(self, hidden_states: Optional[torch.FloatTensor]) -> torch.FloatTensor: pass
3
0
8
1
7
1
1
0.07
1
1
0
0
2
4
2
12
17
3
14
8
11
1
14
8
11
1
1
0
2
2,857
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJModel
import warnings import torch.fx from typing import Optional, Union from ...cache_utils import Cache, DynamicCache import torch from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast from ...modeling_attn_mask_utils import Attention...
@auto_docstring class GPTJModel(GPTJPreTrainedModel): def __init__(self, config): pass @add_start_docstrings(PARALLELIZE_DOCSTRING) def parallelize(self, device_map=None): pass @add_start_docstrings(DEPARALLELIZE_DOCSTRING) def deparallelize(self): pass def get_input_em...
14
2
42
4
32
6
7
0.18
1
16
6
0
7
12
8
10
357
41
269
84
220
49
150
50
141
34
2
4
57
2,858
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gptj/modeling_gptj.py
transformers.models.gptj.modeling_gptj.GPTJPreTrainedModel
from ...utils import add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, logging from torch import nn from ...modeling_utils import PreTrainedModel from .configuration_gptj import GPTJConfig @auto_docstring class GPTJPreTrainedModel(PreTrainedModel): config: GPTJConfig base_m...
@auto_docstring class GPTJPreTrainedModel(PreTrainedModel): def __init__(self, *inputs, **kwargs): pass def _init_weights(self, module): '''Initialize the weights.''' pass
4
1
9
0
7
2
4
0.27
1
1
0
4
2
0
2
2
36
3
26
14
23
7
24
14
21
6
1
2
7
2,859
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/configuration_granite.py
transformers.models.granite.configuration_granite.GraniteConfig
from ...configuration_utils import PretrainedConfig from ...modeling_rope_utils import rope_config_validation class GraniteConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GraniteModel`]. It is used to instantiate an Granite model according to the specified ar...
class GraniteConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GraniteModel`]. It is used to instantiate an Granite model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a sim...
2
1
64
5
58
1
2
1.09
1
1
0
0
1
20
1
1
160
14
70
52
41
76
29
25
27
2
1
1
2
2,860
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GraniteAttention
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...utils.deprecation import deprecate_kwarg from ...processing_utils import Unpack from ...cache_utils import Cache, DynamicCache from torch import nn import torch from typing import Callable, Optional, Union from .configuration_gra...
class GraniteAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: GraniteConfig, 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
35
4
31
1
3
0.03
1
6
3
1
2
11
2
12
74
9
63
31
52
2
34
23
31
5
1
2
6
2,861
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GraniteDecoderLayer
from typing import Callable, Optional, Union from ...modeling_layers import GradientCheckpointingLayer from ...utils.deprecation import deprecate_kwarg from .configuration_granite import GraniteConfig import torch from ...cache_utils import Cache, DynamicCache class GraniteDecoderLayer(GradientCheckpointingLayer): ...
class GraniteDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: GraniteConfig, 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...
4
1
37
4
21
13
2
0.6
1
9
5
0
2
6
2
12
75
8
43
23
29
26
22
12
19
2
1
1
3
2,862
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GraniteForCausalLM
from typing import Callable, Optional, Union from torch import nn from ...processing_utils import Unpack from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...cache_utils import Cache, Dynam...
@auto_docstring class GraniteForCausalLM(GranitePreTrainedModel, 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.LongTenso...
6
1
14
2
9
4
2
0.39
2
9
4
0
8
3
8
9
124
21
75
36
48
29
37
20
28
8
2
1
15
2,863
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GraniteMLP
from ...activations import ACT2FN from torch import nn class GraniteMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.hidden_size = config.hidden_size self.intermediate_size = config.intermediate_size self.gate_proj = nn.Linear(self.hi...
class GraniteMLP(nn.Module): def __init__(self, config): pass def forward(self, x): pass
3
0
6
0
6
0
1
0
1
1
0
0
2
7
2
12
14
1
13
11
10
0
13
11
10
1
1
0
2
2,864
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GraniteModel
from ...utils.generic import check_model_inputs from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging import torch from .configuration_granite import GraniteConfig from ...masking_utils import create_causal_mask from torch import nn from ...cache_utils import Cache, DynamicCache from typing...
@auto_docstring class GraniteModel(GranitePreTrainedModel): def __init__(self, config: GraniteConfig): pass @check_model_inputs @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=Non...
6
0
41
5
31
6
6
0.22
1
16
10
0
5
8
6
7
260
35
186
66
148
41
91
35
84
21
2
2
37
2,865
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GranitePreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_granite import GraniteConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging @auto_docstring class GranitePreTrainedModel(PreTrainedModel): config: GraniteConfig base_model_prefix = 'mo...
@auto_docstring class GranitePreTrainedModel(PreTrainedModel): pass
2
0
10
0
10
0
5
0
1
0
0
2
1
0
1
1
24
1
23
15
21
0
22
15
20
5
1
2
5
2,866
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GraniteRMSNorm
import torch from torch import nn from ...integrations import use_kernel_forward_from_hub @use_kernel_forward_from_hub('RMSNorm') class GraniteRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ GraniteRMSNorm is equivalent to T5LayerNorm """ super().__init__() ...
@use_kernel_forward_from_hub('RMSNorm') class GraniteRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' GraniteRMSNorm is equivalent to T5LayerNorm ''' pass def forward(self, hidden_states): pass def extra_repr(self): pass
5
1
5
0
4
1
1
0.23
1
2
0
0
3
2
3
13
18
2
13
8
9
3
13
8
9
1
1
0
3
2,867
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modeling_granite.py
transformers.models.granite.modeling_granite.GraniteRotaryEmbedding
from .configuration_granite import GraniteConfig from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update import torch from torch import nn class GraniteRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: GraniteConfig, device=None): super().__init__() ...
class GraniteRotaryEmbedding(nn.Module): def __init__(self, config: GraniteConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
18
2
13
5
3
0.35
1
4
1
0
3
7
3
13
59
8
40
21
35
14
38
20
34
3
1
1
8
2,868
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modular_granite.py
transformers.models.granite.modular_granite.GraniteAttention
from .configuration_granite import GraniteConfig from typing import Optional, Union from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel, LlamaPreTrainedModel class GraniteAttention(LlamaAttention): """Multi-headed attention from 'Attention Is All You Need' paper""" ...
class GraniteAttention(LlamaAttention): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: GraniteConfig, layer_idx: Optional[int]=None): pass
2
1
3
0
3
0
1
0.25
1
3
1
0
1
1
1
13
6
1
4
3
2
1
4
3
2
1
2
0
1
2,869
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modular_granite.py
transformers.models.granite.modular_granite.GraniteDecoderLayer
from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel, LlamaPreTrainedModel from typing import Optional, Union from ...utils.deprecation import deprecate_kwarg import torch from ...cache_utils import Cache, DynamicCache from .configuration_granite import GraniteConfig class...
class GraniteDecoderLayer(LlamaDecoderLayer): def __init__(self, config: GraniteConfig, 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: Opt...
4
1
34
3
19
13
2
0.67
1
7
3
0
2
2
2
14
70
7
39
19
25
26
18
8
15
2
2
1
3
2,870
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modular_granite.py
transformers.models.granite.modular_granite.GraniteForCausalLM
from ...utils import TransformersKwargs, logging from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from ...cache_utils import Cache, DynamicCache from ...processing_utils import Unpack import torch from typing import Optional, Union from ..llama.modeling_llama import LlamaAttention, LlamaD...
class GraniteForCausalLM(LlamaForCausalLM): def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Union[Cache, list[torch.FloatTensor]]]=None, inputs_embeds: Optional[torch.FloatTensor]=No...
2
0
58
5
51
3
8
0.06
1
7
3
0
1
0
1
10
59
5
52
23
35
3
17
8
15
8
3
1
8
2,871
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granite/modular_granite.py
transformers.models.granite.modular_granite.GraniteModel
from ...masking_utils import create_causal_mask from torch import nn from ...utils import TransformersKwargs, logging import torch from typing import Optional, Union from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel, LlamaPreTrainedModel from .configuration_granite impor...
class GraniteModel(LlamaModel): def __init__(self, config: GraniteConfig): pass def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, inputs_embeds: Optional[torc...
3
0
57
9
46
2
11
0.04
1
11
6
0
2
2
2
9
115
19
93
27
77
4
44
14
41
21
3
2
22
2,872
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/configuration_granitemoe.py
transformers.models.granitemoe.configuration_granitemoe.GraniteMoeConfig
from ...modeling_rope_utils import rope_config_validation from ...configuration_utils import PretrainedConfig class GraniteMoeConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GraniteMoeModel`]. It is used to instantiate an GraniteMoe model according to the spe...
class GraniteMoeConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GraniteMoeModel`]. It is used to instantiate an GraniteMoe model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yi...
2
1
72
7
64
1
2
1.18
1
1
0
0
1
23
1
1
162
16
67
57
35
79
31
27
29
2
1
1
2
2,873
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeAttention
import torch from typing import Callable, Optional, Union import torch.nn.functional as F from .configuration_granitemoe import GraniteMoeConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn from ...utils.deprecation import deprecate_kwarg from ...cache_utils import Cache, ...
class GraniteMoeAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: GraniteMoeConfig, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_st...
4
1
45
9
36
2
4
0.07
1
7
2
2
2
14
2
12
94
19
72
37
58
5
51
26
48
5
1
1
8
2,874
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeDecoderLayer
from ...modeling_layers import GradientCheckpointingLayer import torch import torch.nn.functional as F from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache from .configuration_granitemoe import GraniteMoeConfig from ...utils.deprecation import deprecate_kwarg class GraniteMoeDeco...
class GraniteMoeDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: GraniteMoeConfig, 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, po...
4
1
44
7
24
14
3
0.58
1
8
4
0
2
6
2
12
89
14
48
25
33
28
26
13
23
4
1
1
5
2,875
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeForCausalLM
import torch.nn.functional as F from ...modeling_outputs import BaseModelOutputWithPast, MoeCausalLMOutputWithPast, MoeModelOutputWithPast from ...utils import auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from ...generation import GenerationMixin from torch import n...
class GraniteMoeForCausalLM(GraniteMoePreTrainedModel, GenerationMixin): def __init__(self, config: GraniteMoeConfig): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past...
4
1
15
2
11
3
2
0.23
2
8
4
0
8
6
9
10
152
23
106
42
78
24
52
25
42
12
2
2
21
2,876
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeMoE
from torch import nn import torch.nn.functional as F import torch from .configuration_granitemoe import GraniteMoeConfig from ...activations import ACT2FN class GraniteMoeMoE(nn.Module): """ A Sparsely gated mixture of experts layer with 1-layer Feed-Forward networks as experts. Args: config: ...
class GraniteMoeMoE(nn.Module): ''' A Sparsely gated mixture of experts layer with 1-layer Feed-Forward networks as experts. Args: config: Configuration object with model hyperparameters. ''' def __init__(self, config: GraniteMoeConfig): pass def forward(self, laye...
3
2
22
4
13
6
1
0.63
1
4
3
0
2
6
2
12
54
10
27
17
24
17
23
17
20
1
1
0
2
2,877
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeModel
from ...modeling_attn_mask_utils import AttentionMaskConverter from ...cache_utils import Cache, DynamicCache import torch.nn.functional as F from ...modeling_outputs import BaseModelOutputWithPast, MoeCausalLMOutputWithPast, MoeModelOutputWithPast from torch import nn import torch from typing import Callable, Optional...
@auto_docstring class GraniteMoeModel(GraniteMoePreTrainedModel): def __init__(self, config: GraniteMoeConfig): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_val...
8
1
48
5
36
7
8
0.23
1
17
10
0
5
13
6
7
303
39
218
76
180
50
121
45
114
26
2
2
45
2,878
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeParallelExperts
import torch from torch import nn import torch.nn.functional as F class GraniteMoeParallelExperts(nn.Module): def __init__(self, num_experts: int, input_size: int, output_size: int) -> None: """ Initialize the GraniteMoeParallelExperts module. The experts weights are stored in [num_experts...
class GraniteMoeParallelExperts(nn.Module): def __init__(self, num_experts: int, input_size: int, output_size: int) -> None: ''' Initialize the GraniteMoeParallelExperts module. The experts weights are stored in [num_experts, output_size, input_size] format. Such that it's compatible with ...
3
2
19
0
7
13
2
1.79
1
3
0
0
2
4
2
12
40
1
14
11
11
25
14
11
11
2
1
1
3
2,879
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoePreTrainedModel
from .configuration_granitemoe import GraniteMoeConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils import auto_docstring, is_torch_flex_attn_available, logging @auto_docstring class GraniteMoePreTrainedModel(PreTrainedModel): config: GraniteMoeConfig base_model_prefix =...
@auto_docstring class GraniteMoePreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
15
0
15
0
7
0.04
1
1
1
2
1
0
1
1
27
1
26
13
24
1
23
13
21
7
1
2
7
2,880
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeRMSNorm
import torch from torch import nn import torch.nn.functional as F class GraniteMoeRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ GraniteMoeRMSNorm is equivalent to T5LayerNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) ...
class GraniteMoeRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' GraniteMoeRMSNorm is equivalent to T5LayerNorm ''' pass def forward(self, hidden_states): pass def extra_repr(self): pass
4
1
5
0
4
1
1
0.23
1
2
0
0
3
2
3
13
18
2
13
8
9
3
13
8
9
1
1
0
3
2,881
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeRotaryEmbedding
import torch.nn.functional as F import torch from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update from torch import nn from .configuration_granitemoe import GraniteMoeConfig class GraniteMoeRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: GraniteMoeConfig, d...
class GraniteMoeRotaryEmbedding(nn.Module): def __init__(self, config: GraniteMoeConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
18
2
13
5
3
0.35
1
4
1
0
3
7
3
13
59
8
40
21
35
14
38
20
34
3
1
1
8
2,882
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/granitemoe/modeling_granitemoe.py
transformers.models.granitemoe.modeling_granitemoe.GraniteMoeTopKGating
import torch.nn.functional as F import torch from torch import nn class GraniteMoeTopKGating(nn.Module): def __init__(self, input_size: int, num_experts: int, top_k: int): """ Initialize the top-k gating mechanism. Args: input_size (`int`): Size of the input. ...
class GraniteMoeTopKGating(nn.Module): def __init__(self, input_size: int, num_experts: int, top_k: int): ''' Initialize the top-k gating mechanism. Args: input_size (`int`): Size of the input. num_experts (`int`): Number of experts. ...
3
1
22
3
11
14
1
1.17
1
2
0
0
2
4
2
12
46
7
23
17
20
27
21
17
18
1
1
0
2
2,883
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/configuration_grounding_dino.py
transformers.models.grounding_dino.configuration_grounding_dino.GroundingDinoConfig
from ..auto import CONFIG_MAPPING from ...configuration_utils import PretrainedConfig from ...utils.backbone_utils import verify_backbone_config_arguments class GroundingDinoConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GroundingDinoModel`]. It is used to insta...
class GroundingDinoConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GroundingDinoModel`]. It is used to instantiate a Grounding DINO model according to the specified arguments, defining the model architecture. Instantiating a configuration with the default...
8
1
46
2
42
3
3
0.91
1
4
0
0
3
42
3
3
270
16
133
98
81
121
67
50
63
8
1
1
10
2,884
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/image_processing_grounding_dino.py
transformers.models.grounding_dino.image_processing_grounding_dino.AnnotationFormat
from ...utils import ExplicitEnum, TensorType, is_scipy_available, is_torch_available, is_torch_tensor, is_vision_available, logging class AnnotationFormat(ExplicitEnum): COCO_DETECTION = 'coco_detection' COCO_PANOPTIC = 'coco_panoptic'
class AnnotationFormat(ExplicitEnum): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
3
0
3
3
2
0
3
3
2
0
1
0
0
2,885
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/image_processing_grounding_dino.py
transformers.models.grounding_dino.image_processing_grounding_dino.GroundingDinoImageProcessor
from ...feature_extraction_utils import BatchFeature from ...image_transforms import PaddingMode, center_to_corners_format, corners_to_center_format, id_to_rgb, pad, rescale, resize, rgb_to_id, to_channel_dimension_format import numpy as np from ...utils import ExplicitEnum, TensorType, is_scipy_available, is_torch_ava...
class GroundingDinoImageProcessor(BaseImageProcessor): ''' Constructs a Grounding DINO image processor. Args: format (`str`, *optional*, defaults to `AnnotationFormat.COCO_DETECTION`): Data format of the annotations. One of "coco_detection" or "coco_panoptic". do_resize (`bool`,...
14
12
58
4
38
16
6
0.56
1
15
4
0
11
13
12
32
778
58
461
164
350
260
202
66
189
32
3
3
75
2,886
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoBiMultiHeadAttention
from torch import Tensor, nn import torch from typing import Optional, Union import torch.nn.functional as F class GroundingDinoBiMultiHeadAttention(nn.Module): def __init__(self, config): super().__init__() vision_dim = text_dim = config.d_model embed_dim = config.encoder_ffn_dim // 2 ...
class GroundingDinoBiMultiHeadAttention(nn.Module): def __init__(self, config): pass def _reshape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): pass def forward(self, vision_features: torch.FloatTensor, text_features: torch.FloatTensor, vision_attention_mask: Optional[torch...
4
1
49
10
29
10
3
0.34
1
5
0
0
3
13
3
13
149
31
89
42
79
30
73
36
69
6
1
1
9
2,887
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoContrastiveEmbedding
from torch import Tensor, nn import torch import torch.nn.functional as F class GroundingDinoContrastiveEmbedding(nn.Module): def __init__(self, config): super().__init__() self.max_text_len = config.max_text_len def forward(self, vision_hidden_state: torch.FloatTensor, text_hidden_state: tor...
class GroundingDinoContrastiveEmbedding(nn.Module): def __init__(self, config): pass def forward(self, vision_hidden_state: torch.FloatTensor, text_hidden_state: torch.FloatTensor, text_token_mask: torch.BoolTensor) -> torch.FloatTensor: pass
3
0
9
1
7
1
1
0.07
1
2
0
0
2
1
2
12
19
3
15
11
7
1
10
6
7
1
1
0
2
2,888
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoConvEncoder
from torch import Tensor, nn import torch.nn.functional as F from ...utils.backbone_utils import load_backbone import torch from ...file_utils import ModelOutput, is_timm_available, requires_backends class GroundingDinoConvEncoder(nn.Module): """ Convolutional backbone, using either the AutoBackbone API or one...
class GroundingDinoConvEncoder(nn.Module): ''' Convolutional backbone, using either the AutoBackbone API or one from the timm library. nn.BatchNorm2d layers are replaced by GroundingDinoFrozenBatchNorm2d as defined above. ''' def __init__(self, config): pass def forward(self, pixel_va...
3
1
25
3
21
2
7
0.19
1
4
0
0
2
3
2
12
60
10
42
13
39
8
31
13
28
10
1
4
13
2,889
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoConvModel
from torch import Tensor, nn class GroundingDinoConvModel(nn.Module): """ This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder. """ def __init__(self, conv_encoder, position_embedding): super().__init__() self.conv_encoder = conv_encoder...
class GroundingDinoConvModel(nn.Module): ''' This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder. ''' def __init__(self, conv_encoder, position_embedding): pass def forward(self, pixel_values, pixel_mask): pass
3
1
7
1
5
1
2
0.45
1
1
0
0
2
2
2
12
19
3
11
8
8
5
11
8
8
2
1
1
3
2,890
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoDecoder
from torch import Tensor, nn from .configuration_grounding_dino import GroundingDinoConfig import torch import torch.nn.functional as F class GroundingDinoDecoder(GroundingDinoPreTrainedModel): """ Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`GroundingDinoDecoderLayer`]. ...
class GroundingDinoDecoder(GroundingDinoPreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`GroundingDinoDecoderLayer`]. The decoder updates the query embeddings through multiple self-attention and cross-attention layers. Some tweaks for Grounding D...
5
2
56
6
39
12
7
0.37
1
9
4
0
2
8
2
4
233
29
149
44
129
55
78
29
73
25
2
3
28
2,891
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoDecoderLayer
from .configuration_grounding_dino import GroundingDinoConfig from torch import Tensor, nn import torch.nn.functional as F import torch from typing import Optional, Union from ...activations import ACT2FN class GroundingDinoDecoderLayer(nn.Module): def __init__(self, config: GroundingDinoConfig): super()....
class GroundingDinoDecoderLayer(nn.Module): def __init__(self, config: GroundingDinoConfig): pass def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Optional[Tensor]): pass def forward(self, hidden_states: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, r...
4
0
37
5
29
3
2
0.09
1
6
3
0
3
13
3
13
114
17
89
38
72
8
48
25
44
2
1
1
5
2,892
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoDeformableLayer
import torch from typing import Optional, Union from ...activations import ACT2FN from .configuration_grounding_dino import GroundingDinoConfig from torch import Tensor, nn import torch.nn.functional as F class GroundingDinoDeformableLayer(nn.Module): def __init__(self, config: GroundingDinoConfig): super...
class GroundingDinoDeformableLayer(nn.Module): def __init__(self, config: GroundingDinoConfig): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, reference_points=None, spatial_shapes=None, spatial_shapes_list=None, lev...
3
1
38
4
25
10
2
0.37
1
5
2
0
2
9
2
12
78
8
51
24
39
19
30
15
27
3
1
2
4
2,893
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoDropPath
from torch import Tensor, nn import torch from typing import Optional, Union import torch.nn.functional as F class GroundingDinoDropPath(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: ...
class GroundingDinoDropPath(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...
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
2,894
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoEncoder
import torch from typing import Optional, Union from ...pytorch_utils import meshgrid from .configuration_grounding_dino import GroundingDinoConfig from torch import Tensor, nn import torch.nn.functional as F class GroundingDinoEncoder(GroundingDinoPreTrainedModel): """ Transformer encoder consisting of *confi...
class GroundingDinoEncoder(GroundingDinoPreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* deformable attention layers. Each layer is a [`GroundingDinoEncoderLayer`]. The encoder updates the flattened multi-scale feature maps through multiple deformable attention layers. ...
5
3
51
3
29
18
7
0.7
1
8
3
0
2
2
3
5
166
15
89
39
68
62
48
22
44
17
2
2
20
2,895
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoEncoderLayer
from torch import Tensor, nn import torch from typing import Optional, Union import torch.nn.functional as F class GroundingDinoEncoderLayer(nn.Module): def __init__(self, config) -> None: super().__init__() self.d_model = config.d_model self.text_enhancer_layer = GroundingDinoTextEnhancer...
class GroundingDinoEncoderLayer(nn.Module): def __init__(self, config) -> None: pass def get_text_position_embeddings(self, text_features: Tensor, text_position_embedding: Optional[torch.Tensor], text_position_ids: Optional[torch.Tensor]) -> Tensor: pass def forward(self, vision_features...
4
0
24
2
22
0
2
0.01
1
5
3
0
3
4
3
13
76
9
67
30
45
1
24
12
20
3
1
1
6
2,896
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoEncoderOutput
import torch from ...file_utils import ModelOutput, is_timm_available, requires_backends from ...utils import auto_docstring, logging from typing import Optional, Union from dataclasses import dataclass import torch.nn.functional as F @dataclass @auto_docstring(custom_intro='\n Base class for outputs of the Groundi...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of the GroundingDinoEncoder. This class extends BaseModelOutput, due to:\n - vision and text last hidden states\n - vision and text intermediate hidden states\n ') class GroundingDinoEncoderOutput(ModelOutput): ''' last_hidden_state_...
3
1
0
0
0
0
0
3.83
1
0
0
0
0
0
0
0
31
2
6
6
5
23
6
6
5
0
1
0
0
2,897
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoForObjectDetection
import torch from ...utils import auto_docstring, logging from typing import Optional, Union from .configuration_grounding_dino import GroundingDinoConfig from torch import Tensor, nn import torch.nn.functional as F @auto_docstring(custom_intro='\n Grounding DINO Model (consisting of a backbone and encoder-decoder ...
@auto_docstring(custom_intro='\n Grounding DINO Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top,\n for tasks such as COCO detection.\n ') class GroundingDinoForObjectDetection(GroundingDinoPreTrainedModel): def __init__(self, config: GroundingDinoConfig)...
5
1
62
8
38
16
7
0.43
1
13
6
0
3
3
3
5
198
26
120
45
101
52
61
31
57
16
2
2
20
2,898
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoFrozenBatchNorm2d
from torch import Tensor, nn import torch import torch.nn.functional as F class GroundingDinoFrozenBatchNorm2d(nn.Module): """ BatchNorm2d where the batch statistics and the affine parameters are fixed. Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than ...
class GroundingDinoFrozenBatchNorm2d(nn.Module): ''' BatchNorm2d where the batch statistics and the affine parameters are fixed. Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than torchvision.models.resnet[18,34,50,101] produce nans. ''' def _...
4
1
9
0
8
1
1
0.28
1
1
0
0
3
0
3
13
37
5
25
13
19
7
21
11
17
2
1
1
4
2,899
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py
transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoFusionLayer
from torch import Tensor, nn import torch from typing import Optional, Union import torch.nn.functional as F class GroundingDinoFusionLayer(nn.Module): def __init__(self, config): super().__init__() drop_path = config.fusion_droppath self.layer_norm_vision = nn.LayerNorm(config.d_model, co...
class GroundingDinoFusionLayer(nn.Module): def __init__(self, config): pass def forward(self, vision_features: torch.FloatTensor, text_features: torch.FloatTensor, attention_mask_vision: Optional[torch.BoolTensor]=None, attention_mask_text: Optional[torch.BoolTensor]=None) -> tuple[tuple[torch.FloatT...
3
1
30
3
14
13
2
0.9
1
3
2
0
2
6
2
12
61
6
29
18
20
26
18
12
15
2
1
0
3