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,400
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieEncoder
from ...cache_utils import Cache, EncoderDecoderCache from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, Sequence...
class ErnieEncoder(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, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: Optional[torch...
3
0
45
4
41
0
9
0
1
8
2
0
2
3
2
12
91
8
83
26
68
0
35
14
32
17
1
3
18
2,401
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForCausalLM
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 ...processing_utils import Unpack from ...generation import GenerationMixin import torch.nn as n...
@auto_docstring(custom_intro='\n Ernie Model with a `language modeling` head on top for CLM fine-tuning.\n ') class ErnieForCausalLM(ErniePreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_emb...
8
1
22
2
16
5
2
0.31
2
7
3
0
5
2
5
6
128
15
86
35
56
27
33
16
27
6
2
1
12
2,402
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForMaskedLM
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 from ...processing_utils import Unp...
@auto_docstring class ErnieForMaskedLM(ErniePreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tens...
11
2
18
2
14
2
2
0.16
1
7
3
0
5
2
5
6
111
17
82
34
53
13
36
18
30
5
2
1
11
2,403
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForMultipleChoice
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 from ...processing_utils import Unp...
@auto_docstring class ErnieForMultipleChoice(ErniePreTrainedModel): 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, task_type_id...
6
1
40
5
32
4
7
0.11
1
5
2
0
2
3
2
3
88
10
70
29
48
8
29
15
26
11
2
1
13
2,404
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForNextSentencePrediction
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput i...
@auto_docstring(custom_intro='\n Ernie Model with a `next sentence prediction (classification)` head on top.\n ') class ErnieForNextSentencePrediction(ErniePreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tens...
6
1
47
9
28
11
4
0.4
1
7
3
0
2
2
2
3
99
18
58
26
39
23
22
11
19
6
2
1
7
2,405
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForPreTraining
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 from ...processing_utils import Unp...
@auto_docstring(custom_intro='\n Ernie Model with two heads on top as done during the pretraining: a `masked language modeling` head and a `next\n sentence prediction (classification)` head.\n ') class ErnieForPreTraining(ErniePreTrainedModel): def __init__(self, config): pass def get_output_...
8
1
24
4
14
7
2
0.48
1
6
3
0
4
2
4
5
107
18
60
31
39
29
27
16
22
5
2
1
8
2,406
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput
import torch import torch.nn as nn from dataclasses import dataclass from typing import Callable, Optional, Union from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging @dataclass @auto_docstring(custom_intro='\n Output type of [`ErnieForPreTraining`].\n ') cl...
@dataclass @auto_docstring(custom_intro='\n Output type of [`ErnieForPreTraining`].\n ') class ErnieForPreTrainingOutput(ModelOutput): ''' loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`): Total loss as the sum of the masked language modeling loss and the ...
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
2,407
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForQuestionAnswering
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 from ...processing_utils import Unp...
@auto_docstring class ErnieForQuestionAnswering(ErniePreTrainedModel): 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, task_type...
6
1
42
5
31
7
4
0.22
1
5
2
0
2
3
2
3
88
10
64
31
46
14
32
16
29
7
2
2
8
2,408
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForSequenceClassification
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput i...
@auto_docstring(custom_intro='\n Ernie Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled\n output) e.g. for GLUE tasks.\n ') class ErnieForSequenceClassification(ErniePreTrainedModel): def __init__(self, config): pass @can_return_tuple...
6
1
43
4
36
4
7
0.11
1
6
2
0
2
5
2
3
90
9
73
29
56
8
36
15
33
12
2
3
14
2,409
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieForTokenClassification
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 from ...processing_utils import Unp...
@auto_docstring class ErnieForTokenClassification(ErniePreTrainedModel): 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, task_ty...
6
1
33
4
27
3
4
0.11
1
5
2
0
2
4
2
3
70
9
55
28
38
6
23
14
20
5
2
1
7
2,410
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieIntermediate
import torch.nn as nn from ...activations import ACT2FN import torch class ErnieIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.intermediate_...
class ErnieIntermediate(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
2,411
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieLMPredictionHead
import torch.nn as nn import torch class ErnieLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = ErniePredictionHeadTransform(config) self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.bias = nn.Parameter(torch...
class ErnieLMPredictionHead(nn.Module): def __init__(self, config): pass def _tie_weights(self): pass def forward(self, hidden_states): pass
4
0
6
1
4
1
1
0.23
1
2
1
0
3
3
3
13
21
5
13
7
9
3
13
7
9
1
1
0
3
2,412
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieLayer
from ...cache_utils import Cache, EncoderDecoderCache import torch import torch.nn as nn from ...processing_utils import Unpack from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from typing import Callable, Optional, Union from ...utils import ModelOutput, Tran...
class ErnieLayer(GradientCheckpointingLayer): def __init__(self, config, layer_idx=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder...
4
0
27
2
23
2
4
0.1
1
7
3
0
3
8
3
13
84
9
70
32
57
7
41
23
37
7
1
2
11
2,413
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieModel
from ...utils.generic import can_return_tuple, check_model_inputs from ...masking_utils import create_causal_mask from ...processing_utils import Unpack import torch.nn as nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossA...
null
12
3
31
3
21
7
5
0.42
1
8
4
0
5
4
5
6
180
24
110
42
82
46
55
25
49
18
2
2
24
2,414
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieOnlyMLMHead
import torch.nn as nn import torch class ErnieOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = ErnieLMPredictionHead(config) def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: prediction_scores = self.predictions(sequence_output)...
class ErnieOnlyMLMHead(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
2,415
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieOnlyNSPHead
import torch.nn as nn class ErnieOnlyNSPHead(nn.Module): def __init__(self, config): super().__init__() self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, pooled_output): seq_relationship_score = self.seq_relationship(pooled_output) return seq_relations...
class ErnieOnlyNSPHead(nn.Module): def __init__(self, config): pass def forward(self, pooled_output): pass
3
0
3
0
3
0
1
0
1
1
0
0
2
1
2
12
8
1
7
5
4
0
7
5
4
1
1
0
2
2,416
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieOutput
import torch.nn as nn import torch class ErnieOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropou...
class ErnieOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
2,417
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErniePooler
import torch.nn as nn import torch class ErniePooler(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: first_toke...
class ErniePooler(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
5
1
1
0.2
1
2
0
0
2
2
2
12
13
1
10
7
7
2
10
7
7
1
1
0
2
2,418
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErniePreTrainedModel
import torch.nn as nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_ernie import ErnieConfig from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging @auto_docstring class ErniePreTrainedModel(PreTrainedModel): config_c...
@auto_docstring class ErniePreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.44
1
0
0
9
1
0
1
1
25
2
16
5
14
7
14
5
12
6
1
2
6
2,419
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErniePreTrainingHeads
import torch.nn as nn class ErniePreTrainingHeads(nn.Module): def __init__(self, config): super().__init__() self.predictions = ErnieLMPredictionHead(config) self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, sequence_output, pooled_output): prediction_...
class ErniePreTrainingHeads(nn.Module): def __init__(self, config): pass def forward(self, sequence_output, pooled_output): pass
3
0
4
0
4
0
1
0
1
2
1
0
2
2
2
12
10
1
9
7
6
0
9
7
6
1
1
0
2
2,420
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErniePredictionHeadTransform
import torch.nn as nn from ...activations import ACT2FN import torch class ErniePredictionHeadTransform(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.transfor...
class ErniePredictionHeadTransform(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
2,421
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieSelfAttention
from ...cache_utils import Cache, EncoderDecoderCache from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from ...processing_utils import Unpack import torch.nn as nn import torch from ...modeling_utils import ALL_ATTEN...
class ErnieSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_value: Optional[C...
3
0
43
7
31
6
6
0.19
1
5
0
0
3
11
3
13
132
22
93
44
80
18
72
35
68
13
1
2
17
2,422
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py
transformers.models.ernie.modeling_ernie.ErnieSelfOutput
import torch import torch.nn as nn class ErnieSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropout(...
class ErnieSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
2,423
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/configuration_esm.py
transformers.models.esm.configuration_esm.EsmConfig
from ...configuration_utils import PretrainedConfig class EsmConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ESMModel`]. It is used to instantiate a ESM model according to the specified arguments, defining the model architecture. Instantiating a configuration...
class EsmConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ESMModel`]. It is used to instantiate a ESM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configur...
3
2
34
1
31
3
4
1.05
1
4
1
0
2
17
2
2
142
13
63
44
38
66
38
22
35
6
1
2
8
2,424
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/configuration_esm.py
transformers.models.esm.configuration_esm.EsmFoldConfig
from dataclasses import asdict, dataclass from typing import Optional @dataclass class EsmFoldConfig: esm_type: Optional[str] = None fp16_esm: bool = True use_esm_attn_map: bool = False esm_ablate_pairwise: bool = False esm_ablate_sequence: bool = False esm_input_dropout: float = 0 embed_aa...
@dataclass class EsmFoldConfig: def __post_init__(self): pass def to_dict(self): ''' Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`]. Returns: `dict[str, any]`: Dictionary of all the attributes that make up this co...
4
1
8
1
5
3
2
0.25
0
2
1
0
2
0
2
2
30
5
20
14
17
5
19
14
16
3
0
1
4
2,425
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/configuration_esm.py
transformers.models.esm.configuration_esm.StructureModuleConfig
from dataclasses import asdict, dataclass @dataclass class StructureModuleConfig: """ Args: sequence_dim: Single representation channel dimension pairwise_dim: Pair representation channel dimension ipa_dim: IPA hidden channel dimension resnet_...
@dataclass class StructureModuleConfig: ''' Args: sequence_dim: Single representation channel dimension pairwise_dim: Pair representation channel dimension ipa_dim: IPA hidden channel dimension resnet_dim: Angle resnet (Alg. 23 line...
3
1
2
0
2
0
1
1.83
0
0
0
0
1
0
1
1
53
2
18
17
16
33
18
17
16
1
0
0
1
2,426
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/configuration_esm.py
transformers.models.esm.configuration_esm.TrunkConfig
from typing import Optional from dataclasses import asdict, dataclass @dataclass class TrunkConfig: num_blocks: int = 48 sequence_state_dim: int = 1024 pairwise_state_dim: int = 128 sequence_head_width: int = 32 pairwise_head_width: int = 32 position_bins: int = 32 dropout: float = 0 la...
@dataclass class TrunkConfig: def __post_init__(self): pass def to_dict(self): ''' Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`]. Returns: `dict[str, any]`: Dictionary of all the attributes that make up this conf...
4
1
24
3
19
3
6
0.1
0
3
1
0
2
0
2
2
62
7
50
18
47
5
37
18
34
10
0
1
11
2,427
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmAttention
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...processing_utils import Unpack from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer from torch import nn class EsmAttention(nn.Module): def __init__(self, config, layer_idx=None, is_cross_attent...
class EsmAttention(nn.Module): def __init__(self, config, layer_idx=None, is_cross_attention=False): pass def prune_heads(self, heads): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, **kwargs: Unpack[Tra...
4
0
15
1
14
1
1
0.07
1
4
2
0
3
4
3
13
49
4
43
22
30
3
24
13
20
2
1
1
4
2,428
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmClassificationHead
from torch import nn import torch class EsmClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_pr...
class EsmClassificationHead(nn.Module): '''Head for sentence-level classification tasks.''' def __init__(self, config): pass def forward(self, features, **kwargs): pass
3
1
7
0
7
1
1
0.14
1
1
0
0
2
3
2
12
17
2
14
7
11
2
14
7
11
1
1
0
2
2,429
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmContactPredictionHead
from torch import nn class EsmContactPredictionHead(nn.Module): """Performs symmetrization, apc, and computes a logistic regression on the output features""" def __init__(self, in_features: int, bias=True, eos_idx: int=2): super().__init__() self.in_features = in_features self.eos_idx ...
class EsmContactPredictionHead(nn.Module): '''Performs symmetrization, apc, and computes a logistic regression on the output features''' def __init__(self, in_features: int, bias=True, eos_idx: int=2): pass def forward(self, tokens, attentions): pass
3
1
15
1
13
2
1
0.19
1
2
0
0
2
4
2
12
33
3
26
14
18
5
19
9
16
1
1
0
2
2,430
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmEmbeddings
from torch import nn import torch class EsmEmbeddings(nn.Module): """ Same as BertEmbeddings with a tiny tweak for positional embeddings indexing. """ def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=c...
class EsmEmbeddings(nn.Module): ''' Same as BertEmbeddings with a tiny tweak for positional embeddings indexing. ''' def __init__(self, config): pass def forward(self, input_ids=None, attention_mask=None, position_ids=None, inputs_embeds=None): pass def create_position_ids_fr...
4
2
27
3
17
7
4
0.43
1
1
0
0
3
8
3
13
88
13
53
22
47
23
41
20
37
8
1
2
11
2,431
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmEncoder
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...processing_utils import Unpack from torch import nn from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, SequenceClassifierOutput, TokenClassifierOutput...
class EsmEncoder(nn.Module): def __init__(self, config): pass @can_return_tuple def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, **kwargs: Unpack[TransformersKwargs]): pass
4
0
47
4
43
0
10
0
1
6
2
0
2
4
2
12
95
8
87
27
72
0
38
15
35
18
1
3
19
2,432
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmForMaskedLM
from ...processing_utils import Unpack from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, SequenceClassifierOutput, TokenClassifierOutput import torch from typing import Calla...
@auto_docstring class EsmForMaskedLM(EsmPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTens...
9
1
15
2
12
2
2
0.12
1
6
3
0
5
2
5
6
89
13
68
29
42
8
29
15
23
5
2
1
10
2,433
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmForSequenceClassification
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss import torch from typing import Callable, Optional, Union from ...processing_utils import Unpack from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, SequenceClassifierOutput, T...
@auto_docstring(custom_intro='\n ESM Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled\n output) e.g. for GLUE tasks.\n ') class EsmForSequenceClassification(EsmPreTrainedModel): def __init__(self, config): pass @can_return_tuple @...
6
1
39
4
32
3
7
0.09
1
7
3
0
2
4
2
3
85
9
70
25
50
6
34
13
31
12
2
3
13
2,434
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmForTokenClassification
from typing import Callable, Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAtt...
@auto_docstring class EsmForTokenClassification(EsmPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, head_...
6
1
30
5
24
2
3
0.07
1
5
2
0
2
4
2
3
68
10
54
25
34
4
23
13
20
5
2
1
6
2,435
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmIntermediate
import torch from torch import nn class EsmIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: hidden_states = self.dense(hidden_sta...
class EsmIntermediate(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
1
2
12
9
1
8
4
5
0
8
4
5
1
1
0
2
2,436
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmLMHead
from torch import nn import torch class EsmLMHead(nn.Module): """ESM Head for masked language modeling.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_n...
class EsmLMHead(nn.Module): '''ESM Head for masked language modeling.''' def __init__(self, config): pass def forward(self, features, **kwargs): pass
3
1
8
1
6
1
1
0.15
1
1
0
0
2
4
2
12
19
4
13
8
10
2
13
8
10
1
1
0
2
2,437
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmLayer
from torch import nn from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_layers import GradientCheckpointingLayer from ...processing_utils import Unpack class EsmLayer(GradientCheckpointingLayer): def __init__(self, config): super().__init__() self.c...
class EsmLayer(GradientCheckpointingLayer): def __init__(self, config): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, **kwargs: Unpack[TransformersKwargs]): pass def feed_forward_chunk(self, attention_o...
4
0
27
2
23
2
4
0.1
1
6
3
0
3
9
3
13
84
9
70
34
57
7
43
25
39
7
1
2
11
2,438
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmModel
from ...utils.generic import OutputRecorder, check_model_inputs from typing import Callable, Optional, Union import torch from ...processing_utils import Unpack from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseMode...
@auto_docstring class EsmModel(EsmPreTrainedModel): ''' The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of cross-attention is added between the self-attention layers, following the architecture described in [Attention is all you need](https://hug...
10
4
26
3
17
6
4
0.43
1
9
5
0
6
5
6
7
180
25
109
41
82
47
56
26
49
16
2
2
23
2,439
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmOutput
from torch import nn class EsmOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_prob) def forward(self, hidden_states, input_tensor): hidden_sta...
class EsmOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, input_tensor): pass
3
0
5
0
5
0
1
0
1
1
0
0
2
2
2
12
11
1
10
5
7
0
10
5
7
1
1
0
2
2,440
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmPooler
from torch import nn import torch class EsmPooler(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: first_token_t...
class EsmPooler(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
5
1
1
0.2
1
2
0
0
2
2
2
12
13
1
10
7
7
2
10
7
7
1
1
0
2
2,441
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmPreTrainedModel
from .configuration_esm import EsmConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn from ...utils.generic import OutputRecorder, check_model_inputs from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging @auto_docstring class EsmPreTrainedMode...
@auto_docstring class EsmPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass def get_output_embeddings(self): pass
4
1
15
0
12
3
6
0.47
1
0
0
6
1
0
1
1
27
2
17
6
15
8
15
6
13
6
1
2
6
2,442
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmSelfAttention
from typing import Callable, Optional, Union from ...processing_utils import Unpack from torch import nn import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel class EsmSelfAttention(nn.Module): def __i...
class EsmSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None, layer_idx=None, is_cross_attention=False): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_stat...
3
0
44
7
30
7
6
0.24
1
6
1
0
3
12
3
13
136
23
92
44
79
22
73
35
69
13
1
2
18
2,443
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.EsmSelfOutput
from torch import nn class EsmSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_prob) def forward(self, hidden_states, input_tensor): hidden_state...
class EsmSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, input_tensor): pass
3
0
5
0
5
0
1
0
1
1
0
0
2
2
2
12
11
1
10
5
7
0
10
5
7
1
1
0
2
2,444
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esm.py
transformers.models.esm.modeling_esm.RotaryEmbedding
import torch class RotaryEmbedding(torch.nn.Module): """ Rotary position embeddings based on those in [RoFormer](https://huggingface.co/docs/transformers/model_doc/roformer). Query and keys are transformed by rotation matrices which depend on their relative positions. """ inv_freq: torch.Tensor...
class RotaryEmbedding(torch.nn.Module): ''' Rotary position embeddings based on those in [RoFormer](https://huggingface.co/docs/transformers/model_doc/roformer). Query and keys are transformed by rotation matrices which depend on their relative positions. ''' def __init__(self, dim: int): ...
4
1
11
2
8
1
1
0.32
1
3
0
0
3
3
3
13
41
8
25
12
21
8
22
12
18
2
1
1
4
2,445
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmCategoricalMixture
import torch import torch.nn as nn class EsmCategoricalMixture: def __init__(self, param, bins=50, start=0, end=1): self.logits = param bins = torch.linspace(start, end, bins + 1, device=self.logits.device, dtype=self.logits.dtype) self.v_bins = (bins[:-1] + bins[1:]) / 2 def log_prob...
class EsmCategoricalMixture: def __init__(self, param, bins=50, start=0, end=1): pass def log_prob(self, true): pass def mean(self): pass
4
0
5
0
3
1
1
0.36
0
0
0
0
3
2
3
3
17
2
11
8
7
4
11
8
7
1
0
0
3
2,446
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldAngleResnet
import torch.nn as nn import torch class EsmFoldAngleResnet(nn.Module): """ Implements Algorithm 20, lines 11-14 """ def __init__(self, config): super().__init__() self.config = config self.linear_in = EsmFoldLinear(config.sequence_dim, config.resnet_dim) self.linear_in...
class EsmFoldAngleResnet(nn.Module): ''' Implements Algorithm 20, lines 11-14 ''' def __init__(self, config): pass def forward(self, s: torch.Tensor, s_initial: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: ''' Args: s: [*, C_hidden] singl...
3
2
29
6
16
8
2
0.56
1
5
2
0
2
6
2
12
63
13
32
14
29
18
27
14
24
2
1
1
4
2,447
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldAngleResnetBlock
import torch import torch.nn as nn class EsmFoldAngleResnetBlock(nn.Module): def __init__(self, config): super().__init__() self.linear_1 = EsmFoldLinear(config.resnet_dim, config.resnet_dim, init='relu') self.linear_2 = EsmFoldLinear(config.resnet_dim, config.resnet_dim, init='final') ...
class EsmFoldAngleResnetBlock(nn.Module): def __init__(self, config): pass def forward(self, a: torch.Tensor) -> torch.Tensor: pass
3
0
8
2
6
0
1
0
1
3
1
0
2
3
2
12
18
5
13
7
10
0
13
7
10
1
1
0
2
2,448
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldAttention
from typing import Callable, Optional, Union import torch.nn as nn import math import torch class EsmFoldAttention(nn.Module): """ Standard multi-head attention using AlphaFold's default layer initialization. Allows multiple bias vectors. """ def __init__(self, c_q: int, c_k: int, c_v: int, c_hidden: ...
class EsmFoldAttention(nn.Module): ''' Standard multi-head attention using AlphaFold's default layer initialization. Allows multiple bias vectors. ''' def __init__(self, c_q: int, c_k: int, c_v: int, c_hidden: int, no_heads: int, gating: bool=True): ''' Args: c_q: ...
5
3
36
5
19
12
3
0.66
1
6
1
0
4
12
4
14
150
24
76
44
52
50
57
25
52
6
1
1
11
2,449
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldBackboneUpdate
import torch import torch.nn as nn class EsmFoldBackboneUpdate(nn.Module): """ Implements part of Algorithm 23. """ def __init__(self, config): super().__init__() self.linear = EsmFoldLinear(config.sequence_dim, 6, init='final') def forward(self, s: torch.Tensor) -> tuple[torch.Te...
class EsmFoldBackboneUpdate(nn.Module): ''' Implements part of Algorithm 23. ''' def __init__(self, config): pass def forward(self, s: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: ''' Args: [*, N_res, C_s] single representation Returns: ...
3
2
8
1
3
4
1
1.43
1
3
1
0
2
1
2
12
21
4
7
5
4
10
7
5
4
1
1
0
2
2,450
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldDropout
from typing import Callable, Optional, Union import torch.nn as nn import torch class EsmFoldDropout(nn.Module): """ Implementation of dropout with the ability to share the dropout mask along a particular dimension. """ def __init__(self, r: float, batch_dim: Union[int, list[int]]): super().__...
class EsmFoldDropout(nn.Module): ''' Implementation of dropout with the ability to share the dropout mask along a particular dimension. ''' def __init__(self, r: float, batch_dim: Union[int, list[int]]): pass def forward(self, x: torch.Tensor) -> torch.Tensor: pass
3
1
7
1
7
0
3
0.21
1
5
0
0
2
3
2
12
20
3
14
8
11
3
14
8
11
3
1
2
5
2,451
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldInvariantPointAttention
import math from typing import Callable, Optional, Union import torch.nn as nn import torch from collections.abc import Sequence from .openfold_utils import OFProtein, Rigid, Rotation, atom14_to_atom37, chunk_layer, compute_predicted_aligned_error, compute_tm, frames_and_literature_positions_to_atom14_pos, make_atom14_...
class EsmFoldInvariantPointAttention(nn.Module): ''' Implements Algorithm 22. ''' def __init__(self, config): pass def forward(self, s: torch.Tensor, z: Optional[torch.Tensor], r: Rigid, mask: torch.Tensor, _offload_inference: bool=False, _z_reference_list: Optional[Sequence[torch.Tensor]...
3
2
95
20
48
29
3
0.63
1
6
2
0
2
14
2
12
195
41
97
46
86
61
77
38
74
4
1
2
5
2,452
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldLayerNorm
import torch.nn as nn import torch class EsmFoldLayerNorm(nn.Module): def __init__(self, c_in, eps=1e-05): super().__init__() self.c_in = (c_in,) self.eps = eps self.weight = nn.Parameter(torch.ones(c_in)) self.bias = nn.Parameter(torch.zeros(c_in)) def forward(self, x...
class EsmFoldLayerNorm(nn.Module): def __init__(self, c_in, eps=1e-05): pass def forward(self, x): pass
3
0
9
2
7
0
2
0
1
2
0
0
2
4
2
12
19
4
15
9
12
0
14
9
11
2
1
2
3
2,453
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldLinear
import torch from typing import Callable, Optional, Union import torch.nn as nn class EsmFoldLinear(nn.Linear): """ A Linear layer with built-in nonstandard initializations. Called just like torch.nn.Linear. Implements the initializers in 1.11.4, plus some additional ones found in the code. """ d...
class EsmFoldLinear(nn.Linear): ''' A Linear layer with built-in nonstandard initializations. Called just like torch.nn.Linear. Implements the initializers in 1.11.4, plus some additional ones found in the code. ''' def __init__(self, in_dim: int, out_dim: int, bias: bool=True, init: str='default'...
2
2
37
4
16
17
3
1.24
1
6
0
0
1
2
1
1
44
6
17
11
8
21
10
4
8
3
1
2
3
2,454
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldPairToSequence
import torch.nn as nn class EsmFoldPairToSequence(nn.Module): def __init__(self, pairwise_state_dim, num_heads): super().__init__() self.layernorm = nn.LayerNorm(pairwise_state_dim) self.linear = nn.Linear(pairwise_state_dim, num_heads, bias=False) def forward(self, pairwise_state): ...
class EsmFoldPairToSequence(nn.Module): def __init__(self, pairwise_state_dim, num_heads): pass def forward(self, pairwise_state): ''' Inputs: pairwise_state: B x L x L x pairwise_state_dim Output: pairwise_bias: B x L x L x num_heads ''' pa...
3
1
9
1
5
3
1
0.6
1
1
0
0
2
2
2
12
19
3
10
7
7
6
10
7
7
1
1
0
2
2,455
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldPreTrainedModel
import torch import torch.nn as nn from .modeling_esm import EsmModel, EsmPreTrainedModel class EsmFoldPreTrainedModel(EsmPreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ def _init_weights(self, modul...
class EsmFoldPreTrainedModel(EsmPreTrainedModel): ''' An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. ''' def _init_weights(self, module): '''Initialize the weights''' pass
2
2
43
1
41
1
12
0.14
1
4
3
0
1
0
1
2
50
2
42
2
40
6
33
2
31
12
2
4
12
2,456
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldRelativePosition
import torch import torch.nn as nn class EsmFoldRelativePosition(nn.Module): def __init__(self, config): super().__init__() self.bins = config.position_bins self.embedding = torch.nn.Embedding(2 * self.bins + 2, config.pairwise_state_dim) def forward(self, residue_index, mask=None): ...
class EsmFoldRelativePosition(nn.Module): def __init__(self, config): pass def forward(self, residue_index, mask=None): ''' Input: residue_index: B x L tensor of indices (dtype=torch.long) mask: B x L tensor of booleans Output: pairwise_state: B x L x L x p...
3
1
16
3
10
5
3
0.5
1
2
0
0
2
2
2
12
34
6
20
7
17
10
18
7
15
4
1
1
5
2,457
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldResidueMLP
import torch.nn as nn class EsmFoldResidueMLP(nn.Module): def __init__(self, embed_dim, inner_dim, dropout=0): super().__init__() self.mlp = nn.Sequential(nn.LayerNorm(embed_dim), nn.Linear(embed_dim, inner_dim), nn.ReLU(), nn.Linear(inner_dim, embed_dim), nn.Dropout(dropout)) def forward(sel...
class EsmFoldResidueMLP(nn.Module): def __init__(self, embed_dim, inner_dim, dropout=0): pass def forward(self, x): pass
3
0
6
1
6
0
1
0
1
1
0
0
2
1
2
12
14
2
12
4
9
0
6
4
3
1
1
0
2
2,458
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldSelfAttention
import torch.nn as nn import numpy as np import torch class EsmFoldSelfAttention(nn.Module): def __init__(self, embed_dim, num_heads, head_width, gated=False): super().__init__() assert embed_dim == num_heads * head_width self.embed_dim = embed_dim self.num_heads = num_heads ...
class EsmFoldSelfAttention(nn.Module): def __init__(self, embed_dim, num_heads, head_width, gated=False): pass def forward(self, x, mask=None, bias=None, indices=None): ''' Basic self attention with optional mask and external pairwise bias. To handle sequences of different lengths, ...
3
1
29
7
17
6
3
0.35
1
1
0
0
2
8
2
12
60
15
34
15
31
12
34
15
31
4
1
1
6
2,459
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldSequenceToPair
import torch import torch.nn as nn class EsmFoldSequenceToPair(nn.Module): def __init__(self, sequence_state_dim, inner_dim, pairwise_state_dim): super().__init__() self.layernorm = nn.LayerNorm(sequence_state_dim) self.proj = nn.Linear(sequence_state_dim, inner_dim * 2, bias=True) ...
class EsmFoldSequenceToPair(nn.Module): def __init__(self, sequence_state_dim, inner_dim, pairwise_state_dim): pass def forward(self, sequence_state): ''' Inputs: sequence_state: B x L x sequence_state_dim Output: pairwise_state: B x L x L x pairwise_state_...
3
1
17
5
9
4
1
0.44
1
1
0
0
2
3
2
12
36
10
18
11
15
8
18
11
15
1
1
0
2
2,460
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldStructureModule
from torch.nn import LayerNorm import torch.nn as nn import torch import sys from .openfold_utils import OFProtein, Rigid, Rotation, atom14_to_atom37, chunk_layer, compute_predicted_aligned_error, compute_tm, frames_and_literature_positions_to_atom14_pos, make_atom14_masks, residue_constants, to_pdb, torsion_angles_to_...
class EsmFoldStructureModule(nn.Module): def __init__(self, config): pass def forward(self, evoformer_output_dict, aatype, mask=None, _offload_inference=False): ''' Args: evoformer_output_dict: Dictionary containing: "single": ...
6
1
39
5
27
7
3
0.26
1
9
7
0
5
11
5
15
200
30
136
36
124
35
65
29
59
5
1
1
13
2,461
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldStructureModuleTransition
import torch.nn as nn from torch.nn import LayerNorm class EsmFoldStructureModuleTransition(nn.Module): def __init__(self, config): super().__init__() self.config = config self.layers = nn.ModuleList() for _ in range(config.num_transition_layers): l = EsmFoldStructureMo...
class EsmFoldStructureModuleTransition(nn.Module): def __init__(self, config): pass def forward(self, s): pass
3
0
10
2
8
0
2
0
1
3
1
0
2
4
2
12
21
5
16
10
13
0
16
10
13
2
1
1
4
2,462
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldStructureModuleTransitionLayer
import torch.nn as nn class EsmFoldStructureModuleTransitionLayer(nn.Module): def __init__(self, config): super().__init__() self.linear_1 = EsmFoldLinear(config.sequence_dim, config.sequence_dim, init='relu') self.linear_2 = EsmFoldLinear(config.sequence_dim, config.sequence_dim, init='re...
class EsmFoldStructureModuleTransitionLayer(nn.Module): def __init__(self, config): pass def forward(self, s): pass
3
0
10
2
8
0
1
0
1
2
1
0
2
4
2
12
21
5
16
8
13
0
16
8
13
1
1
0
2
2,463
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldTriangleAttention
import torch import torch.nn as nn from typing import Callable, Optional, Union from torch.nn import LayerNorm from functools import partial from .openfold_utils import OFProtein, Rigid, Rotation, atom14_to_atom37, chunk_layer, compute_predicted_aligned_error, compute_tm, frames_and_literature_positions_to_atom14_pos, ...
class EsmFoldTriangleAttention(nn.Module): def __init__(self, c_in, c_hidden, no_heads, starting=True, inf=1000000000.0): ''' Args: c_in: Input channel dimension c_hidden: Overall hidden channel dimension (not per-head) no_heads: ...
5
3
35
5
23
7
3
0.31
1
7
2
0
3
8
3
13
108
16
70
33
49
22
31
16
27
5
1
1
8
2,464
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldTriangleMultiplicativeUpdate
import torch from typing import Callable, Optional, Union import torch.nn as nn from torch.nn import LayerNorm class EsmFoldTriangleMultiplicativeUpdate(nn.Module): """ Implements Algorithms 11 and 12. """ def __init__(self, config, _outgoing=True): super().__init__() c_hidden = config...
class EsmFoldTriangleMultiplicativeUpdate(nn.Module): ''' Implements Algorithms 11 and 12. ''' def __init__(self, config, _outgoing=True): pass def _combine_projections(self, a: torch.Tensor, b: torch.Tensor, _inplace_chunk_size: Optional[int]=None) -> torch.Tensor: pass def ...
10
3
44
6
29
9
3
0.37
1
10
1
0
4
10
4
14
327
45
206
88
181
77
168
72
158
10
1
4
30
2,465
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldTriangularSelfAttentionBlock
import torch.nn as nn class EsmFoldTriangularSelfAttentionBlock(nn.Module): def __init__(self, config): super().__init__() self.config = config sequence_state_dim = config.sequence_state_dim pairwise_state_dim = config.pairwise_state_dim sequence_num_heads = sequence_state_...
class EsmFoldTriangularSelfAttentionBlock(nn.Module): def __init__(self, config): pass def forward(self, sequence_state, pairwise_state, mask=None, chunk_size=None, **__kwargs): ''' Inputs: sequence_state: B x L x sequence_state_dim pairwise_state: B x L x L x pairwise_state...
3
1
50
8
36
6
5
0.16
1
9
7
0
2
14
2
12
102
17
73
27
70
12
51
27
48
9
1
1
10
2,466
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmFoldingTrunk
from ...utils import ContextManagers, auto_docstring, is_scipy_available, logging import torch import torch.nn as nn class EsmFoldingTrunk(nn.Module): def __init__(self, config): super().__init__() self.config = config c_s = config.sequence_state_dim c_z = config.pairwise_state_dim...
class EsmFoldingTrunk(nn.Module): def __init__(self, config): pass def set_chunk_size(self, chunk_size): pass def forward(self, seq_feats, pair_feats, true_aa, residx, mask, no_recycles): ''' Inputs: seq_feats: B x L x C tensor of sequence features pair_feats: B...
7
1
23
4
16
4
2
0.23
1
6
3
0
3
11
4
14
115
21
78
39
71
18
62
38
56
5
1
2
10
2,467
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmForProteinFolding
from typing import Callable, Optional, Union from .modeling_esm import EsmModel, EsmPreTrainedModel from torch.nn import LayerNorm import torch.nn as nn import torch from ...utils import ContextManagers, auto_docstring, is_scipy_available, logging from .openfold_utils import OFProtein, Rigid, Rotation, atom14_to_atom37...
@auto_docstring(custom_intro='\n ESMForProteinFolding is the HuggingFace port of the original ESMFold model. It consists of an ESM-2 "stem" followed\n by a protein folding "head", although unlike most other output heads, this "head" is similar in size and runtime to\n the rest of the model combined! It outputs...
16
4
29
4
21
4
3
0.2
1
9
3
0
8
24
10
11
303
46
218
97
191
43
146
82
135
8
2
1
25
2,468
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/modeling_esmfold.py
transformers.models.esm.modeling_esmfold.EsmForProteinFoldingOutput
from typing import Callable, Optional, Union import torch.nn as nn from dataclasses import dataclass import torch from ...utils import ContextManagers, auto_docstring, is_scipy_available, logging from ...modeling_outputs import ModelOutput @dataclass @auto_docstring(custom_intro='\n Output type of [`EsmForProteinFo...
@dataclass @auto_docstring(custom_intro='\n Output type of [`EsmForProteinFoldingOutput`].\n ') class EsmForProteinFoldingOutput(ModelOutput): ''' frames (`torch.FloatTensor`): Output frames. sidechain_frames (`torch.FloatTensor`): Output sidechain frames. unnormalized_angles (`tor...
3
1
0
0
0
0
0
2.17
1
0
0
0
0
0
0
0
78
2
24
24
23
52
24
24
23
0
1
0
0
2,469
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/openfold_utils/chunk_utils.py
transformers.models.esm.openfold_utils.chunk_utils.ChunkSizeTuner
from .tensor_utils import tensor_tree_map, tree_map from typing import Any, Callable, Optional, Union import math import torch from collections.abc import Iterable, Sequence import logging class ChunkSizeTuner: def __init__(self, max_chunk_size: int=512): self.max_chunk_size = max_chunk_size self....
class ChunkSizeTuner: def __init__(self, max_chunk_size: int=512): pass def _determine_favorable_chunk_size(self, fn: Callable, args: tuple, min_chunk_size: int) -> int: pass def test_chunk_size(chunk_size: int) -> bool: pass def _compare_arg_caches(self, ac1: It...
6
0
17
2
15
1
3
0.06
0
11
0
0
4
3
4
4
84
12
68
27
54
4
52
19
46
4
0
2
14
2,470
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/openfold_utils/protein.py
transformers.models.esm.openfold_utils.protein.Protein
import numpy as np import dataclasses from collections.abc import Iterator, Mapping, Sequence from typing import Any, Optional @dataclasses.dataclass(frozen=True) class Protein: """Protein structure representation.""" atom_positions: np.ndarray aatype: np.ndarray atom_mask: np.ndarray residue_index...
@dataclasses.dataclass(frozen=True) class Protein: '''Protein structure representation.''' pass
2
1
0
0
0
0
0
2.1
0
0
0
0
0
0
0
0
35
9
10
5
9
21
10
5
9
0
0
0
0
2,471
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/openfold_utils/rigid_utils.py
transformers.models.esm.openfold_utils.rigid_utils.Rigid
from typing import Any, Callable import torch from collections.abc import Sequence class Rigid: """ A class representing a rigid transformation. Little more than a wrapper around two objects: a Rotation object and a [*, 3] translation Designed to behave approximately like a single torch tensor with the sha...
class Rigid: ''' A class representing a rigid transformation. Little more than a wrapper around two objects: a Rotation object and a [*, 3] translation Designed to behave approximately like a single torch tensor with the shape of the shared batch dimensions of its component parts. ''' def __in...
37
28
17
2
7
7
1
1
0
16
1
0
22
2
28
28
514
94
210
99
163
210
169
81
140
6
0
1
40
2,472
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/openfold_utils/rigid_utils.py
transformers.models.esm.openfold_utils.rigid_utils.Rotation
import torch from collections.abc import Sequence from typing import Any, Callable class Rotation: """ A 3D rotation. Depending on how the object is initialized, the rotation is represented by either a rotation matrix or a quaternion, though both formats are made available by helper functions. To simplify ...
class Rotation: ''' A 3D rotation. Depending on how the object is initialized, the rotation is represented by either a rotation matrix or a quaternion, though both formats are made available by helper functions. To simplify gradient computation, the underlying format of the rotation cannot be changed i...
31
25
18
1
9
8
3
0.93
0
12
0
0
22
2
24
24
475
62
214
66
172
199
138
49
113
6
0
1
67
2,473
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/esm/tokenization_esm.py
transformers.models.esm.tokenization_esm.EsmTokenizer
from typing import Optional from ...tokenization_utils import PreTrainedTokenizer import os class EsmTokenizer(PreTrainedTokenizer): """ Constructs an ESM tokenizer. """ vocab_files_names = VOCAB_FILES_NAMES model_input_names = ['input_ids', 'attention_mask'] def __init__(self, vocab_file, unk...
class EsmTokenizer(PreTrainedTokenizer): ''' Constructs an ESM tokenizer. ''' def __init__(self, vocab_file, unk_token='<unk>', cls_token='<cls>', pad_token='<pad>', mask_token='<mask>', eos_token='<eos>', **kwargs): pass def _convert_id_to_token(self, index: int) -> str: pass ...
13
2
8
0
6
2
2
0.27
1
7
0
0
11
4
11
100
110
17
75
38
49
20
49
23
37
5
3
2
19
2,474
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/configuration_falcon.py
transformers.models.falcon.configuration_falcon.FalconConfig
from ...configuration_utils import PretrainedConfig class FalconConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`FalconModel`]. It is used to instantiate a Falcon model according to the specified arguments, defining the model architecture. Instantiating a conf...
class FalconConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`FalconModel`]. It is used to instantiate a Falcon model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar...
6
1
20
0
20
1
2
1.7
1
1
0
0
3
23
3
3
185
13
64
58
32
109
35
30
31
4
1
1
6
2,475
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconAttention
from typing import Optional, Union from torch import nn from torch.nn import functional as F from .configuration_falcon import FalconConfig import torch import math from ...cache_utils import Cache, DynamicCache, StaticCache class FalconAttention(nn.Module): def __init__(self, config: FalconConfig, layer_idx=None...
class FalconAttention(nn.Module): def __init__(self, config: FalconConfig, layer_idx=None): pass def _split_heads(self, fused_qkv: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: ''' Split the last dimension into (num_heads, head_dim), results share same memory stora...
5
2
58
9
40
11
7
0.27
1
8
4
1
4
20
4
14
238
37
160
61
143
43
118
49
113
17
1
3
28
2,476
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconDecoderLayer
import torch from .configuration_falcon import FalconConfig from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss from ...modeling_layers import GradientCheckpointingLayer from ...cache_utils import Cache, DynamicCache, StaticCache from typing import Optional, Union class FalconDecoderLayer(Grad...
class FalconDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: FalconConfig, layer_idx=None): pass def forward(self, hidden_states: torch.Tensor, alibi: Optional[torch.Tensor], attention_mask: torch.Tensor, position_ids: Optional[torch.LongTensor]=None, layer_past: Optional[Union[Ca...
3
0
47
7
38
3
6
0.08
1
6
3
0
2
9
2
12
96
15
77
34
61
6
42
21
39
7
1
2
11
2,477
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconFlashAttention2
import torch from ...cache_utils import Cache, DynamicCache, StaticCache from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available from typing import Optional, Union class FalconFlashAttention2(FalconAttention): """ Falcon flash attention module. This module inher...
class FalconFlashAttention2(FalconAttention): ''' Falcon flash attention module. This module inherits from `FalconAttention` 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 wi...
3
1
47
8
35
6
6
0.24
1
5
1
0
2
2
2
16
102
17
70
28
55
17
42
15
39
11
2
2
12
2,478
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconForCausalLM
import torch from ...utils import auto_docstring, logging from typing import Optional, Union from .configuration_falcon import FalconConfig from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierO...
@auto_docstring(custom_intro='\n The Falcon Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).\n ') class FalconForCausalLM(FalconPreTrainedModel, GenerationMixin): def __init__(self, config: FalconConfig): pass def set_output_embeddi...
6
1
21
2
15
4
2
0.24
2
10
4
0
5
2
5
8
119
15
84
37
53
20
28
17
22
6
2
1
10
2,479
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconForQuestionAnswering
from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss from typing import Optiona...
@auto_docstring class FalconForQuestionAnswering(FalconPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, inputs_embeds: Optio...
5
1
38
4
28
7
4
0.23
1
4
2
0
2
2
2
5
79
9
57
27
42
13
31
15
28
7
2
2
8
2,480
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconForSequenceClassification
from typing import Optional, Union from .configuration_falcon import FalconConfig from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOut...
null
5
1
51
5
42
4
9
0.09
1
8
3
0
2
3
2
5
109
11
90
30
69
8
45
17
42
16
2
3
17
2,481
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconForTokenClassification
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss from torch import nn from ...utils import auto_docstring, logging from .configuration_falcon import FalconConfig from typing import Optional, Union import torch from ...cache_utils import Cache, DynamicCache, StaticCache from ...modeling_outpu...
@auto_docstring class FalconForTokenClassification(FalconPreTrainedModel): def __init__(self, config: FalconConfig): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, attention_mask: Optional[torch.Tensor]=None, head_mask: Opti...
5
1
36
4
29
4
4
0.11
1
6
3
0
2
4
2
5
80
9
64
28
43
7
27
15
24
5
2
1
8
2,482
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconLinear
from torch import nn import torch class FalconLinear(nn.Linear): def forward(self, input: torch.Tensor) -> torch.Tensor: hidden_states = input @ self.weight.T if self.bias is None: return hidden_states return hidden_states + self.bias
class FalconLinear(nn.Linear): def forward(self, input: torch.Tensor) -> torch.Tensor: pass
2
0
5
0
5
0
2
0
1
1
0
0
1
0
1
1
6
0
6
3
4
0
6
3
4
2
1
1
2
2,483
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconMLP
from ...activations import get_activation from torch import nn import torch from .configuration_falcon import FalconConfig class FalconMLP(nn.Module): def __init__(self, config: FalconConfig): super().__init__() hidden_size = config.hidden_size self.dense_h_to_4h = FalconLinear(hidden_size...
class FalconMLP(nn.Module): def __init__(self, config: FalconConfig): pass def forward(self, x: torch.Tensor) -> torch.Tensor: pass
3
0
6
1
6
0
1
0
1
4
2
0
2
4
2
12
14
2
12
8
9
0
12
8
9
1
1
0
2
2,484
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconModel
import math from .configuration_falcon import FalconConfig import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss from ...modeling_attn_mask_utils import AttentionMaskConverter from ...utils import auto_docstring, logging from torch import nn from ...modeling_outputs import BaseModelO...
@auto_docstring class FalconModel(FalconPreTrainedModel): def __init__(self, config: FalconConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings: torch.Tensor): pass @auto_docstring def forward(self, input_ids: Optional[torch.Long...
10
2
53
6
39
8
8
0.21
1
16
8
0
5
10
6
9
330
42
240
75
195
50
114
42
107
28
2
2
45
2,485
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconPreTrainedModel
from torch import nn from ...utils import auto_docstring, logging from .configuration_falcon import FalconConfig from ...modeling_utils import PreTrainedModel from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss @auto_docstring class FalconPreTrainedModel(PreTrainedModel): config: FalconCon...
@auto_docstring class FalconPreTrainedModel(PreTrainedModel): def __init__(self, *inputs, **kwargs): pass def _init_weights(self, module: nn.Module): '''Initialize the weights.''' pass @classmethod def _check_and_enable_sdpa(cls, config, hard_check_only: bool=False): pa...
6
1
8
0
7
1
3
0.25
1
3
1
5
2
0
3
3
45
5
32
15
27
8
29
14
25
6
1
2
10
2,486
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon/modeling_falcon.py
transformers.models.falcon.modeling_falcon.FalconRotaryEmbedding
from .configuration_falcon import FalconConfig from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update import torch from torch import nn class FalconRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: FalconConfig, device=None): super().__init__() ...
class FalconRotaryEmbedding(nn.Module): def __init__(self, config: FalconConfig, 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,487
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/configuration_falcon_mamba.py
transformers.models.falcon_mamba.configuration_falcon_mamba.FalconMambaConfig
import math from ...configuration_utils import PretrainedConfig class FalconMambaConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`FalconMambaModel`]. It is used to instantiate a FALCON_MAMBA model according to the specified arguments, defining the model archit...
class FalconMambaConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`FalconMambaModel`]. It is used to instantiate a FALCON_MAMBA model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will...
2
1
57
1
56
0
2
1.14
1
2
0
0
1
26
1
1
134
10
58
57
28
66
30
29
28
2
1
0
2
2,488
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaBlock
from typing import Any, Optional, Union import torch from ...modeling_layers import GradientCheckpointingLayer class FalconMambaBlock(GradientCheckpointingLayer): def __init__(self, config, layer_idx): super().__init__() self.config = config self.layer_idx = layer_idx self.residual...
class FalconMambaBlock(GradientCheckpointingLayer): def __init__(self, config, layer_idx): pass def forward(self, hidden_states, cache_params: Optional[FalconMambaCache]=None, cache_position: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.LongTensor]=None): pass
3
0
12
1
12
0
2
0
1
4
3
0
2
5
2
12
26
2
24
15
15
0
16
9
13
2
1
1
3
2,489
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaForCausalLM
from ...utils import ModelOutput, auto_docstring, logging from typing import Any, Optional, Union from ...generation import GenerationMixin from torch import nn from torch.nn import CrossEntropyLoss import torch @auto_docstring(custom_intro='\n The FALCON_MAMBA Model transformer with a language modeling head on top...
@auto_docstring(custom_intro='\n The FALCON_MAMBA Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ') class FalconMambaForCausalLM(FalconMambaPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_input_e...
9
1
17
2
13
2
2
0.15
2
10
3
0
8
2
8
9
151
20
115
46
77
17
53
22
44
6
2
3
19
2,490
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaMixer
from .configuration_falcon_mamba import FalconMambaConfig from ...activations import ACT2FN import torch from typing import Any, Optional, Union from torch import nn from ...utils.import_utils import is_causal_conv1d_available, is_kernels_available, is_mamba_ssm_available, is_mambapy_available class FalconMambaMixer(n...
class FalconMambaMixer(nn.Module): ''' Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`. A, D are input independent (see FalconMamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective) ∆, B, C are input-dependent (this is a key difference...
6
1
73
7
60
11
7
0.21
1
7
2
0
4
22
4
14
305
32
242
76
219
51
122
56
117
12
1
3
27
2,491
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaModel
import torch from typing import Any, Optional, Union from torch import nn from ...utils import ModelOutput, auto_docstring, logging @auto_docstring class FalconMambaModel(FalconMambaPreTrainedModel): def __init__(self, config): super().__init__(config) self.embeddings = nn.Embedding(config.vocab_s...
@auto_docstring class FalconMambaModel(FalconMambaPreTrainedModel): 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.LongTensor]=None, inpu...
7
1
23
3
19
1
5
0.06
1
9
4
0
4
5
4
5
100
14
82
24
61
5
42
12
37
18
2
2
21
2,492
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaOutput
from ...utils import ModelOutput, auto_docstring, logging import torch from typing import Any, Optional, Union from dataclasses import dataclass @dataclass @auto_docstring(custom_intro='\n Class for the FALCON_MAMBA model outputs.\n ') class FalconMambaOutput(ModelOutput): """ cache_params (`FalconMambaC...
@dataclass @auto_docstring(custom_intro='\n Class for the FALCON_MAMBA model outputs.\n ') class FalconMambaOutput(ModelOutput): ''' cache_params (`FalconMambaCache`): The state of the model at the last time step. Can be used in a forward method with the next `input_ids` to avoid providing...
3
1
0
0
0
0
0
3.5
1
0
0
0
0
0
0
0
22
4
4
4
3
14
4
4
3
0
1
0
0
2,493
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaPreTrainedModel
import torch from torch import nn from .configuration_falcon_mamba import FalconMambaConfig from ...utils import ModelOutput, auto_docstring, logging from ...modeling_utils import PreTrainedModel import math @auto_docstring class FalconMambaPreTrainedModel(PreTrainedModel): config: FalconMambaConfig base_model...
@auto_docstring class FalconMambaPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights.''' pass
3
1
46
4
30
12
11
0.44
1
1
1
2
1
0
1
1
58
6
36
11
34
16
30
11
28
11
1
4
11
2,494
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaRMSNorm
import torch from torch import nn class FalconMambaRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ FalconMambaRMSNorm is equivalent to T5LayerNorm and LlamaRMSNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.va...
class FalconMambaRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' FalconMambaRMSNorm is equivalent to T5LayerNorm and LlamaRMSNorm ''' pass def forward(self, hidden_states): pass def extra_repr(self): pass
4
1
4
0
3
1
1
0.36
1
1
0
0
3
2
3
13
17
2
11
6
7
4
9
6
5
1
1
0
3
2,495
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py
transformers.models.fastspeech2_conformer.configuration_fastspeech2_conformer.FastSpeech2ConformerConfig
from ...configuration_utils import PretrainedConfig class FastSpeech2ConformerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`FastSpeech2ConformerModel`]. It is used to instantiate a FastSpeech2Conformer model according to the specified arguments, defining th...
class FastSpeech2ConformerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`FastSpeech2ConformerModel`]. It is used to instantiate a FastSpeech2Conformer model according to the specified arguments, defining the model architecture. Instantiating a configurat...
2
1
156
2
154
0
12
0.83
1
2
0
0
1
41
1
1
300
11
158
104
98
131
69
46
67
12
1
1
12
2,496
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py
transformers.models.fastspeech2_conformer.configuration_fastspeech2_conformer.FastSpeech2ConformerHifiGanConfig
from ...configuration_utils import PretrainedConfig class FastSpeech2ConformerHifiGanConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`FastSpeech2ConformerHifiGanModel`]. It is used to instantiate a FastSpeech2Conformer HiFi-GAN vocoder model according to the s...
class FastSpeech2ConformerHifiGanConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`FastSpeech2ConformerHifiGanModel`]. It is used to instantiate a FastSpeech2Conformer HiFi-GAN vocoder model according to the specified arguments, defining the model architect...
2
1
23
0
23
0
1
1.65
1
1
0
0
1
9
1
1
78
9
26
25
12
43
14
13
12
1
1
0
1
2,497
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py
transformers.models.fastspeech2_conformer.configuration_fastspeech2_conformer.FastSpeech2ConformerWithHifiGanConfig
from ...configuration_utils import PretrainedConfig from typing import Optional class FastSpeech2ConformerWithHifiGanConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`FastSpeech2ConformerWithHifiGan`]. It is used to instantiate a `FastSpeech2ConformerWithHifiGa...
class FastSpeech2ConformerWithHifiGanConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`FastSpeech2ConformerWithHifiGan`]. It is used to instantiate a `FastSpeech2ConformerWithHifiGanModel` model according to the specified sub-models configurations, defining...
2
1
18
3
15
0
3
2.11
1
3
2
0
1
2
1
1
70
14
18
11
11
38
13
6
11
3
1
1
3
2,498
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py
transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerAttention
import torch import math from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig from typing import Optional, Union from torch import nn class FastSpeech2ConformerAttention(nn.Module): """ Multi-Head attention layer w...
class FastSpeech2ConformerAttention(nn.Module): ''' Multi-Head attention layer with relative position encoding. Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://huggingface.co/papers/1901.02860. ''' def __init__(self, config: FastSpeech2ConformerConfig, module_con...
4
4
34
5
19
11
2
0.63
1
5
1
0
3
12
3
13
110
17
57
39
47
36
50
33
46
4
1
2
6
2,499
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py
transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerBatchNormConvLayer
from torch import nn class FastSpeech2ConformerBatchNormConvLayer(nn.Module): def __init__(self, config, layer_id=0): super().__init__() if layer_id == 0: in_conv_dim = config.num_mel_bins else: in_conv_dim = config.speech_decoder_postnet_units if layer_id =...
class FastSpeech2ConformerBatchNormConvLayer(nn.Module): def __init__(self, config, layer_id=0): pass def forward(self, hidden_states): pass
3
0
18
3
16
0
3
0
1
1
0
0
2
4
2
12
38
6
32
9
29
0
22
9
19
4
1
1
6