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
3,800
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mistral/modular_mistral.py
transformers.models.mistral.modular_mistral.MistralForTokenClassification
from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward class MistralForTokenClassification(LlamaForTokenClassification): pass
class MistralForTokenClassification(LlamaForTokenClassification): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
3,801
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mistral/modular_mistral.py
transformers.models.mistral.modular_mistral.MistralMLP
from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward from torch import nn class MistralMLP(LlamaMLP): def __init__(self, config)...
class MistralMLP(LlamaMLP): def __init__(self, config): pass
2
0
5
0
5
0
1
0
1
1
0
0
1
5
1
13
6
0
6
5
4
0
6
5
4
1
2
0
1
3,802
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mistral/modular_mistral.py
transformers.models.mistral.modular_mistral.MistralModel
from transformers.utils.generic import check_model_inputs from typing import Callable, Optional from ...processing_utils import Unpack import torch from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask from ...cache_utils import Cache, DynamicCache from ...modeling_outputs import BaseModelO...
class MistralModel(LlamaModel): @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]=None, past_key_values: Optional[Cache]=None, inputs_embeds: Optional[torch.FloatTensor]=No...
4
0
51
2
36
12
6
0.33
1
12
6
0
2
2
3
10
156
9
111
39
89
37
50
20
46
11
3
3
18
3,803
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/configuration_mixtral.py
transformers.models.mixtral.configuration_mixtral.MixtralConfig
from ...configuration_utils import PretrainedConfig class MixtralConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MixtralModel`]. It is used to instantiate an Mixtral model according to the specified arguments, defining the model architecture. Instantiating a ...
class MixtralConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MixtralModel`]. It is used to instantiate an Mixtral model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a sim...
2
1
61
3
57
1
3
1.11
1
1
0
0
1
20
1
1
160
13
70
52
41
78
28
25
26
3
1
1
3
3,804
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralAttention
import torch from ...utils.deprecation import deprecate_kwarg from ...processing_utils import Unpack import torch.nn.functional as F from torch import nn from ...cache_utils import Cache, DynamicCache from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_mixtral import MixtralConfig...
class MixtralAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: MixtralConfig, layer_idx: int): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, p...
4
1
31
3
28
1
3
0.05
1
6
3
0
2
11
2
12
66
8
56
31
45
3
34
23
31
5
1
2
6
3,805
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralBlockSparseTop2MLP
from .configuration_mixtral import MixtralConfig from ...activations import ACT2FN from torch import nn class MixtralBlockSparseTop2MLP(nn.Module): def __init__(self, config: MixtralConfig): super().__init__() self.ffn_dim = config.intermediate_size self.hidden_dim = config.hidden_size ...
class MixtralBlockSparseTop2MLP(nn.Module): def __init__(self, config: MixtralConfig): pass def forward(self, hidden_states): pass
3
0
7
1
6
0
1
0
1
2
1
0
2
6
2
12
16
3
13
10
10
0
13
10
10
1
1
0
2
3,806
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralDecoderLayer
import torch.nn.functional as F from typing import Callable, Optional, Union import torch from ...utils.deprecation import deprecate_kwarg from ...processing_utils import Unpack from ...cache_utils import Cache, DynamicCache from .configuration_mixtral import MixtralConfig from ...modeling_layers import GenericForQuest...
class MixtralDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: MixtralConfig, layer_idx: int): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor...
4
0
39
5
22
12
2
0.53
1
9
5
0
2
5
2
12
79
11
45
24
30
24
23
12
20
3
1
1
4
3,807
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralForCausalLM
from ...generation import GenerationMixin from ...processing_utils import Unpack import torch.nn.functional as F from typing import Callable, Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from torch import nn import torch from ...cache_utils import Cache, DynamicCache from .....
@auto_docstring class MixtralForCausalLM(MixtralPreTrainedModel, 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
17
2
11
4
3
0.3
2
9
4
0
8
6
8
9
148
24
96
41
68
29
47
24
38
13
2
2
20
3,808
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralForQuestionAnswering
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class MixtralForQuestionAnswering(GenericForQuestionAnswering, MixtralPreTrainedModel): pass
class MixtralForQuestionAnswering(GenericForQuestionAnswering, MixtralPreTrainedModel): pass
1
0
18
2
13
3
2
0.22
1
5
3
0
4
2
4
5
77
11
55
28
36
12
26
14
21
5
2
1
8
3,809
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralForSequenceClassification
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class MixtralForSequenceClassification(GenericForSequenceClassification, MixtralPreTrainedModel): pass
class MixtralForSequenceClassification(GenericForSequenceClassification, MixtralPreTrainedModel): 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
3,810
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralForTokenClassification
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class MixtralForTokenClassification(GenericForTokenClassification, MixtralPreTrainedModel): pass
class MixtralForTokenClassification(GenericForTokenClassification, MixtralPreTrainedModel): 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
3,811
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralModel
from .configuration_mixtral import MixtralConfig import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...cache_utils import Cache, DynamicCache from torch import nn import torch.nn.functional as F from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast fr...
@auto_docstring class MixtralModel(MixtralPreTrainedModel): def __init__(self, config: MixtralConfig): 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
47
5
36
7
7
0.21
1
18
12
0
5
8
6
7
298
34
219
73
179
46
104
39
97
24
2
3
44
3,812
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralPreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils.generic import OutputRecorder from .configuration_mixtral import MixtralConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple @auto_docstring class MixtralPreTrainedModel(PreTrainedModel): config: Mixtra...
@auto_docstring class MixtralPreTrainedModel(PreTrainedModel): pass
2
0
10
0
10
0
5
0.04
1
0
0
5
1
0
1
1
24
1
23
15
21
1
22
15
20
5
1
2
5
3,813
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralRMSNorm
from ...integrations import use_kernel_forward_from_hub import torch.nn.functional as F from torch import nn import torch @use_kernel_forward_from_hub('RMSNorm') class MixtralRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ MixtralRMSNorm is equivalent to T5LayerNorm """...
@use_kernel_forward_from_hub('RMSNorm') class MixtralRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' MixtralRMSNorm 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
3,814
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralRotaryEmbedding
import torch.nn.functional as F import torch from .configuration_mixtral import MixtralConfig from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update from torch import nn class MixtralRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: MixtralConfig, device=None):...
class MixtralRotaryEmbedding(nn.Module): def __init__(self, config: MixtralConfig, 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
3,815
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modeling_mixtral.py
transformers.models.mixtral.modeling_mixtral.MixtralSparseMoeBlock
import torch import torch.nn.functional as F from torch import nn class MixtralSparseMoeBlock(nn.Module): """ This implementation is strictly equivalent to standard MoE with full capacity (no dropped tokens). It's faster since it formulates MoE operations in terms of block-sparse operations to acco...
class MixtralSparseMoeBlock(nn.Module): ''' This implementation is strictly equivalent to standard MoE with full capacity (no dropped tokens). It's faster since it formulates MoE operations in terms of block-sparse operations to accommodate imbalanced assignments of tokens to experts, whereas s...
3
2
27
5
16
7
2
0.72
1
5
1
0
2
7
2
12
66
11
32
21
29
23
30
21
27
3
1
1
4
3,816
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralAttention
from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding class MixtralAttention(MistralAttention): pass
class MixtralAttention(MistralAttention): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
12
2
0
2
1
1
0
2
1
1
0
2
0
0
3,817
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralBlockSparseTop2MLP
from ...activations import ACT2FN from .configuration_mixtral import MixtralConfig from torch import nn class MixtralBlockSparseTop2MLP(nn.Module): def __init__(self, config: MixtralConfig): super().__init__() self.ffn_dim = config.intermediate_size self.hidden_dim = config.hidden_size ...
class MixtralBlockSparseTop2MLP(nn.Module): def __init__(self, config: MixtralConfig): pass def forward(self, hidden_states): pass
3
0
7
1
6
0
1
0
1
2
1
0
2
6
2
12
16
3
13
10
10
0
13
10
10
1
1
0
2
3,818
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralDecoderLayer
from .configuration_mixtral import MixtralConfig from ...modeling_layers import GradientCheckpointingLayer from ...cache_utils import Cache, DynamicCache from ...utils import TransformersKwargs, logging from ...utils.deprecation import deprecate_kwarg from ...processing_utils import Unpack import torch from typing impo...
class MixtralDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: MixtralConfig, layer_idx: int): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor...
4
0
39
5
22
12
2
0.53
1
9
5
0
2
5
2
12
79
11
45
24
30
24
23
12
20
3
1
1
4
3,819
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralForCausalLM
from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding import torch.nn.functional as F import torch from ...utils import Transf...
class MixtralForCausalLM(MistralForCausalLM): def __init__(self, config): 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[torch...
3
1
59
8
38
14
7
0.36
1
8
3
0
2
4
2
11
121
17
77
31
58
28
31
15
28
13
3
2
14
3,820
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralForQuestionAnswering
from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding class MixtralForQuestionAnswering(MistralForQuestionAnswering): pas...
class MixtralForQuestionAnswering(MistralForQuestionAnswering): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
3,821
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralForSequenceClassification
from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding class MixtralForSequenceClassification(MistralForSequenceClassification...
class MixtralForSequenceClassification(MistralForSequenceClassification): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
3,822
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralForTokenClassification
from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding class MixtralForTokenClassification(MistralForTokenClassification): ...
class MixtralForTokenClassification(MistralForTokenClassification): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
3,823
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralModel
from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask from ...processing_utils import Unpack from ...utils import TransformersKwargs, logging import torch from ...cache_utils import Cache, DynamicCache from typing import Optional, Union from ..mistral.modeling_mistral import MistralAttentio...
class MixtralModel(MistralModel): 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[torch.FloatTensor]=None, use_cache: Optional[bool]=None, cache_...
2
0
61
9
51
2
13
0.03
1
10
5
0
2
1
2
9
124
19
102
28
85
3
47
14
44
24
3
2
25
3,824
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralPreTrainedModel
from ...utils.generic import OutputRecorder from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding class MixtralPreTrainedMode...
class MixtralPreTrainedModel(MistralPreTrainedModel): pass
1
0
0
0
0
0
0
0.5
1
0
0
0
0
0
0
1
2
0
2
2
1
1
2
2
1
0
2
0
0
3,825
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralRMSNorm
from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding class MixtralRMSNorm(MistralRMSNorm): pass
class MixtralRMSNorm(MistralRMSNorm): 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
3,826
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralRotaryEmbedding
from ..mistral.modeling_mistral import MistralAttention, MistralForCausalLM, MistralForQuestionAnswering, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralPreTrainedModel, MistralRMSNorm, MistralRotaryEmbedding class MixtralRotaryEmbedding(MistralRotaryEmbedding): pass
class MixtralRotaryEmbedding(MistralRotaryEmbedding): 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
3,827
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mixtral/modular_mixtral.py
transformers.models.mixtral.modular_mixtral.MixtralSparseMoeBlock
from torch import nn import torch.nn.functional as F import torch class MixtralSparseMoeBlock(nn.Module): """ This implementation is strictly equivalent to standard MoE with full capacity (no dropped tokens). It's faster since it formulates MoE operations in terms of block-sparse operations to acco...
class MixtralSparseMoeBlock(nn.Module): ''' This implementation is strictly equivalent to standard MoE with full capacity (no dropped tokens). It's faster since it formulates MoE operations in terms of block-sparse operations to accommodate imbalanced assignments of tokens to experts, whereas s...
3
2
27
5
16
7
2
0.72
1
5
1
0
2
7
2
12
66
11
32
21
29
23
30
21
27
3
1
1
4
3,828
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/configuration_mllama.py
transformers.models.mllama.configuration_mllama.MllamaConfig
from ...configuration_utils import PretrainedConfig class MllamaConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MllamaForConditionalGeneration`]. It is used to instantiate an Mllama model according to the specified arguments, defining the model architecture. ...
class MllamaConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MllamaForConditionalGeneration`]. It is used to instantiate an Mllama model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults ...
2
1
26
3
23
0
7
1.08
1
4
2
0
1
3
1
1
69
15
26
13
18
28
16
7
14
7
1
1
7
3,829
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/configuration_mllama.py
transformers.models.mllama.configuration_mllama.MllamaTextConfig
from typing import Optional from ...configuration_utils import PretrainedConfig from ...modeling_rope_utils import rope_config_validation class MllamaTextConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MllamaTextModel`]. It is used to instantiate an Mllama te...
class MllamaTextConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MllamaTextModel`]. It is used to instantiate an Mllama text model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will y...
2
1
50
2
48
0
2
1.82
1
5
0
0
1
15
1
1
156
12
51
41
27
93
23
19
21
2
1
1
2
3,830
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/configuration_mllama.py
transformers.models.mllama.configuration_mllama.MllamaVisionConfig
from typing import Optional from ...configuration_utils import PretrainedConfig class MllamaVisionConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MllamaVisionModel`]. It is used to instantiate an Mllama vision model according to the specified arguments, defin...
class MllamaVisionConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MllamaVisionModel`]. It is used to instantiate an Mllama vision model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults ...
4
1
23
1
22
0
3
1.13
1
5
0
0
2
15
2
2
113
13
47
39
25
53
28
20
25
4
1
2
5
3,831
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/convert_mllama_weights_to_hf.py
transformers.models.mllama.convert_mllama_weights_to_hf.MllamaConverter
from transformers.convert_slow_tokenizer import TikTokenConverter from typing import Optional from transformers import GenerationConfig, MllamaConfig, MllamaForConditionalGeneration, MllamaImageProcessor, PreTrainedTokenizerFast class MllamaConverter(TikTokenConverter): def __init__(self, vocab_file, special_toke...
class MllamaConverter(TikTokenConverter): def __init__(self, vocab_file, special_tokens: list[str], pattern: str, model_max_length: int, chat_template: Optional[str]=None, **kwargs): pass
2
0
20
0
20
0
2
0
1
4
0
0
1
2
1
5
21
0
21
13
11
0
8
5
6
2
1
1
2
3,832
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/image_processing_mllama.py
transformers.models.mllama.image_processing_mllama.MllamaImageProcessor
from ...image_transforms import PaddingMode, get_image_size, pad, resize from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_vision_available, make_nested_list_of_images, to_numpy_array, validate_preprocess_argume...
class MllamaImageProcessor(BaseImageProcessor): ''' Constructs a Mllama image processor. Args: do_convert_rgb (`bool`, *optional*, defaults to `True`): Whether to convert the image to RGB. This is useful if the input image is of a different format e.g. RGBA. Only has an effe...
5
4
81
9
47
25
6
0.69
1
8
3
0
4
11
4
24
361
43
188
85
138
130
79
40
74
17
3
3
23
3,833
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaCrossAttentionDecoderLayer
from typing import Callable, Optional, Union from ...processing_utils import Unpack from ...cache_utils import Cache, DynamicCache import torch from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch.nn.functional as F from ...modeling_flash_attention_utils import FlashAttentio...
class MllamaCrossAttentionDecoderLayer(GradientCheckpointingLayer): '''Cross-attention transformer block with tanh-gated attention and feedforward.''' def __init__(self, config: MllamaTextConfig, layer_idx: int) -> None: pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='...
4
1
27
4
23
1
3
0.04
1
8
4
0
2
7
2
12
58
10
47
26
31
2
27
13
24
4
1
1
5
3,834
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaForCausalLM
import torch.nn.functional as F from ...generation import GenerationMixin import torch from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging from ...modeling_outputs import Bas...
@auto_docstring(custom_intro='\n The Mllama Text Model with a language modeling head on top.\n ') class MllamaForCausalLM(MllamaPreTrainedModel, GenerationMixin): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=Non...
6
1
15
2
9
4
2
0.37
2
8
3
0
8
4
8
11
132
21
82
42
52
30
39
23
30
8
2
1
15
3,835
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaForConditionalGeneration
from typing import Callable, Optional, Union from torch import nn import torch.nn.functional as F from ...generation import GenerationMixin import torch from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torc...
@auto_docstring(custom_intro='\n The Mllama model which consists of a vision encoder and a language model.\n ') class MllamaForConditionalGeneration(MllamaPreTrainedModel, GenerationMixin): def __init__(self, config: MllamaConfig): pass def get_input_embeddings(self): pass def set_i...
16
1
25
3
17
5
3
0.3
2
9
4
0
10
9
10
13
263
39
175
61
127
53
79
26
68
11
2
2
31
3,836
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaPreTrainedModel
from typing import Callable, Optional, Union from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn from ...modeling_attn_mask_utils import AttentionMaskConverter import torch.nn.functional as F from ...utils.generic import OutputRecorder, check_model_inputs from .configuration_mlla...
@auto_docstring class MllamaPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass def _update_causal_mask(self, attention_mask: Union[torch.Tensor, 'BlockMask'], input_tensor: torch.Tensor, cache_position: torch.Tensor, past_key_values: Cache, output_attentions: bool=False): ...
6
1
46
3
33
10
7
0.3
1
9
6
4
2
0
3
3
156
11
113
41
92
34
59
24
55
9
1
2
22
3,837
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaPrecomputedAspectRatioEmbedding
from torch import nn from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch import torch.nn.functional as F class MllamaPrecomputedAspectRatioEmbedding(nn.Module): def __init__(self, config: MllamaVisionConfig, is_gated: bool=True): super().__init__() sel...
class MllamaPrecomputedAspectRatioEmbedding(nn.Module): def __init__(self, config: MllamaVisionConfig, is_gated: bool=True): pass def forward(self, hidden_state: torch.Tensor, aspect_ratio_ids: torch.Tensor) -> torch.Tensor: pass
3
0
10
2
8
0
2
0
1
4
1
0
2
6
2
12
21
4
17
10
14
0
17
10
14
2
1
1
4
3,838
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaPrecomputedPositionEmbedding
from torch import nn from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch import torch.nn.functional as F class MllamaPrecomputedPositionEmbedding(nn.Module): def __init__(self, config: MllamaVisionConfig): super().__init__() self.max_num_tiles = config...
class MllamaPrecomputedPositionEmbedding(nn.Module): def __init__(self, config: MllamaVisionConfig): pass def forward(self, hidden_state: torch.Tensor, aspect_ratio_ids: torch.Tensor) -> torch.Tensor: pass
3
0
17
3
12
2
1
0.16
1
3
1
0
2
8
2
12
35
6
25
16
22
4
21
16
18
1
1
0
2
3,839
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaRotaryEmbedding
from torch import nn import torch.nn.functional as F from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch class MllamaRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, c...
class MllamaRotaryEmbedding(nn.Module): def __init__(self, config: MllamaTextConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
16
2
12
4
2
0.29
1
4
1
0
3
7
3
13
53
7
38
21
33
11
35
20
31
3
1
1
7
3,840
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaSelfAttentionDecoderLayer
from typing import Callable, Optional, Union from ...modeling_layers import GradientCheckpointingLayer from ...utils.deprecation import deprecate_kwarg from ...modeling_flash_attention_utils import FlashAttentionKwargs import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, Mll...
class MllamaSelfAttentionDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: MllamaTextConfig, layer_idx: int): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, cross_attention_states: Optional[torch...
4
1
40
5
23
13
2
0.54
1
8
4
0
2
6
2
12
81
11
46
25
30
25
24
12
21
3
1
1
4
3,841
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaTextCrossAttention
from typing import Callable, Optional, Union from ...utils.deprecation import deprecate_kwarg from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch from...
class MllamaTextCrossAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: Optional[MllamaTextConfig]=None, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def for...
4
2
40
5
34
2
4
0.07
1
8
3
1
2
14
2
12
84
11
69
37
53
5
47
24
44
6
1
2
7
3,842
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaTextMLP
from torch import nn from ...activations import ACT2FN class MllamaTextMLP(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...
class MllamaTextMLP(nn.Module): def __init__(self, config): pass def forward(self, x): pass
3
0
7
0
6
1
1
0.08
1
1
0
0
2
7
2
12
15
1
13
11
10
1
13
11
10
1
1
0
2
3,843
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaTextModel
import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, Cau...
@auto_docstring(custom_intro='\n The Mllama Text Model which consists of transformer with self and cross attention layers.\n ') class MllamaTextModel(MllamaPreTrainedModel): def __init__(self, config: MllamaTextConfig): pass @check_model_inputs @can_return_tuple @auto_docstring def fo...
7
1
44
7
31
5
7
0.16
1
15
8
0
4
8
4
7
183
33
129
45
107
21
70
29
65
24
2
2
29
3,844
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaTextRMSNorm
from torch import nn import torch import torch.nn.functional as F class MllamaTextRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ MllamaTextRMSNorm is equivalent to T5LayerNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) ...
class MllamaTextRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' MllamaTextRMSNorm 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
3,845
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaTextSelfAttention
from typing import Callable, Optional, Union from ...utils.deprecation import deprecate_kwarg from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch cla...
class MllamaTextSelfAttention(nn.Module): def __init__(self, config: MllamaTextConfig, 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: torch.Tensor, position_embeddings: torch.Tensor...
4
0
34
7
27
2
3
0.06
1
5
1
1
2
13
2
12
70
14
54
35
41
3
44
25
41
4
1
1
5
3,846
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaVisionAttention
from typing import Callable, Optional, Union from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch class MllamaVisionAttention(nn.Module): def __i...
class MllamaVisionAttention(nn.Module): def __init__(self, config: MllamaVisionConfig): pass def forward(self, hidden_state: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, **kwargs) -> tuple[torch.Tensor, Optional[torch.Tensor]]: pass
3
0
24
6
18
1
2
0.06
1
4
1
1
2
7
2
12
49
12
36
24
28
2
31
19
28
3
1
1
4
3,847
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaVisionEncoder
from typing import Callable, Optional, Union from torch import nn import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, CausalLMOutputWithPast class MllamaVisionEncoder(...
class MllamaVisionEncoder(nn.Module): ''' Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a [`MllamaEncoderLayer`]. Args: config: MllamaConfig ''' def __init__(self, config: MllamaVisionConfig, num_layers=32, is_gated=False): pa...
3
2
38
4
24
10
7
0.54
1
8
3
0
2
3
2
12
85
11
48
17
38
26
27
10
24
12
1
2
13
3,848
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaVisionEncoderLayer
from typing import Callable, Optional, Union import math from torch import nn import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch class MllamaVisionEncoderLayer(nn.Module): def __init__(self, config: MllamaVisionConfig, is_gated: bool=F...
class MllamaVisionEncoderLayer(nn.Module): def __init__(self, config: MllamaVisionConfig, is_gated: bool=False): pass def forward(self, hidden_state: torch.Tensor, attention_mask: Optional[torch.Tensor]=None): pass
3
0
23
4
18
1
3
0.06
1
5
2
0
2
10
2
12
47
9
36
21
28
2
31
16
28
4
1
1
6
3,849
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaVisionMLP
from torch import nn from ...activations import ACT2FN import torch import torch.nn.functional as F class MllamaVisionMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.activation_fn = ACT2FN[config.hidden_act] self.fc1 = nn.Linear(config.hidde...
class MllamaVisionMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
1
0
1
2
0
0
2
4
2
12
13
1
12
7
9
0
12
7
9
1
1
0
2
3,850
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/modeling_mllama.py
transformers.models.mllama.modeling_mllama.MllamaVisionModel
from torch import nn import torch.nn.functional as F from .configuration_mllama import MllamaConfig, MllamaTextConfig, MllamaVisionConfig import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging from ...modeling_outputs import BaseModelOutput, BaseMod...
@auto_docstring(custom_intro='\n The Mllama Vision Model which consists of two vision encoders.\n ') class MllamaVisionModel(MllamaPreTrainedModel): def __init__(self, config: MllamaVisionConfig): pass def get_input_embeddings(self): ''' This function is used to fetch the first e...
8
2
50
9
32
10
3
0.3
1
9
5
0
4
17
4
7
208
38
132
50
117
39
82
41
77
9
2
1
12
3,851
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/processing_mllama.py
transformers.models.mllama.processing_mllama.MllamaImagesKwargs
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack from typing import Optional, Union class MllamaImagesKwargs(ImagesKwargs, total=False): max_image_tiles: Optional[int]
class MllamaImagesKwargs(ImagesKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
2
0
0
3,852
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/processing_mllama.py
transformers.models.mllama.processing_mllama.MllamaProcessor
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack from ...feature_extraction_utils import BatchFeature from ...tokenization_utils_base import PreTokenizedInput, TextInput from ...image_utils import ImageInput, make_nested_list_of_images from typing import Optional, Union class Mlla...
class MllamaProcessor(ProcessorMixin): ''' Constructs a Mllama processor which wraps [`MllamaImageProcessor`] and [`PretrainedTokenizerFast`] into a single processor that inherits both the image processor and tokenizer functionalities. See the [`~MllamaProcessor.__call__`] and [`~OwlViTProcessor.decode...
6
3
25
2
15
8
3
0.77
1
7
2
0
6
6
6
23
190
25
94
41
79
72
64
33
57
12
2
3
18
3,853
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mllama/processing_mllama.py
transformers.models.mllama.processing_mllama.MllamaProcessorKwargs
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack class MllamaProcessorKwargs(ProcessingKwargs, total=False): images_kwargs: MllamaImagesKwargs _defaults = {'image_kwargs': {'max_image_tiles': 4}}
class MllamaProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
8
1
7
2
6
0
3
2
2
0
3
0
0
3,854
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mluke/tokenization_mluke.py
transformers.models.mluke.tokenization_mluke.MLukeTokenizer
import json import sentencepiece as spm import itertools from typing import Any, Optional, Union import numpy as np from shutil import copyfile from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import ENCODE_KWARGS_DOCSTRING, AddedToken, BatchEncoding, EncodedInput, PaddingStrategy, ...
@requires(backends=('sentencepiece',)) class MLukeTokenizer(PreTrainedTokenizer): ''' Adapted from [`XLMRobertaTokenizer`] and [`LukeTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main method...
30
12
59
6
44
10
7
0.31
1
21
2
0
22
15
22
111
1,506
175
1,026
341
809
314
449
136
424
30
3
4
170
3,855
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/configuration_mobilebert.py
transformers.models.mobilebert.configuration_mobilebert.MobileBertConfig
from ...configuration_utils import PretrainedConfig class MobileBertConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MobileBertModel`] or a [`TFMobileBertModel`]. It is used to instantiate a MobileBERT model according to the specified arguments, defining the m...
class MobileBertConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MobileBertModel`] or a [`TFMobileBertModel`]. It is used to instantiate a MobileBERT model according to the specified arguments, defining the model architecture. Instantiating a configuration...
2
1
57
3
54
0
2
1.2
1
1
0
0
1
23
1
1
137
14
56
52
28
67
29
26
27
2
1
1
2
3,856
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/configuration_mobilebert.py
transformers.models.mobilebert.configuration_mobilebert.MobileBertOnnxConfig
from collections import OrderedDict from ...onnx import OnnxConfig from collections.abc import Mapping class MobileBertOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: if self.task == 'multiple-choice': dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequ...
class MobileBertOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass
3
0
12
0
12
0
2
0
1
3
0
0
1
0
1
1
14
0
14
4
11
0
6
3
4
2
1
1
2
3,857
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.Bottleneck
import torch from torch import nn class Bottleneck(nn.Module): def __init__(self, config): super().__init__() self.key_query_shared_bottleneck = config.key_query_shared_bottleneck self.use_bottleneck_attention = config.use_bottleneck_attention self.input = BottleneckLayer(config) ...
class Bottleneck(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor]: pass
3
0
16
1
8
8
3
0.88
1
3
1
0
2
4
2
12
34
2
17
9
14
15
15
9
12
3
1
1
5
3,858
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.BottleneckLayer
import torch from torch import nn class BottleneckLayer(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intra_bottleneck_size) self.LayerNorm = NORM2FN[config.normalization_type](config.intra_bottleneck_size, eps=config.layer_nor...
class BottleneckLayer(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
4
0
4
0
1
0
1
2
0
0
2
2
2
12
10
1
9
6
6
0
9
6
6
1
1
0
2
3,859
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.FFNLayer
from torch import nn import torch class FFNLayer(nn.Module): def __init__(self, config): super().__init__() self.intermediate = MobileBertIntermediate(config) self.output = FFNOutput(config) def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: intermediate_output = ...
class FFNLayer(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
4
0
4
0
1
0
1
4
2
0
2
2
2
12
10
1
9
7
6
0
9
7
6
1
1
0
2
3,860
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.FFNOutput
import torch from torch import nn class FFNOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.true_hidden_size) self.LayerNorm = NORM2FN[config.normalization_type](config.true_hidden_size, eps=config.layer_norm_eps) ...
class FFNOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, residual_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
4
0
4
0
1
0
1
2
0
0
2
2
2
12
10
1
9
6
6
0
9
6
6
1
1
0
2
3,861
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertAttention
from ...processing_utils import Unpack from torch import nn from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union class Mobil...
class MobileBertAttention(nn.Module): def __init__(self, config): pass def prune_heads(self, heads): pass def forward(self, query_tensor: torch.Tensor, key_tensor: torch.Tensor, value_tensor: torch.Tensor, layer_input: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_...
4
0
15
1
13
2
1
0.13
1
6
2
0
3
3
3
13
48
4
40
20
27
5
22
11
18
2
1
1
4
3,862
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertEmbeddings
from typing import Callable, Optional, Union from torch import nn import torch class MobileBertEmbeddings(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.trigram_input = config.trigram_input s...
class MobileBertEmbeddings(nn.Module): '''Construct the embeddings from word, position and token_type embeddings.''' def __init__(self, config): pass def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTen...
3
1
35
5
26
5
5
0.21
1
2
0
0
2
9
2
12
74
11
52
25
43
11
36
19
33
7
1
1
9
3,863
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertEncoder
import torch from ...processing_utils import Unpack from typing import Callable, Optional, Union from torch import nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutpu...
class MobileBertEncoder(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, **kwargs: Unpack[TransformersKwargs]) -> Union[tuple, BaseModelOutput]: pass
3
0
19
2
17
1
5
0.03
1
8
2
0
2
1
2
12
40
5
34
16
23
1
19
8
16
8
1
2
9
3,864
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForMaskedLM
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from ...utils.generic import can_return_tuple, check_model_inputs from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss import torch from ...modeling_outpu...
@auto_docstring class MobileBertForMaskedLM(MobileBertPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass def resize_token_embeddings(self, new_num_tokens: Optional[int]=None) -> nn.Emb...
9
1
14
1
11
2
2
0.14
1
6
3
0
5
3
5
6
85
11
66
29
40
9
29
16
23
5
2
1
9
3,865
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForMultipleChoice
from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...utils.generic import can_return_tuple, check_model_inputs from torch import nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, ...
@auto_docstring class MobileBertForMultipleChoice(MobileBertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, po...
6
1
39
5
31
4
7
0.1
1
5
2
0
2
3
2
3
87
10
70
30
47
7
29
15
26
11
2
1
13
3,866
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForNextSentencePrediction
import torch from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...utils.generic import can_return_tuple, check_model_inputs from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, Question...
@auto_docstring(custom_intro='\n MobileBert Model with a `next sentence prediction (classification)` head on top.\n ') class MobileBertForNextSentencePrediction(MobileBertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Opti...
6
1
45
8
27
11
4
0.38
1
6
3
0
2
2
2
3
94
17
56
25
38
21
22
11
19
6
2
1
7
3,867
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForPreTraining
from ...processing_utils import Unpack from torch import nn from ...utils.generic import can_return_tuple, check_model_inputs from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss import torch from typing import Callable, Optional, Union from ...utils import ModelOutput, TransformersKwargs, auto_docstring, ...
@auto_docstring(custom_intro='\n MobileBert Model with two heads on top as done during the pretraining: a `masked language modeling` head and a\n `next sentence prediction (classification)` head.\n ') class MobileBertForPreTraining(MobileBertPreTrainedModel): def __init__(self, config): pass ...
9
1
19
3
12
5
2
0.4
1
5
3
0
5
2
5
6
106
18
63
31
42
25
30
17
24
5
2
1
9
3,868
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForPreTrainingOutput
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging import torch from dataclasses import dataclass from typing import Callable, Optional, Union @dataclass @auto_docstring(custom_intro='\n Output type of [`MobileBertForPreTraining`].\n ') class MobileBertFor...
@dataclass @auto_docstring(custom_intro='\n Output type of [`MobileBertForPreTraining`].\n ') class MobileBertForPreTrainingOutput(ModelOutput): ''' loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`): Total loss as the sum of the masked language modeling los...
3
1
0
0
0
0
0
3.5
1
0
0
0
0
0
0
0
31
4
6
6
5
21
6
6
5
0
1
0
0
3,869
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForQuestionAnswering
from typing import Callable, Optional, Union import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, Quest...
@auto_docstring class MobileBertForQuestionAnswering(MobileBertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None,...
6
0
41
5
30
7
4
0.18
1
5
2
0
2
3
2
3
94
10
71
30
45
13
32
16
29
7
2
2
8
3,870
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForSequenceClassification
import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, NextSentenceP...
@auto_docstring(custom_intro='\n MobileBert 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 MobileBertForSequenceClassification(MobileBertPreTrainedModel): def __init__(self, config): pass @c...
6
1
42
4
35
4
7
0.09
1
6
2
0
2
5
2
3
94
9
78
28
55
7
36
15
33
12
2
3
14
3,871
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertForTokenClassification
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...processing_utils import Unpack from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...utils.generic import can_return_tuple, check_model_inputs from torch import nn from ...modeling_out...
@auto_docstring class MobileBertForTokenClassification(MobileBertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=Non...
6
1
32
4
26
3
4
0.08
1
5
2
0
2
4
2
3
74
9
60
27
37
5
23
14
20
5
2
1
7
3,872
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertIntermediate
from torch import nn from ...activations import ACT2FN import torch class MobileBertIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.true_hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.inte...
class MobileBertIntermediate(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
3,873
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertLMPredictionHead
import torch from torch import nn class MobileBertLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = MobileBertPredictionHeadTransform(config) self.dense = nn.Linear(config.vocab_size, config.hidden_size - config.embedding_size, bias=False) ...
class MobileBertLMPredictionHead(nn.Module): def __init__(self, config): pass def _tie_weights(self) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
4
0
6
0
5
1
1
0.2
1
3
1
0
3
4
3
13
20
2
15
8
11
3
15
8
11
1
1
0
3
3,874
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertLayer
import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...processing_utils import Unpack from typing import Callable, Optional, Union from torch import nn from ...modeling_layers import GradientCheckpointingLayer class MobileBertLayer(GradientCheck...
class MobileBertLayer(GradientCheckpointingLayer): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, **kwargs: Unpack[TransformersKwargs]) -> tuple[torch.Tensor]: pass
3
0
30
2
28
1
4
0.02
1
10
5
0
2
7
2
12
61
5
56
24
47
1
28
18
25
4
1
2
7
3,875
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...utils.generic import can_return_tuple, check_model_inputs from ...utils import ModelO...
@auto_docstring class MobileBertModel(MobileBertPreTrainedModel): ''' https://huggingface.co/papers/2004.02984 ''' def __init__(self, config, add_pooling_layer=True): ''' add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer ''' ...
10
3
18
2
14
2
4
0.2
1
8
4
0
5
4
5
6
105
15
75
30
52
15
39
18
33
12
2
1
18
3,876
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertOnlyMLMHead
from torch import nn import torch class MobileBertOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = MobileBertLMPredictionHead(config) def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: prediction_scores = self.predictions(sequenc...
class MobileBertOnlyMLMHead(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
3,877
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertOnlyNSPHead
from torch import nn import torch class MobileBertOnlyNSPHead(nn.Module): def __init__(self, config): super().__init__() self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, pooled_output: torch.Tensor) -> torch.Tensor: seq_relationship_score = self.seq_relations...
class MobileBertOnlyNSPHead(nn.Module): def __init__(self, config): pass def forward(self, pooled_output: torch.Tensor) -> torch.Tensor: pass
3
0
3
0
3
0
1
0
1
2
0
0
2
1
2
12
8
1
7
5
4
0
7
5
4
1
1
0
2
3,878
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertOutput
from torch import nn import torch class MobileBertOutput(nn.Module): def __init__(self, config): super().__init__() self.use_bottleneck = config.use_bottleneck self.dense = nn.Linear(config.intermediate_size, config.true_hidden_size) self.LayerNorm = NORM2FN[config.normalization_ty...
class MobileBertOutput(nn.Module): def __init__(self, config): pass def forward(self, intermediate_states: torch.Tensor, residual_tensor_1: torch.Tensor, residual_tensor_2: torch.Tensor) -> torch.Tensor: pass
3
0
10
0
10
0
2
0
1
3
1
0
2
5
2
12
22
1
21
11
16
0
17
9
14
2
1
1
4
3,879
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertPooler
from torch import nn import torch class MobileBertPooler(nn.Module): def __init__(self, config): super().__init__() self.do_activate = config.classifier_activation if self.do_activate: self.dense = nn.Linear(config.hidden_size, config.hidden_size) def forward(self, hidden_...
class MobileBertPooler(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
8
0
7
1
2
0.14
1
2
0
0
2
2
2
12
17
1
14
7
11
2
13
7
10
2
1
1
4
3,880
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertPreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn from .configuration_mobilebert import MobileBertConfig from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging @auto_docstring class MobileBertPreTrainedModel(PreTrainedModel)...
@auto_docstring class MobileBertPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.44
1
1
1
8
1
0
1
1
25
2
16
5
14
7
14
5
12
6
1
2
6
3,881
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertPreTrainingHeads
from torch import nn import torch class MobileBertPreTrainingHeads(nn.Module): def __init__(self, config): super().__init__() self.predictions = MobileBertLMPredictionHead(config) self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, sequence_output: torch.Tensor,...
class MobileBertPreTrainingHeads(nn.Module): def __init__(self, config): pass def forward(self, sequence_output: torch.Tensor, pooled_output: torch.Tensor) -> tuple[torch.Tensor]: pass
3
0
4
0
4
0
1
0
1
3
1
0
2
2
2
12
10
1
9
7
6
0
9
7
6
1
1
0
2
3,882
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertPredictionHeadTransform
from torch import nn import torch from ...activations import ACT2FN class MobileBertPredictionHeadTransform(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.tran...
class MobileBertPredictionHeadTransform(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
3,883
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertSelfAttention
import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from typing import Callable, Optional, Union from torch import nn from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...processing_utils import Unpack class MobileBertSelfAt...
class MobileBertSelfAttention(nn.Module): def __init__(self, config): pass def forward(self, query_tensor: torch.Tensor, key_tensor: torch.Tensor, value_tensor: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, **kwargs: Unpack[TransformersKw...
3
0
18
1
15
2
2
0.13
1
4
0
0
3
7
3
13
56
5
45
31
33
6
35
23
31
4
1
1
7
3,884
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.MobileBertSelfOutput
import torch from torch import nn class MobileBertSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.use_bottleneck = config.use_bottleneck self.dense = nn.Linear(config.true_hidden_size, config.true_hidden_size) self.LayerNorm = NORM2FN[config.normalization...
class MobileBertSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, residual_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
7
0
7
0
2
0
1
2
0
0
2
4
2
12
15
1
14
8
11
0
14
8
11
2
1
1
4
3,885
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.NoNorm
import torch from torch import nn class NoNorm(nn.Module): def __init__(self, feat_size, eps=None): super().__init__() self.bias = nn.Parameter(torch.zeros(feat_size)) self.weight = nn.Parameter(torch.ones(feat_size)) def forward(self, input_tensor: torch.Tensor) -> torch.Tensor: ...
class NoNorm(nn.Module): def __init__(self, feat_size, eps=None): pass def forward(self, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
3
0
3
0
1
0
1
2
0
0
2
2
2
12
8
1
7
5
4
0
7
5
4
1
1
0
2
3,886
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/modeling_mobilebert.py
transformers.models.mobilebert.modeling_mobilebert.OutputBottleneck
import torch from torch import nn class OutputBottleneck(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.true_hidden_size, config.hidden_size) self.LayerNorm = NORM2FN[config.normalization_type](config.hidden_size, eps=config.layer_norm_eps) ...
class OutputBottleneck(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, residual_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
7
8
0
11
7
8
1
1
0
2
3,887
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/tokenization_mobilebert.py
transformers.models.mobilebert.tokenization_mobilebert.MobileBertTokenizer
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace import collections from typing import Optional import os class MobileBertTokenizer(PreTrainedTokenizer): """ Construct a MobileBERT tokenizer. Based on WordPiece. This tokenizer inherits from [`PreTrainedTo...
class MobileBertTokenizer(PreTrainedTokenizer): ''' Construct a MobileBERT tokenizer. Based on WordPiece. 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: v...
14
6
15
1
10
4
2
0.72
1
9
2
0
12
5
12
101
236
29
121
53
85
87
65
29
52
6
3
3
27
3,888
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilebert/tokenization_mobilebert_fast.py
transformers.models.mobilebert.tokenization_mobilebert_fast.MobileBertTokenizerFast
from tokenizers import normalizers from typing import Optional from .tokenization_mobilebert import MobileBertTokenizer import json from ...tokenization_utils_fast import PreTrainedTokenizerFast class MobileBertTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" MobileBERT tokenizer (backed by Huggi...
class MobileBertTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" MobileBERT tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece. This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass...
4
2
24
3
14
7
2
1.12
1
4
0
0
4
1
4
92
141
18
58
29
38
65
27
14
22
2
3
1
7
3,889
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/configuration_mobilenet_v1.py
transformers.models.mobilenet_v1.configuration_mobilenet_v1.MobileNetV1Config
from ...configuration_utils import PretrainedConfig class MobileNetV1Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MobileNetV1Model`]. It is used to instantiate a MobileNetV1 model according to the specified arguments, defining the model architecture. Insta...
class MobileNetV1Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MobileNetV1Model`]. It is used to instantiate a MobileNetV1 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will ...
2
1
27
2
25
0
2
1.37
1
2
0
0
1
9
1
1
75
11
27
24
13
37
15
12
13
2
1
1
2
3,890
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/configuration_mobilenet_v1.py
transformers.models.mobilenet_v1.configuration_mobilenet_v1.MobileNetV1OnnxConfig
from collections import OrderedDict from ...onnx import OnnxConfig from packaging import version from collections.abc import Mapping class MobileNetV1OnnxConfig(OnnxConfig): torch_onnx_minimum_version = version.parse('1.11') @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return Ord...
class MobileNetV1OnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def outputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def atol_for_validation(self) -> float: pass
7
0
3
0
3
0
1
0
1
4
0
0
3
0
3
3
17
3
14
8
7
0
10
5
6
2
1
1
4
3,891
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/feature_extraction_mobilenet_v1.py
transformers.models.mobilenet_v1.feature_extraction_mobilenet_v1.MobileNetV1FeatureExtractor
from .image_processing_mobilenet_v1 import MobileNetV1ImageProcessor from ...utils.import_utils import requires import warnings @requires(backends=('vision',)) class MobileNetV1FeatureExtractor(MobileNetV1ImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class MobileNetV1Fea...
@requires(backends=('vision',)) class MobileNetV1FeatureExtractor(MobileNetV1ImageProcessor): def __init__(self, *args, **kwargs) -> None: pass
3
0
7
0
7
0
1
0
1
2
0
0
1
0
1
24
8
0
8
2
6
0
4
2
2
1
4
0
1
3,892
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/image_processing_mobilenet_v1.py
transformers.models.mobilenet_v1.image_processing_mobilenet_v1.MobileNetV1ImageProcessor
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images, validate_preprocess_arguments from ...image_processing_utils import BaseImageProcessor, Bat...
@requires(backends=('vision',)) class MobileNetV1ImageProcessor(BaseImageProcessor): ''' Constructs a MobileNetV1 image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden...
6
3
71
5
45
21
9
0.74
1
8
2
1
3
10
3
23
257
19
137
57
95
101
63
19
59
19
3
2
27
3,893
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/modeling_mobilenet_v1.py
transformers.models.mobilenet_v1.modeling_mobilenet_v1.MobileNetV1ConvLayer
import torch from ...activations import ACT2FN from .configuration_mobilenet_v1 import MobileNetV1Config from typing import Optional, Union from torch import nn class MobileNetV1ConvLayer(nn.Module): def __init__(self, config: MobileNetV1Config, in_channels: int, out_channels: int, kernel_size: int, stride: Optio...
class MobileNetV1ConvLayer(nn.Module): def __init__(self, config: MobileNetV1Config, in_channels: int, out_channels: int, kernel_size: int, stride: Optional[int]=1, groups: Optional[int]=1, bias: bool=False, use_normalization: Optional[bool]=True, use_activation: Optional[Union[bool, str]]=True) -> None: ...
3
0
31
3
29
0
6
0
1
7
1
0
2
4
2
12
64
6
58
19
44
0
28
8
25
8
1
2
12
3,894
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/modeling_mobilenet_v1.py
transformers.models.mobilenet_v1.modeling_mobilenet_v1.MobileNetV1ForImageClassification
from .configuration_mobilenet_v1 import MobileNetV1Config from typing import Optional, Union import torch from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...utils import auto_docstring, logging from torch import nn @auto_docstring(custom_intro='\n ...
@auto_docstring(custom_intro='\n MobileNetV1 model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n ImageNet.\n ') class MobileNetV1ForImageClassification(MobileNetV1PreTrainedModel): def __init__(self, config: MobileNetV1Config) -> None: pass ...
5
1
34
6
24
4
8
0.14
1
8
3
0
2
4
2
3
76
12
56
21
40
8
34
14
31
13
2
3
15
3,895
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/modeling_mobilenet_v1.py
transformers.models.mobilenet_v1.modeling_mobilenet_v1.MobileNetV1Model
from .configuration_mobilenet_v1 import MobileNetV1Config from typing import Optional, Union from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention import torch from ...utils import auto_docstring, logging from torch import nn @auto_docstring class MobileNetV1Mod...
@auto_docstring class MobileNetV1Model(MobileNetV1PreTrainedModel): def __init__(self, config: MobileNetV1Config, add_pooling_layer: bool=True): ''' add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer ''' pass def _prune_heads(se...
6
1
30
6
24
0
5
0.01
1
12
3
0
3
4
3
4
101
20
80
24
63
1
38
18
34
9
2
2
14
3,896
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v1/modeling_mobilenet_v1.py
transformers.models.mobilenet_v1.modeling_mobilenet_v1.MobileNetV1PreTrainedModel
from ...modeling_utils import PreTrainedModel from torch import nn from ...utils import auto_docstring, logging from typing import Optional, Union from .configuration_mobilenet_v1 import MobileNetV1Config @auto_docstring class MobileNetV1PreTrainedModel(PreTrainedModel): config: MobileNetV1Config base_model_pr...
@auto_docstring class MobileNetV1PreTrainedModel(PreTrainedModel): def _init_weights(self, module: Union[nn.Linear, nn.Conv2d]) -> None: '''Initialize the weights''' pass
3
1
9
0
8
1
4
0.33
1
0
0
2
1
0
1
1
22
2
15
8
13
5
14
8
12
4
1
2
4
3,897
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v2/configuration_mobilenet_v2.py
transformers.models.mobilenet_v2.configuration_mobilenet_v2.MobileNetV2Config
from ...configuration_utils import PretrainedConfig class MobileNetV2Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`MobileNetV2Model`]. It is used to instantiate a MobileNetV2 model according to the specified arguments, defining the model architecture. Insta...
class MobileNetV2Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`MobileNetV2Model`]. It is used to instantiate a MobileNetV2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will ...
2
1
39
2
37
0
2
1.36
1
2
0
0
1
15
1
1
103
11
39
36
19
53
21
18
19
2
1
1
2
3,898
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v2/configuration_mobilenet_v2.py
transformers.models.mobilenet_v2.configuration_mobilenet_v2.MobileNetV2OnnxConfig
from ...onnx import OnnxConfig from collections.abc import Mapping from collections import OrderedDict from packaging import version class MobileNetV2OnnxConfig(OnnxConfig): torch_onnx_minimum_version = version.parse('1.11') @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return Ord...
class MobileNetV2OnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def outputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def atol_for_validation(self) -> float: pass
7
0
3
0
3
0
1
0
1
4
0
0
3
0
3
3
17
3
14
8
7
0
10
5
6
2
1
1
4
3,899
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/mobilenet_v2/feature_extraction_mobilenet_v2.py
transformers.models.mobilenet_v2.feature_extraction_mobilenet_v2.MobileNetV2FeatureExtractor
import warnings from ...utils.import_utils import requires from .image_processing_mobilenet_v2 import MobileNetV2ImageProcessor @requires(backends=('vision',)) class MobileNetV2FeatureExtractor(MobileNetV2ImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class MobileNetV2Fea...
@requires(backends=('vision',)) class MobileNetV2FeatureExtractor(MobileNetV2ImageProcessor): def __init__(self, *args, **kwargs) -> None: pass
3
0
7
0
7
0
1
0
1
2
0
0
1
0
1
25
8
0
8
2
6
0
4
2
2
1
4
0
1