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
1,900
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertForSequenceClassification
from typing import Optional, Union from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, is_pytorch_quantization_available, logging, replace_return_docstrings, requires_backends from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ....modeling_o...
@add_start_docstrings('\n Bert 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 ', QDQBERT_START_DOCSTRING) class QDQBertForSequenceClassification(QDQBertPreTrainedModel): def __init__(self, config): pass ...
6
1
40
4
33
4
7
0.1
1
5
2
0
2
5
2
132
88
8
73
27
52
7
35
14
32
12
3
3
13
1,901
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertForTokenClassification
from torch import nn from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifie...
@add_start_docstrings('\n QDQBERT Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for\n Named-Entity-Recognition (NER) tasks.\n ', QDQBERT_START_DOCSTRING) class QDQBertForTokenClassification(QDQBertPreTrainedModel): def __init__(self, config): ...
6
1
31
4
24
3
3
0.09
1
4
2
0
2
4
2
132
69
9
55
26
34
5
22
13
19
5
3
1
6
1,902
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertIntermediate
from torch import nn from ....activations import ACT2FN class QDQBertIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = quant_nn.QuantLinear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.intermediate_...
class QDQBertIntermediate(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
6
0
6
1
2
0.08
1
2
0
0
2
2
2
12
14
1
12
5
9
1
11
5
8
2
1
1
3
1,903
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertLMHeadModel
import torch from typing import Optional, Union from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, is_pytorch_quantization_available, logging, replace_return_docstrings, requires_backends from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ....
@add_start_docstrings('QDQBERT Model with a `language modeling` head on top for CLM fine-tuning.', QDQBERT_START_DOCSTRING) class QDQBertLMHeadModel(QDQBertPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddin...
10
1
25
3
15
7
3
0.42
1
7
3
0
6
2
6
136
161
26
95
45
64
40
47
22
40
6
3
2
16
1,904
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertLMPredictionHead
from torch import nn import torch class QDQBertLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = QDQBertPredictionHeadTransform(config) self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.bias = nn.Parameter(to...
class QDQBertLMPredictionHead(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
1,905
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertLayer
from ....utils.deprecation import deprecate_kwarg from ....modeling_layers import GradientCheckpointingLayer class QDQBertLayer(GradientCheckpointingLayer): def __init__(self, config): super().__init__() self.seq_len_dim = 1 self.attention = QDQBertAttention(config) self.is_decoder...
class QDQBertLayer(GradientCheckpointingLayer): def __init__(self, config): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, past_key_va...
5
0
26
2
22
2
4
0.1
1
5
3
0
3
7
3
13
81
9
67
31
54
7
40
22
36
7
1
2
11
1,906
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertModel
from typing import Optional, Union from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, is_pytorch_quantization_available, logging, replace_return_docstrings, requires_backends from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModel...
@add_start_docstrings('The bare QDQBERT Model transformer outputting raw hidden-states without any specific head on top.', QDQBERT_START_DOCSTRING) class QDQBertModel(QDQBertPreTrainedModel): ''' The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of cro...
9
3
31
3
21
7
5
0.38
1
9
4
0
5
4
5
135
176
24
110
41
83
42
57
25
51
18
3
2
24
1,907
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertOnlyMLMHead
from torch import nn class QDQBertOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = QDQBertLMPredictionHead(config) def forward(self, sequence_output): prediction_scores = self.predictions(sequence_output) return prediction_scores
class QDQBertOnlyMLMHead(nn.Module): def __init__(self, config): pass def forward(self, sequence_output): pass
3
0
3
0
3
0
1
0
1
2
1
0
2
1
2
12
8
1
7
5
4
0
7
5
4
1
1
0
2
1,908
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertOnlyNSPHead
from torch import nn class QDQBertOnlyNSPHead(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_relation...
class QDQBertOnlyNSPHead(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
1,909
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertOutput
from torch import nn class QDQBertOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = quant_nn.QuantLinear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropout...
class QDQBertOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, input_tensor): pass
3
0
9
1
7
2
1
0.2
1
1
0
0
2
5
2
12
20
2
15
10
12
3
15
10
12
1
1
0
2
1,910
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertPooler
from torch import nn import torch class QDQBertPooler(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_tok...
class QDQBertPooler(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
1,911
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertPreTrainedModel
from torch import nn from ....modeling_utils import PreTrainedModel from .configuration_qdqbert import QDQBertConfig class QDQBertPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ config...
class QDQBertPreTrainedModel(PreTrainedModel): ''' 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
15
0
12
3
6
0.41
1
0
0
8
1
0
1
130
26
2
17
6
15
7
15
6
13
6
2
2
6
1,912
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertPreTrainingHeads
from torch import nn class QDQBertPreTrainingHeads(nn.Module): def __init__(self, config): super().__init__() self.predictions = QDQBertLMPredictionHead(config) self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, sequence_output, pooled_output): predicti...
class QDQBertPreTrainingHeads(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
1,913
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertPredictionHeadTransform
from ....activations import ACT2FN from torch import nn import torch class QDQBertPredictionHeadTransform(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.transf...
class QDQBertPredictionHeadTransform(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
1,914
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertSelfAttention
from ....utils.deprecation import deprecate_kwarg import math import torch from torch import nn class QDQBertSelfAttention(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')): rai...
class QDQBertSelfAttention(nn.Module): def __init__(self, config): pass def transpose_for_scores(self, x): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=No...
5
0
43
7
31
6
5
0.19
1
3
0
0
3
15
3
13
132
22
93
47
80
18
73
38
69
12
1
2
16
1,915
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/qdqbert/modeling_qdqbert.py
transformers.models.deprecated.qdqbert.modeling_qdqbert.QDQBertSelfOutput
from torch import nn class QDQBertSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = quant_nn.QuantLinear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropout(c...
class QDQBertSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, input_tensor): pass
3
0
10
1
7
2
1
0.2
1
1
0
0
2
5
2
12
21
3
15
10
12
3
15
10
12
1
1
0
2
1,916
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/configuration_realm.py
transformers.models.deprecated.realm.configuration_realm.RealmConfig
from ....configuration_utils import PretrainedConfig class RealmConfig(PretrainedConfig): """ This is the configuration class to store the configuration of 1. [`RealmEmbedder`] 2. [`RealmScorer`] 3. [`RealmKnowledgeAugEncoder`] 4. [`RealmRetriever`] 5. [`RealmReader`] 6. [`RealmForOpen...
class RealmConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of 1. [`RealmEmbedder`] 2. [`RealmScorer`] 3. [`RealmKnowledgeAugEncoder`] 4. [`RealmRetriever`] 5. [`RealmReader`] 6. [`RealmForOpenQA`] It is used to instantiate an REALM model acco...
2
1
56
3
50
4
1
1.48
1
1
0
0
1
21
1
33
143
15
52
51
23
77
25
24
23
1
2
0
1
1,917
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmAttention
from ....cache_utils import Cache from typing import Optional, Union from ....utils.deprecation import deprecate_kwarg from torch import nn import torch from ....pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer class RealmAttention(nn.Module): def __init__(self,...
class RealmAttention(nn.Module): def __init__(self, config, position_embedding_type=None): pass def prune_heads(self, heads): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[tor...
5
0
15
1
14
1
1
0.07
1
5
1
0
3
3
3
13
49
4
43
20
30
3
22
11
18
2
1
1
4
1,918
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmBertModel
from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput import torch class RealmBertModel(RealmPreTrainedModel): """ Same as the original BertModel but remove docstrings. """ def __init__(self, config, add_po...
class RealmBertModel(RealmPreTrainedModel): ''' Same as the original BertModel but remove docstrings. ''' def __init__(self, config, add_pooling_layer=True): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def _prune_heads(se...
6
2
26
3
20
3
5
0.19
1
7
4
0
5
4
5
136
141
20
102
40
81
19
55
25
49
18
3
2
24
1,919
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmEmbedder
import torch from typing import Optional, Union from ....utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings @add_start_docstrings('The embedder of REALM outputting projected score that will be used to calculate relevance score.', REALM_START_DOCSTRING) class Re...
@add_start_docstrings('The embedder of REALM outputting projected score that will be used to calculate relevance score.', REALM_START_DOCSTRING) class RealmEmbedder(RealmPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, ...
8
1
17
3
11
4
2
0.32
1
5
3
0
4
2
4
135
76
14
47
23
29
15
19
11
14
3
3
1
6
1,920
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmEmbedderOutput
from dataclasses import dataclass import torch from typing import Optional, Union from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput @dataclass class RealmEmbedderOutput(ModelOutput): """ Outputs of [`RealmEmbedd...
@dataclass class RealmEmbedderOutput(ModelOutput): ''' Outputs of [`RealmEmbedder`] models. Args: projected_score (`torch.FloatTensor` of shape `(batch_size, config.retriever_proj_size)`): Projected score. hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `outp...
2
1
0
0
0
0
0
3.75
1
0
0
0
0
0
0
0
24
5
4
4
3
15
4
4
3
0
1
0
0
1,921
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmEmbeddings
from typing import Optional, Union import torch from torch import nn class RealmEmbeddings(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidd...
class RealmEmbeddings(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.LongTensor]=...
3
1
29
3
23
3
4
0.15
1
3
0
0
2
6
2
12
62
8
47
23
37
7
34
16
31
7
1
2
8
1,922
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmEncoder
from ....cache_utils import Cache from typing import Optional, Union from torch import nn from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput import torch class RealmEncoder(nn.Module): def __init__(self, config): ...
class RealmEncoder(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
1,923
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmForOpenQA
import torch from typing import Optional, Union from ....utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings @add_start_docstrings('`RealmForOpenQA` for end-to-end open domain question answering.', REALM_START_DOCSTRING) class RealmForOpenQA(RealmPreTrainedModel...
@add_start_docstrings('`RealmForOpenQA` for end-to-end open domain question answering.', REALM_START_DOCSTRING) class RealmForOpenQA(RealmPreTrainedModel): def __init__(self, config, retriever=None): pass @property def searcher_beam_size(self): pass def block_embedding_to(self, device)...
9
2
32
5
18
9
2
0.47
1
6
3
0
4
4
4
135
133
23
75
29
60
35
39
20
34
5
3
1
9
1,924
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmForOpenQAOutput
from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput from dataclasses import dataclass import torch from typing import Optional, Union @dataclass class RealmForOpenQAOutput(ModelOutput): """ Outputs of [`RealmForO...
@dataclass class RealmForOpenQAOutput(ModelOutput): ''' Outputs of [`RealmForOpenQA`] models. Args: reader_output (`dict`): Reader output. predicted_answer_ids (`torch.LongTensor` of shape `(answer_sequence_length)`): Predicted answer ids. ''' pass
2
1
0
0
0
0
0
2.67
1
0
0
0
0
0
0
0
14
3
3
3
2
8
3
3
2
0
1
0
0
1,925
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmIntermediate
import torch from torch import nn from ....activations import ACT2FN class RealmIntermediate(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 RealmIntermediate(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
1,926
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmKnowledgeAugEncoder
from ....utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput import torch from typing import Optional, Union from...
@add_start_docstrings('The knowledge-augmented encoder of REALM outputting masked language model logits and marginal log-likelihood loss.', REALM_START_DOCSTRING) class RealmKnowledgeAugEncoder(RealmPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass de...
10
1
23
3
13
7
2
0.48
1
6
3
0
6
2
6
137
147
25
83
42
58
40
43
25
36
7
3
2
12
1,927
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmLMPredictionHead
import torch from torch import nn class RealmLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = RealmPredictionHeadTransform(config) self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.bias = nn.Parameter(torch....
class RealmLMPredictionHead(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
1,928
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmLayer
from typing import Optional, Union from ....cache_utils import Cache from ....pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from ....modeling_layers import GradientCheckpointingLayer import torch from ....utils.deprecation import deprecate_kwarg class RealmLayer(G...
class RealmLayer(GradientCheckpointingLayer): def __init__(self, config): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None...
5
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
1,929
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmOnlyMLMHead
from torch import nn class RealmOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = RealmLMPredictionHead(config) def forward(self, sequence_output): prediction_scores = self.predictions(sequence_output) return prediction_scores
class RealmOnlyMLMHead(nn.Module): def __init__(self, config): pass def forward(self, sequence_output): pass
3
0
3
0
3
0
1
0
1
2
1
0
2
1
2
12
8
1
7
5
4
0
7
5
4
1
1
0
2
1,930
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmOutput
import torch from torch import nn class RealmOutput(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.Dropout...
class RealmOutput(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
1,931
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmPooler
import torch from torch import nn class RealmPooler(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...
class RealmPooler(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
1,932
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmPreTrainedModel
from torch import nn from ....modeling_utils import PreTrainedModel from .configuration_realm import RealmConfig class RealmPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ config: Real...
class RealmPreTrainedModel(PreTrainedModel): ''' 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 def _flatten_inputs(self, *inputs): ...
3
3
14
0
12
2
5
0.3
1
0
0
6
2
0
2
131
38
3
27
9
24
8
24
9
21
6
2
3
10
1,933
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmPredictionHeadTransform
from ....activations import ACT2FN from torch import nn class RealmPredictionHeadTransform(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.transform_act_fn = AC...
class RealmPredictionHeadTransform(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
7
0
7
0
2
0
1
2
0
0
2
3
2
12
15
1
14
6
11
0
13
6
10
2
1
1
3
1,934
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmReader
from ....utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings import torch from typing import Optional, Union @add_start_docstrings('The reader of REALM.', REALM_START_DOCSTRING) class RealmReader(RealmPreTrainedModel): def __init__(self, config): su...
@add_start_docstrings('The reader of REALM.', REALM_START_DOCSTRING) class RealmReader(RealmPreTrainedModel): def __init__(self, config): pass @add_start_docstrings_to_model_forward(REALM_INPUTS_DOCSTRING.format('reader_beam_size, sequence_length')) @replace_return_docstrings(output_type=RealmReade...
9
3
37
4
25
8
2
0.29
1
7
4
0
2
4
2
133
165
20
112
48
88
33
57
31
51
8
3
1
12
1,935
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmReaderOutput
import torch from typing import Optional, Union from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput from dataclasses import dataclass @dataclass class RealmReaderOutput(ModelOutput): """ Outputs of [`RealmReader`]...
@dataclass class RealmReaderOutput(ModelOutput): ''' Outputs of [`RealmReader`] models. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `start_positions`, `end_positions`, `has_answers` are provided): Total loss. retriever_loss (`torch.FloatTensor` of s...
2
1
0
0
0
0
0
2.58
1
0
0
0
0
0
0
0
47
4
12
12
11
31
12
12
11
0
1
0
0
1,936
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmReaderProjection
import torch from torch import nn class RealmReaderProjection(nn.Module): def __init__(self, config): super().__init__() self.config = config self.dense_intermediate = nn.Linear(config.hidden_size, config.span_hidden_size * 2) self.dense_output = nn.Linear(config.span_hidden_size, ...
class RealmReaderProjection(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, block_mask): pass def span_candidates(masks): ''' Generate span candidates. Args: masks: <bool> [num_retrievals, max_sequence_...
6
1
20
4
11
5
1
0.46
1
3
0
0
2
5
2
12
65
14
35
24
29
16
35
24
29
1
1
0
5
1,937
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmScorer
from ....utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings import torch from typing import Optional, Union @add_start_docstrings('The scorer of REALM outputting relevance scores representing the score of document candidates (before softmax).', REALM_START_DOCS...
@add_start_docstrings('The scorer of REALM outputting relevance scores representing the score of document candidates (before softmax).', REALM_START_DOCSTRING) class RealmScorer(RealmPreTrainedModel): ''' Args: query_embedder ([`RealmEmbedder`]): Embedder for input sequences. If not specifie...
6
2
66
13
30
23
4
0.81
1
5
2
0
2
2
2
133
141
27
63
27
43
51
22
11
19
5
3
1
7
1,938
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmScorerOutput
from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput from typing import Optional, Union import torch from dataclasses import dataclass @dataclass class RealmScorerOutput(ModelOutput): """ Outputs of [`RealmScorer`]...
@dataclass class RealmScorerOutput(ModelOutput): ''' Outputs of [`RealmScorer`] models. Args: relevance_score (`torch.FloatTensor` of shape `(batch_size, config.num_candidates)`): The relevance score of document candidates (before softmax). query_score (`torch.FloatTensor` of sha...
2
1
0
0
0
0
0
2.5
1
0
0
0
0
0
0
0
16
2
4
4
3
10
4
4
3
0
1
0
0
1,939
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmScorerProjection
from torch import nn class RealmScorerProjection(nn.Module): def __init__(self, config): super().__init__() self.predictions = RealmLMPredictionHead(config) self.dense = nn.Linear(config.hidden_size, config.retriever_proj_size) self.LayerNorm = nn.LayerNorm(config.retriever_proj_si...
class RealmScorerProjection(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
5
0
5
0
1
0
1
2
1
0
2
3
2
12
11
1
10
6
7
0
10
6
7
1
1
0
2
1,940
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmSelfAttention
from torch import nn import torch from ....cache_utils import Cache from typing import Optional, Union from ....utils.deprecation import deprecate_kwarg import math class RealmSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None): super().__init__() if config.hidden_si...
class RealmSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None): pass def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: tor...
5
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
1,941
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/modeling_realm.py
transformers.models.deprecated.realm.modeling_realm.RealmSelfOutput
from torch import nn import torch class RealmSelfOutput(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(c...
class RealmSelfOutput(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
1,942
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/retrieval_realm.py
transformers.models.deprecated.realm.retrieval_realm.RealmRetriever
import numpy as np from ....utils import logging, strtobool from huggingface_hub import hf_hub_download from transformers import AutoTokenizer import os from typing import Optional, Union class RealmRetriever: """The retriever of REALM outputting the retrieved evidence block and whether the block has answers as we...
class RealmRetriever: '''The retriever of REALM outputting the retrieved evidence block and whether the block has answers as well as answer positions." Parameters: block_records (`np.ndarray`): A numpy array which contains evidence texts. tokenizer ([`RealmTokeni...
7
2
15
2
12
1
3
0.2
0
6
1
0
4
2
5
5
93
16
64
31
57
13
56
30
50
10
0
5
17
1,943
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/retrieval_realm.py
transformers.models.deprecated.realm.retrieval_realm.ScaNNSearcher
class ScaNNSearcher: """Note that ScaNNSearcher cannot currently be used within the model. In future versions, it might however be included.""" def __init__(self, db, num_neighbors, dimensions_per_block=2, num_leaves=1000, num_leaves_to_search=100, training_sample_size=100000): """Build scann searcher....
class ScaNNSearcher: '''Note that ScaNNSearcher cannot currently be used within the model. In future versions, it might however be included.''' def __init__(self, db, num_neighbors, dimensions_per_block=2, num_leaves=1000, num_leaves_to_search=100, training_sample_size=100000): '''Build scann searcher....
3
2
12
2
10
1
1
0.1
0
0
0
0
2
1
2
2
27
5
20
14
8
2
10
6
6
1
0
0
2
1,944
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/tokenization_realm.py
transformers.models.deprecated.realm.tokenization_realm.BasicTokenizer
import unicodedata from ....tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace class BasicTokenizer: """ Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.). Args: do_lower_case (`bool`, *optional*, defau...
class BasicTokenizer: ''' Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.). Args: do_lower_case (`bool`, *optional*, defaults to `True`): Whether or not to lowercase the input when tokenizing. never_split (`Iterable`, *opti...
8
7
17
1
13
5
4
0.57
0
2
0
0
7
4
7
7
147
14
89
30
81
51
76
30
68
8
0
4
27
1,945
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/tokenization_realm.py
transformers.models.deprecated.realm.tokenization_realm.RealmTokenizer
from typing import Optional from ....tokenization_utils_base import BatchEncoding import os import collections from ....tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace from ....utils import PaddingStrategy, logging class RealmTokenizer(PreTrainedTokenizer): """ Const...
class RealmTokenizer(PreTrainedTokenizer): ''' Construct a REALM tokenizer. [`RealmTokenizer`] is identical to [`BertTokenizer`] and runs end-to-end tokenization: punctuation splitting and wordpiece. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users...
15
7
19
2
11
6
2
0.79
1
11
3
0
13
5
13
102
303
46
144
63
108
114
87
40
73
6
3
3
32
1,946
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/realm/tokenization_realm_fast.py
transformers.models.deprecated.realm.tokenization_realm_fast.RealmTokenizerFast
import json from ....tokenization_utils_fast import PreTrainedTokenizerFast from typing import Optional from ....tokenization_utils_base import BatchEncoding from ....utils import PaddingStrategy, logging from .tokenization_realm import RealmTokenizer from tokenizers import normalizers class RealmTokenizerFast(PreTrai...
class RealmTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" REALM tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece. [`RealmTokenizerFast`] is identical to [`BertTokenizerFast`] and runs end-to-end tokenization: punctuation splitting and wordpiece. This toke...
5
3
33
6
16
11
3
1.12
1
7
2
0
5
1
5
93
217
37
85
40
64
95
49
25
43
6
3
2
13
1,947
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/retribert/configuration_retribert.py
transformers.models.deprecated.retribert.configuration_retribert.RetriBertConfig
from ....configuration_utils import PretrainedConfig class RetriBertConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`RetriBertModel`]. It is used to instantiate a RetriBertModel model according to the specified arguments, defining the model architecture. Insta...
class RetriBertConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`RetriBertModel`]. It is used to instantiate a RetriBertModel model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will y...
2
1
35
1
34
0
1
1.11
1
1
0
0
1
14
1
33
82
6
36
35
16
40
18
17
16
1
2
0
1
1,948
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/retribert/modeling_retribert.py
transformers.models.deprecated.retribert.modeling_retribert.RetriBertModel
from typing import Optional from ...bert.modeling_bert import BertModel from .configuration_retribert import RetriBertConfig from torch import nn import torch.utils.checkpoint as checkpoint import math import torch from ....utils import add_start_docstrings, logging @add_start_docstrings('Bert Based model to embed que...
@add_start_docstrings('Bert Based model to embed queries or document for document retrieval.', RETRIBERT_START_DOCSTRING) class RetriBertModel(RetriBertPreTrainedModel): def __init__(self, config: RetriBertConfig) -> None: pass def embed_sentences_checkpointed(self, input_ids, attention_mask, sent_enc...
8
1
23
2
16
5
2
0.34
1
6
2
0
5
7
5
135
133
14
89
60
59
30
47
37
40
3
3
2
10
1,949
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/retribert/modeling_retribert.py
transformers.models.deprecated.retribert.modeling_retribert.RetriBertPreTrainedModel
from ....modeling_utils import PreTrainedModel from .configuration_retribert import RetriBertConfig from torch import nn class RetriBertPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ ...
class RetriBertPreTrainedModel(PreTrainedModel): ''' 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
13
0
12
1
6
0.31
1
0
0
1
1
0
1
130
23
2
16
5
14
5
14
5
12
6
2
2
6
1,950
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/retribert/tokenization_retribert.py
transformers.models.deprecated.retribert.tokenization_retribert.BasicTokenizer
from ....tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace import unicodedata class BasicTokenizer: """ Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.). Args: do_lower_case (`bool`, *optional*, defau...
class BasicTokenizer: ''' Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.). Args: do_lower_case (`bool`, *optional*, defaults to `True`): Whether or not to lowercase the input when tokenizing. never_split (`Iterable`, *opti...
8
7
19
1
14
5
4
0.55
0
2
0
0
7
5
7
7
159
14
98
39
83
54
78
32
70
8
0
4
27
1,951
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/retribert/tokenization_retribert.py
transformers.models.deprecated.retribert.tokenization_retribert.RetriBertTokenizer
from typing import Optional import collections import os from ....tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace class RetriBertTokenizer(PreTrainedTokenizer): """ Constructs a RetriBERT tokenizer. [`RetriBertTokenizer`] is identical to [`BertTokenizer`] and ru...
class RetriBertTokenizer(PreTrainedTokenizer): ''' Constructs a RetriBERT tokenizer. [`RetriBertTokenizer`] is identical to [`BertTokenizer`] and runs end-to-end tokenization: punctuation splitting and wordpiece. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main m...
14
6
15
1
10
4
2
0.71
1
9
2
0
12
5
12
101
233
29
120
53
85
85
66
30
53
6
3
3
27
1,952
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/retribert/tokenization_retribert_fast.py
transformers.models.deprecated.retribert.tokenization_retribert_fast.RetriBertTokenizerFast
from ....tokenization_utils_fast import PreTrainedTokenizerFast import json from typing import Optional from .tokenization_retribert import RetriBertTokenizer from tokenizers import normalizers class RetriBertTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" RetriBERT tokenizer (backed by HuggingF...
class RetriBertTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" RetriBERT tokenizer (backed by HuggingFace's *tokenizers* library). [`RetriBertTokenizerFast`] is identical to [`BertTokenizerFast`] and runs end-to-end tokenization: punctuation splitting and wordpiece. This tokenizer in...
4
2
24
3
14
7
2
1.14
1
4
0
0
4
1
4
92
145
19
59
30
39
67
28
15
23
2
3
1
7
1,953
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/configuration_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.configuration_speech_to_text_2.Speech2Text2Config
from ....configuration_utils import PretrainedConfig class Speech2Text2Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`Speech2Text2ForCausalLM`]. It is used to instantiate an Speech2Text2 model according to the specified arguments, defining the model architec...
class Speech2Text2Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`Speech2Text2ForCausalLM`]. It is used to instantiate an Speech2Text2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defa...
2
1
45
1
44
1
1
1.04
1
1
0
0
1
15
1
33
108
11
48
41
25
50
21
20
19
1
2
0
1
1,954
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/modeling_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.modeling_speech_to_text_2.Speech2Text2Attention
from torch import nn from .configuration_speech_to_text_2 import Speech2Text2Config import torch from typing import Optional, Union from ....cache_utils import Cache from ....utils.deprecation import deprecate_kwarg class Speech2Text2Attention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' ...
class Speech2Text2Attention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[Speech2Text2Config]=None): pass def _...
5
2
50
7
35
8
5
0.24
1
7
1
0
3
12
3
13
156
23
107
44
86
26
68
27
64
12
1
2
15
1,955
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/modeling_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.modeling_speech_to_text_2.Speech2Text2Decoder
import torch import math from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions from .configuration_speech_to_text_2 import Speech2Text2Config from torch import nn from ....modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mas...
class Speech2Text2Decoder(Speech2Text2PreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`Speech2Text2DecoderLayer`] Args: config: Speech2Text2Config embed_tokens (nn.Embedding): output embedding ''' def __init__(self, config: S...
3
2
58
8
34
16
10
0.5
1
10
4
0
4
9
4
134
244
38
137
42
118
69
73
28
68
37
3
3
41
1,956
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/modeling_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.modeling_speech_to_text_2.Speech2Text2DecoderLayer
from ....cache_utils import Cache from .configuration_speech_to_text_2 import Speech2Text2Config from torch import nn from typing import Optional, Union from ....activations import ACT2FN import torch from ....modeling_layers import GradientCheckpointingLayer from ....utils.deprecation import deprecate_kwarg class Spe...
class Speech2Text2DecoderLayer(GradientCheckpointingLayer): def __init__(self, config: Speech2Text2Config): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, encoder_hidden...
4
1
58
7
39
13
4
0.32
1
5
2
0
2
11
2
12
118
14
79
32
65
25
45
21
42
6
1
1
8
1,957
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/modeling_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.modeling_speech_to_text_2.Speech2Text2DecoderWrapper
from ....utils import add_start_docstrings, logging, replace_return_docstrings @add_start_docstrings('The Speech2Text2 Model with a language modeling head. Can be used for summarization.', SPEECH_TO_TEXT_2_START_DOCSTRING) class Speech2Text2DecoderWrapper(Speech2Text2PreTrainedModel): """ This wrapper class is...
@add_start_docstrings('The Speech2Text2 Model with a language modeling head. Can be used for summarization.', SPEECH_TO_TEXT_2_START_DOCSTRING) class Speech2Text2DecoderWrapper(Speech2Text2PreTrainedModel): ''' This wrapper class is a helper class to correctly load pretrained checkpoints when the causal languag...
4
1
3
0
3
0
1
0.67
1
2
1
0
2
1
2
132
12
2
6
4
3
4
6
4
3
1
3
0
2
1,958
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/modeling_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.modeling_speech_to_text_2.Speech2Text2ForCausalLM
from torch.nn import CrossEntropyLoss from typing import Optional, Union from ....utils import add_start_docstrings, logging, replace_return_docstrings from ....cache_utils import Cache from torch import nn from ....modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions imp...
@add_start_docstrings('The Speech2Text2 Decoder with a language modeling head. Can be used as the decoder part of [`EncoderDecoderModel`] and [`SpeechEncoderDecoder`].', SPEECH_TO_TEXT_2_START_DOCSTRING) class Speech2Text2ForCausalLM(Speech2Text2PreTrainedModel): def __init__(self, config): pass def g...
12
1
22
3
10
9
2
0.94
1
6
2
0
9
2
10
140
234
41
100
42
70
94
51
23
40
7
3
2
20
1,959
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/modeling_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.modeling_speech_to_text_2.Speech2Text2PreTrainedModel
from torch import nn from .configuration_speech_to_text_2 import Speech2Text2Config from ....modeling_utils import PreTrainedModel class Speech2Text2PreTrainedModel(PreTrainedModel): config: Speech2Text2Config base_model_prefix = 'model' supports_gradient_checkpointing = True def _init_weights(self, m...
class Speech2Text2PreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
2
0
10
0
10
0
5
0
1
0
0
3
1
0
1
130
15
1
14
6
12
0
13
6
11
5
2
2
5
1,960
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/modeling_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.modeling_speech_to_text_2.Speech2Text2SinusoidalPositionalEmbedding
import torch import math from typing import Optional, Union from torch import nn class Speech2Text2SinusoidalPositionalEmbedding(nn.Module): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): ...
class Speech2Text2SinusoidalPositionalEmbedding(nn.Module): '''This module produces sinusoidal positional embeddings of any length.''' def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): pass def make_weights(self, num_embeddings: int, embedding_dim: int, ...
8
3
12
1
8
3
2
0.4
1
3
0
0
4
4
5
15
68
9
42
22
32
17
36
18
30
3
1
1
9
1,961
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/processing_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.processing_speech_to_text_2.Speech2Text2Processor
import warnings from ....processing_utils import ProcessorMixin from contextlib import contextmanager class Speech2Text2Processor(ProcessorMixin): """ Constructs a Speech2Text2 processor which wraps a Speech2Text2 feature extractor and a Speech2Text2 tokenizer into a single processor. [`Speech2Text2Pr...
class Speech2Text2Processor(ProcessorMixin): ''' Constructs a Speech2Text2 processor which wraps a Speech2Text2 feature extractor and a Speech2Text2 tokenizer into a single processor. [`Speech2Text2Processor`] offers all the functionalities of [`AutoFeatureExtractor`] and [`Speech2Text2Tokenizer`]. ...
5
3
14
1
9
4
3
0.63
1
2
0
0
5
2
5
22
92
12
49
16
42
31
41
15
35
9
2
1
13
1,962
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/speech_to_text_2/tokenization_speech_to_text_2.py
transformers.models.deprecated.speech_to_text_2.tokenization_speech_to_text_2.Speech2Text2Tokenizer
import os from ....tokenization_utils import PreTrainedTokenizer from typing import Optional import json class Speech2Text2Tokenizer(PreTrainedTokenizer): """ Constructs a Speech2Text2Tokenizer. This tokenizer inherits from [`PreTrainedTokenizer`] which contains some of the main methods. Users should refe...
class Speech2Text2Tokenizer(PreTrainedTokenizer): ''' Constructs a Speech2Text2Tokenizer. This tokenizer inherits from [`PreTrainedTokenizer`] which contains some of the main methods. Users should refer to the superclass for more information regarding such methods. Args: vocab_file (`str`):...
11
5
18
2
15
1
3
0.2
1
10
0
0
9
5
9
98
195
33
135
48
114
27
102
33
92
11
3
3
30
1,963
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tapex/tokenization_tapex.py
transformers.models.deprecated.tapex.tokenization_tapex.IndexedRowTableLinearize
class IndexedRowTableLinearize: """ FORMAT: col: col1 | col2 | col 3 row 1 : val1 | val2 | val3 row 2 : ... """ def process_table(self, table_content: dict): """ Given a table, TableLinearize aims at converting it into a flatten sequence with special symbols. """ assert ...
class IndexedRowTableLinearize: ''' FORMAT: col: col1 | col2 | col 3 row 1 : val1 | val2 | val3 row 2 : ... ''' def process_table(self, table_content: dict): ''' Given a table, TableLinearize aims at converting it into a flatten sequence with special symbols. ''' pass ...
4
4
10
0
6
4
2
0.79
0
3
0
0
3
0
3
3
37
3
19
9
15
15
18
9
14
3
0
2
6
1,964
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tapex/tokenization_tapex.py
transformers.models.deprecated.tapex.tokenization_tapex.TapexTokenizer
import random from ....file_utils import ExplicitEnum, PaddingStrategy, TensorType, add_end_docstrings, is_pandas_available import json from typing import Optional, Union import regex as re from ....tokenization_utils import AddedToken, PreTrainedTokenizer import os from ....tokenization_utils_base import ENCODE_KWARGS...
class TapexTokenizer(PreTrainedTokenizer): ''' Construct a TAPEX tokenizer. Based on byte-level Byte-Pair-Encoding (BPE). This tokenizer can be used to flatten one or more table(s) and concatenate them with one or more related sentences to be used by TAPEX models. The format that the TAPEX tokenizer cr...
40
19
36
2
29
5
3
0.22
1
20
4
0
33
12
33
122
1,291
118
968
411
655
216
313
128
279
9
3
3
113
1,965
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tapex/tokenization_tapex.py
transformers.models.deprecated.tapex.tokenization_tapex.TapexTruncationStrategy
from ....file_utils import ExplicitEnum, PaddingStrategy, TensorType, add_end_docstrings, is_pandas_available class TapexTruncationStrategy(ExplicitEnum): """ Possible values for the `truncation` argument in [`~TapasTokenizer.__call__`]. Useful for tab-completion in an IDE. """ DROP_ROWS_TO_FIT = 'drop...
class TapexTruncationStrategy(ExplicitEnum): ''' Possible values for the `truncation` argument in [`~TapasTokenizer.__call__`]. Useful for tab-completion in an IDE. ''' pass
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
0
6
1
2
2
1
3
2
2
1
0
1
0
0
1,966
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/configuration_trajectory_transformer.py
transformers.models.deprecated.trajectory_transformer.configuration_trajectory_transformer.TrajectoryTransformerConfig
from ....configuration_utils import PretrainedConfig class TrajectoryTransformerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`TrajectoryTransformerModel`]. It is used to instantiate an TrajectoryTransformer model according to the specified arguments, defini...
class TrajectoryTransformerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`TrajectoryTransformerModel`]. It is used to instantiate an TrajectoryTransformer model according to the specified arguments, defining the model architecture. Instantiating a config...
2
1
48
0
48
0
1
1.14
1
1
0
0
1
20
1
33
129
9
56
51
28
64
26
25
24
1
2
0
1
1,967
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/convert_trajectory_transformer_original_pytorch_checkpoint_to_pytorch.py
transformers.models.deprecated.trajectory_transformer.convert_trajectory_transformer_original_pytorch_checkpoint_to_pytorch.Parser
import trajectory.utils as utils class Parser(utils.Parser): dataset: str = 'halfcheetah-medium-expert-v2' config: str = 'config.offline'
class Parser(utils.Parser): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
3
0
3
3
2
0
3
3
2
0
1
0
0
1,968
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/modeling_trajectory_transformer.py
transformers.models.deprecated.trajectory_transformer.modeling_trajectory_transformer.Block
from ....modeling_layers import GradientCheckpointingLayer from torch import nn import torch from typing import Optional, Union class Block(GradientCheckpointingLayer): def __init__(self, config): super().__init__() self.ln1 = nn.LayerNorm(config.n_embd) self.ln2 = nn.LayerNorm(config.n_em...
class Block(GradientCheckpointingLayer): def __init__(self, config): pass def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]], layer_past: Optional[tuple[torch.Tensor]]=None, use_cache: Optional[bool]=False, output_attentions: Optional[bool]=False): pass
3
0
21
3
18
1
2
0.03
1
4
1
0
2
7
2
12
43
6
36
20
27
1
27
14
24
2
1
1
3
1,969
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/modeling_trajectory_transformer.py
transformers.models.deprecated.trajectory_transformer.modeling_trajectory_transformer.CausalSelfAttention
import torch import math from typing import Optional, Union from torch.nn import functional as F from torch import nn class CausalSelfAttention(nn.Module): def __init__(self, config): super().__init__() if config.n_embd % config.n_head != 0: raise ValueError(f'n_head ({config.n_head}) ...
class CausalSelfAttention(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]], layer_past: Optional[tuple[torch.Tensor]]=None, use_cache: Optional[bool]=False, output_attentions: Optional[bool]=False): pass
3
0
46
8
33
6
3
0.18
1
4
0
0
2
8
2
12
94
16
66
27
57
12
39
21
36
4
1
1
6
1,970
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/modeling_trajectory_transformer.py
transformers.models.deprecated.trajectory_transformer.modeling_trajectory_transformer.EinLinear
import math from torch import nn import torch class EinLinear(nn.Module): def __init__(self, n_models, in_features, out_features, bias): super().__init__() self.n_models = n_models self.out_features = out_features self.in_features = in_features self.weight = nn.Parameter(to...
class EinLinear(nn.Module): def __init__(self, n_models, in_features, out_features, bias): pass def reset_parameters(self): pass def forward(self, input): ''' Args: input (`torch.FloatTensor` of shape `(B, n_models, input_dim)`): The input to t...
4
1
9
0
7
2
2
0.26
1
4
0
0
3
5
3
13
31
2
23
13
19
6
22
13
18
3
1
2
7
1,971
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/modeling_trajectory_transformer.py
transformers.models.deprecated.trajectory_transformer.modeling_trajectory_transformer.TrajectoryTransformerModel
from torch import nn from typing import Optional, Union import numpy as np from ....cache_utils import Cache import torch from torch.nn import functional as F from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings @add_start_docstrings('The ba...
@add_start_docstrings('The bare TrajectoryTransformer Model transformer outputting raw hidden-states without any specific head on top.', TRAJECTORY_TRANSFORMER_START_DOCSTRING) class TrajectoryTransformerModel(TrajectoryTransformerPreTrainedModel): '''the full GPT language model, with a context size of block_size''...
9
2
39
7
24
8
5
0.31
1
12
3
0
5
17
5
135
206
42
127
60
107
39
88
47
82
20
3
2
24
1,972
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/modeling_trajectory_transformer.py
transformers.models.deprecated.trajectory_transformer.modeling_trajectory_transformer.TrajectoryTransformerOutput
import torch from ....cache_utils import Cache from typing import Optional, Union from dataclasses import dataclass from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings @dataclass class TrajectoryTransformerOutput(ModelOutput): """ B...
@dataclass class TrajectoryTransformerOutput(ModelOutput): ''' Base class for model's outputs that also contains a pooling of the last hidden states. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss. logits (...
2
1
0
0
0
0
0
3.33
1
0
0
0
0
0
0
0
28
2
6
6
5
20
6
6
5
0
1
0
0
1,973
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/trajectory_transformer/modeling_trajectory_transformer.py
transformers.models.deprecated.trajectory_transformer.modeling_trajectory_transformer.TrajectoryTransformerPreTrainedModel
from ....modeling_utils import PreTrainedModel from torch import nn from .configuration_trajectory_transformer import TrajectoryTransformerConfig import math class TrajectoryTransformerPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloadin...
class TrajectoryTransformerPreTrainedModel(PreTrainedModel): ''' An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. ''' def _init_weights(self, module): pass
2
1
15
0
15
0
7
0.19
1
2
1
1
1
0
1
130
27
2
21
10
19
4
19
10
17
7
2
3
7
1,974
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/configuration_transfo_xl.py
transformers.models.deprecated.transfo_xl.configuration_transfo_xl.TransfoXLConfig
from ....configuration_utils import PretrainedConfig class TransfoXLConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`TransfoXLModel`] or a [`TFTransfoXLModel`]. It is used to instantiate a Transformer-XL model according to the specified arguments, defining the...
class TransfoXLConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`TransfoXLModel`] or a [`TFTransfoXLModel`]. It is used to instantiate a Transformer-XL model according to the specified arguments, defining the model architecture. Instantiating a configuratio...
6
1
23
0
22
1
1
0.94
1
2
0
0
3
25
3
35
162
11
78
63
43
73
39
32
35
2
2
1
4
1,975
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.AdaptiveEmbedding
from torch import nn import torch class AdaptiveEmbedding(nn.Module): def __init__(self, n_token, d_embed, d_proj, cutoffs, div_val=1, sample_softmax=False): super().__init__() self.n_token = n_token self.d_embed = d_embed self.cutoffs = cutoffs + [n_token] self.div_val = d...
class AdaptiveEmbedding(nn.Module): def __init__(self, n_token, d_embed, d_proj, cutoffs, div_val=1, sample_softmax=False): pass def forward(self, inp): pass
3
0
28
6
22
0
5
0
1
2
0
0
2
9
2
12
58
13
45
26
42
0
43
26
40
5
1
3
9
1,976
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.PositionalEmbedding
import torch from torch import nn class PositionalEmbedding(nn.Module): def __init__(self, demb): super().__init__() self.demb = demb inv_freq = 1 / 10000 ** (torch.arange(0.0, demb, 2.0) / demb) self.register_buffer('inv_freq', inv_freq) def forward(self, pos_seq, bsz=None): ...
class PositionalEmbedding(nn.Module): def __init__(self, demb): pass def forward(self, pos_seq, bsz=None): pass
3
0
8
2
6
0
2
0
1
1
0
0
2
1
2
12
17
4
13
7
10
0
12
7
9
2
1
1
3
1,977
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.PositionwiseFF
from torch import nn class PositionwiseFF(nn.Module): def __init__(self, d_model, d_inner, dropout, pre_lnorm=False, layer_norm_epsilon=1e-05): super().__init__() self.d_model = d_model self.d_inner = d_inner self.dropout = dropout self.CoreNet = nn.Sequential(nn.Linear(d_m...
class PositionwiseFF(nn.Module): def __init__(self, d_model, d_inner, dropout, pre_lnorm=False, layer_norm_epsilon=1e-05): pass def forward(self, inp): pass
3
0
17
4
11
2
2
0.17
1
1
0
0
2
6
2
12
35
8
23
11
20
4
16
11
13
2
1
1
3
1,978
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.RelPartialLearnableDecoderLayer
from torch import nn class RelPartialLearnableDecoderLayer(nn.Module): def __init__(self, n_head, d_model, d_head, d_inner, dropout, layer_norm_epsilon=1e-05, **kwargs): super().__init__() self.dec_attn = RelPartialLearnableMultiHeadAttn(n_head, d_model, d_head, dropout, layer_norm_epsilon=layer_n...
class RelPartialLearnableDecoderLayer(nn.Module): def __init__(self, n_head, d_model, d_head, d_inner, dropout, layer_norm_epsilon=1e-05, **kwargs): pass def forward(self, dec_inp, r, dec_attn_mask=None, mems=None, head_mask=None, output_attentions=False): pass
3
0
12
2
10
0
1
0
1
3
2
0
2
2
2
12
25
4
21
8
18
0
10
8
7
1
1
0
2
1,979
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.RelPartialLearnableMultiHeadAttn
import torch from torch import nn class RelPartialLearnableMultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False, r_r_bias=None, r_w_bias=None, layer_norm_epsilon=1e-05): super().__init__() self.n_head = n_head self.d_model = d_model ...
class RelPartialLearnableMultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False, r_r_bias=None, r_w_bias=None, layer_norm_epsilon=1e-05): pass def _rel_shift(self, x): pass def forward(self, w, r, attn_mask=None, mems=None, head_mask=Non...
4
0
44
10
31
6
4
0.2
1
1
0
0
3
14
3
13
136
32
94
49
79
19
75
38
71
10
1
2
13
1,980
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLForSequenceClassification
from ....utils import ModelOutput, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss import torch from torch import nn from typing import Optional, Union @add_start_docstrings('\n The Transformer-XL Mode...
null
6
1
48
4
41
4
8
0.09
1
6
2
0
2
3
2
139
104
8
88
26
69
8
45
15
42
15
3
3
16
1,981
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModel
from torch import nn from .modeling_transfo_xl_utilities import ProjectedAdaptiveLogSoftmax import warnings from typing import Optional, Union from ....utils import ModelOutput, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging import torch @add_start_docstrings('\n Th...
@add_start_docstrings('\n The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive\n input embeddings)\n ', TRANSFO_XL_START_DOCSTRING) class TransfoXLLMHeadModel(TransfoXLPreTrainedModel): def __init__(self, config): pass def tie_weigh...
14
4
17
2
13
2
4
0.17
1
10
3
0
8
4
9
146
171
24
126
41
99
22
75
29
65
14
3
4
33
1,982
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput
import torch from dataclasses import dataclass from ....utils import ModelOutput, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging from typing import Optional, Union @dataclass class TransfoXLLMHeadModelOutput(ModelOutput): """ Base class for model's outputs that...
null
4
1
7
0
2
5
1
2.8
1
0
0
0
1
0
1
1
43
5
10
9
7
28
9
8
7
1
1
0
1
1,983
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLModel
from typing import Optional, Union from ....utils import ModelOutput, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging from torch import nn import torch @add_start_docstrings('The bare Bert Model transformer outputting raw hidden-states without any specific head on top.'...
@add_start_docstrings('The bare Bert Model transformer outputting raw hidden-states without any specific head on top.', TRANSFO_XL_START_DOCSTRING) class TransfoXLModel(TransfoXLPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embedding...
13
0
24
3
20
3
5
0.14
1
11
4
0
9
17
9
146
233
35
184
64
159
25
121
54
111
24
3
3
42
1,984
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput
from ....utils import ModelOutput, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging import torch from typing import Optional, Union from dataclasses import dataclass @dataclass class TransfoXLModelOutput(ModelOutput): """ Base class for model's outputs that may a...
null
2
1
0
0
0
0
0
3.8
1
0
0
0
0
0
0
0
28
4
5
4
4
19
5
4
4
0
1
0
0
1,985
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLPreTrainedModel
from ....modeling_utils import PreTrainedModel from typing import Optional, Union from torch import nn from .configuration_transfo_xl import TransfoXLConfig class TransfoXLPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading...
class TransfoXLPreTrainedModel(PreTrainedModel): ''' An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. ''' def _init_weight(self, weight): pass def _init_bias(self, bias): pass def _init_weights(self, ...
9
3
15
2
11
2
5
0.24
1
2
0
3
8
0
8
137
138
24
93
25
84
22
83
25
74
23
2
4
36
1,986
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLSequenceClassifierOutputWithPast
from dataclasses import dataclass from ....utils import ModelOutput, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging import torch from typing import Optional, Union @dataclass class TransfoXLSequenceClassifierOutputWithPast(ModelOutput): """ Base class for outpu...
null
2
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
1,987
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl_utilities.py
transformers.models.deprecated.transfo_xl.modeling_transfo_xl_utilities.ProjectedAdaptiveLogSoftmax
from torch import nn import torch class ProjectedAdaptiveLogSoftmax(nn.Module): def __init__(self, n_token, d_embed, d_proj, cutoffs, div_val=1, keep_order=False): super().__init__() self.n_token = n_token self.d_embed = d_embed self.d_proj = d_proj self.cutoffs = cutoffs +...
class ProjectedAdaptiveLogSoftmax(nn.Module): def __init__(self, n_token, d_embed, d_proj, cutoffs, div_val=1, keep_order=False): pass def _compute_logit(self, hidden, weight, bias, proj): pass def forward(self, hidden, labels=None, keep_order=False): ''' Params: ...
5
2
55
10
38
8
8
0.2
1
3
0
0
4
14
4
14
224
42
153
63
148
30
133
63
128
17
1
4
32
1,988
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/tokenization_transfo_xl.py
transformers.models.deprecated.transfo_xl.tokenization_transfo_xl.LMMultiFileIterator
import numpy as np class LMMultiFileIterator(LMShuffledIterator): def __init__(self, paths, vocab, bsz, bptt, device='cpu', ext_len=None, shuffle=False): self.paths = paths self.vocab = vocab self.bsz = bsz self.bptt = bptt self.ext_len = ext_len if ext_len is not None else...
class LMMultiFileIterator(LMShuffledIterator): def __init__(self, paths, vocab, bsz, bptt, device='cpu', ext_len=None, shuffle=False): pass def get_sent_stream(self, path): pass def __iter__(self): pass
4
0
9
1
7
0
3
0.05
1
0
0
0
3
7
3
7
29
6
22
16
18
1
22
16
18
4
1
2
8
1,989
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/tokenization_transfo_xl.py
transformers.models.deprecated.transfo_xl.tokenization_transfo_xl.LMOrderedIterator
import numpy as np class LMOrderedIterator: def __init__(self, data, bsz, bptt, device='cpu', ext_len=None): """ data -- LongTensor -- the LongTensor is strictly ordered """ self.bsz = bsz self.bptt = bptt self.ext_len = ext_len if ext_len is not None else 0 ...
class LMOrderedIterator: def __init__(self, data, bsz, bptt, device='cpu', ext_len=None): ''' data -- LongTensor -- the LongTensor is strictly ordered ''' pass def get_batch(self, i, bptt=None): pass def get_fixlen_iter(self, start=0): pass def get_va...
6
1
10
2
7
1
2
0.19
0
2
0
0
5
7
5
5
57
13
37
25
31
7
37
25
31
4
0
2
11
1,990
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/tokenization_transfo_xl.py
transformers.models.deprecated.transfo_xl.tokenization_transfo_xl.LMShuffledIterator
import numpy as np from ....utils import cached_file, check_torch_load_is_safe, is_sacremoses_available, is_torch_available, logging, requires_backends, strtobool, torch_only_method class LMShuffledIterator: def __init__(self, data, bsz, bptt, device='cpu', ext_len=None, shuffle=False): """ data -...
class LMShuffledIterator: def __init__(self, data, bsz, bptt, device='cpu', ext_len=None, shuffle=False): ''' data -- list[LongTensor] -- there is no order among the LongTensors ''' pass def get_sent_stream(self): pass @torch_only_method def stream_iterator(sel...
6
1
18
3
12
3
4
0.22
0
2
0
1
4
6
4
4
76
16
49
26
43
11
48
25
43
8
0
5
15
1,991
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/tokenization_transfo_xl.py
transformers.models.deprecated.transfo_xl.tokenization_transfo_xl.TransfoXLCorpus
import os from ....utils import cached_file, check_torch_load_is_safe, is_sacremoses_available, is_torch_available, logging, requires_backends, strtobool, torch_only_method import glob class TransfoXLCorpus: @classmethod @torch_only_method def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=...
class TransfoXLCorpus: @classmethod @torch_only_method def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=None, *inputs, **kwargs): ''' Instantiate a pre-processed corpus. ''' pass def __init__(self, *args, **kwargs): pass def build_corpus(s...
7
1
23
1
20
2
6
0.07
0
5
4
0
3
5
4
4
97
8
83
21
76
6
63
20
58
8
0
2
23
1,992
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/transfo_xl/tokenization_transfo_xl.py
transformers.models.deprecated.transfo_xl.tokenization_transfo_xl.TransfoXLTokenizer
import re from ....utils import cached_file, check_torch_load_is_safe, is_sacremoses_available, is_torch_available, logging, requires_backends, strtobool, torch_only_method import os import pickle from collections import Counter, OrderedDict from ....tokenization_utils import PreTrainedTokenizer from typing import Opti...
class TransfoXLTokenizer(PreTrainedTokenizer): ''' Construct a Transformer-XL tokenizer adapted from Vocab class in [the original code](https://github.com/kimiyoung/transformer-xl). The Transformer-XL tokenizer is a word-level tokenizer (no sub-word tokenization). This tokenizer inherits from [`Pre...
29
7
14
1
11
2
3
0.32
1
10
0
0
23
18
23
112
398
53
262
94
218
85
193
68
169
13
3
4
70
1,993
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/configuration_tvlt.py
transformers.models.deprecated.tvlt.configuration_tvlt.TvltConfig
from ....configuration_utils import PretrainedConfig class TvltConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`TvltModel`]. It is used to instantiate a TVLT model according to the specified arguments, defining the model architecture. Instantiating a configura...
class TvltConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`TvltModel`]. It is used to instantiate a TVLT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar confi...
2
1
73
5
68
0
2
1.1
1
2
0
0
1
29
1
33
161
14
70
64
36
77
35
32
33
2
2
1
2
1,994
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/feature_extraction_tvlt.py
transformers.models.deprecated.tvlt.feature_extraction_tvlt.TvltFeatureExtractor
from ....feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from math import ceil import numpy as np from typing import Optional, Union from ....utils import TensorType, logging from ....audio_utils import mel_filter_bank, spectrogram, window_function class TvltFeatureExtractor(SequenceFea...
class TvltFeatureExtractor(SequenceFeatureExtractor): ''' Constructs a TVLT audio feature extractor. This feature extractor can be used to prepare audios for the model. This feature extractor inherits from [`FeatureExtractionMixin`] which contains most of the main methods. Users should refer to this su...
4
3
57
5
38
14
5
0.57
1
10
1
0
3
9
3
20
201
22
115
45
91
66
52
25
48
12
3
2
14
1,995
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/image_processing_tvlt.py
transformers.models.deprecated.tvlt.image_processing_tvlt.TvltImageProcessor
from ....utils import TensorType, logging from ....image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict import numpy as np from typing import Optional, Union from ....image_transforms import get_resize_output_image_size, resize, to_channel_dimension_format from ....image_utils import IMAGENET_S...
class TvltImageProcessor(BaseImageProcessor): ''' Constructs a TVLT image processor. This processor can be used to prepare either videos or images for the model by converting images to 1-frame videos. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the im...
5
4
78
6
52
20
8
0.57
1
8
2
0
4
13
4
24
366
32
213
84
149
121
75
25
70
17
3
2
30
1,996
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltAttention
from ....pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer from torch import nn class TvltAttention(nn.Module): def __init__(self, config): super().__init__() self.attention = TvltSelfAttention(config) self.output = TvltSelfOutput(config) self.pruned_heads =...
class TvltAttention(nn.Module): def __init__(self, config): pass def prune_heads(self, heads): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False): pass
4
0
10
1
8
1
1
0.13
1
4
2
0
3
3
3
13
32
6
24
11
20
3
22
11
18
2
1
1
4
1,997
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltAudioEmbeddings
import torch from torch import nn class TvltAudioEmbeddings(nn.Module): """Construct the patch and position embeddings.""" def __init__(self, config): super().__init__() self.patch_embeddings = TvltAudioPatchEmbeddings(config) self.num_patches = self.patch_embeddings.num_patches ...
class TvltAudioEmbeddings(nn.Module): '''Construct the patch and position embeddings.''' def __init__(self, config): pass def forward(self, audio_values, attention_masks=None): pass
3
1
12
3
9
1
1
0.11
1
2
1
0
2
7
2
12
27
7
18
12
15
2
18
12
15
1
1
0
2
1,998
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltAudioPatchEmbeddings
import collections.abc from torch import nn import torch class TvltAudioPatchEmbeddings(nn.Module): """ This class turns `audio_values` of shape `(batch_size, num_channels, height, width)` into the initial `hidden_states` (patch embeddings) of shape `(batch_size, seq_length, hidden_size)` to be consumed by...
class TvltAudioPatchEmbeddings(nn.Module): ''' This class turns `audio_values` of shape `(batch_size, num_channels, height, width)` into the initial `hidden_states` (patch embeddings) of shape `(batch_size, seq_length, hidden_size)` to be consumed by a Transformer. ''' def __init__(self, confi...
3
1
17
2
16
0
3
0.16
1
4
0
0
2
6
2
12
42
5
32
16
29
5
23
16
20
3
1
1
5
1,999
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltDecoder
from copy import deepcopy from torch import nn class TvltDecoder(nn.Module): def __init__(self, config): super().__init__() decoder_config = deepcopy(config) decoder_config.hidden_size = config.decoder_hidden_size decoder_config.num_hidden_layers = config.decoder_num_hidden_layers ...
class TvltDecoder(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, output_attentions=False, output_hidden_states=False, return_dict=True): pass
3
0
27
5
22
1
5
0.05
1
6
2
0
2
4
2
12
56
10
44
20
35
2
30
13
27
9
1
2
10