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
800
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertOnlyMLMHead
from torch import nn import torch class BertOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = BertLMPredictionHead(config) def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: prediction_scores = self.predictions(sequence_output) ...
class BertOnlyMLMHead(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
801
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertOnlyNSPHead
from torch import nn class BertOnlyNSPHead(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_relationshi...
class BertOnlyNSPHead(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
802
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertOutput
import torch from torch import nn class BertOutput(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 BertOutput(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
803
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertPooler
from torch import nn import torch class BertPooler(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 BertPooler(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
804
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertPreTrainedModel
from torch import nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_bert import BertConfig from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging @auto_docstring class BertPreTrainedModel(PreTrainedModel): config_class...
@auto_docstring class BertPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.39
1
0
0
9
1
0
1
1
27
2
18
7
16
7
16
7
14
6
1
2
6
805
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertPreTrainingHeads
from torch import nn class BertPreTrainingHeads(nn.Module): def __init__(self, config): super().__init__() self.predictions = BertLMPredictionHead(config) self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, sequence_output, pooled_output): prediction_sco...
class BertPreTrainingHeads(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
806
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertPredictionHeadTransform
import torch from ...activations import ACT2FN from torch import nn class BertPredictionHeadTransform(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_...
class BertPredictionHeadTransform(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
807
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertSelfAttention
from ...cache_utils import Cache, EncoderDecoderCache from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel import torch from torch import nn from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torc...
class BertSelfAttention(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[Ca...
3
0
43
7
31
6
6
0.19
1
5
0
1
3
11
3
13
132
22
93
44
80
18
72
35
68
13
1
2
17
808
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertSelfOutput
from torch import nn import torch class BertSelfOutput(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(co...
class BertSelfOutput(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
809
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/tokenization_bert.py
transformers.models.bert.tokenization_bert.BertTokenizer
import collections from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace import os from typing import Optional class BertTokenizer(PreTrainedTokenizer): """ Construct a BERT tokenizer. Based on WordPiece. This tokenizer inherits from [`PreTrainedTokenizer`] wh...
class BertTokenizer(PreTrainedTokenizer): ''' Construct a BERT tokenizer. Based on WordPiece. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. Args: vocab_file (`...
14
6
15
1
10
4
2
0.72
1
9
2
3
12
5
12
101
236
29
121
53
85
87
65
29
52
6
3
3
27
810
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/tokenization_bert_fast.py
transformers.models.bert.tokenization_bert_fast.BertTokenizerFast
import json from ...tokenization_utils_fast import PreTrainedTokenizerFast from tokenizers import normalizers from typing import Optional from .tokenization_bert import BertTokenizer class BertTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" BERT tokenizer (backed by HuggingFace's *tokenizers* li...
class BertTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" BERT tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece. This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more in...
4
2
24
3
14
7
2
1.12
1
4
0
3
4
1
4
92
141
18
58
29
38
65
27
14
22
2
3
1
7
811
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/configuration_bert_generation.py
transformers.models.bert_generation.configuration_bert_generation.BertGenerationConfig
from ...configuration_utils import PretrainedConfig class BertGenerationConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BertGenerationPreTrainedModel`]. It is used to instantiate a BertGeneration model according to the specified arguments, defining the model ...
class BertGenerationConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BertGenerationPreTrainedModel`]. It is used to instantiate a BertGeneration model according to the specified arguments, defining the model architecture. Instantiating a configuration with...
2
1
35
1
34
0
1
1.64
1
1
0
0
1
13
1
1
105
10
36
35
15
59
17
16
15
1
1
0
1
812
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertEncoder
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions from ...cache_utils import Cache, EncoderDecoderCache from typing import Callable, Optional, Union from ...processing_utils import Unpack from ...utils import TransformersKwargs, auto_docstring, is_...
class BertEncoder(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
813
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationAttention
import torch from ...cache_utils import Cache, EncoderDecoderCache from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from ...utils import TransformersKwargs, auto_docstring, is_...
class BertGenerationAttention(nn.Module): def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False): pass def prune_heads(self, heads): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor...
4
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
814
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationDecoder
from ...generation import GenerationMixin import torch from ...utils.generic import can_return_tuple, check_model_inputs from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutputWithPastAndC...
@auto_docstring(custom_intro='\n BertGeneration Model with a `language modeling` head on top for CLM fine-tuning.\n ') class BertGenerationDecoder(BertGenerationPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_e...
8
1
26
3
15
7
2
0.47
2
7
3
0
5
2
5
6
137
21
79
33
55
37
33
16
27
6
2
1
12
815
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationEmbeddings
from torch import nn import torch class BertGenerationEmbeddings(nn.Module): """Construct the embeddings from word and position embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_...
class BertGenerationEmbeddings(nn.Module): '''Construct the embeddings from word and position embeddings.''' def __init__(self, config): pass def forward(self, input_ids=None, position_ids=None, inputs_embeds=None, past_key_values_length=0): pass
3
1
16
3
12
2
3
0.16
1
1
0
0
2
4
2
12
36
7
25
11
22
4
22
11
19
4
1
1
5
816
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationEncoder
from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions from ...masking_utils import create_causal_mask from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa from ...utils ...
@auto_docstring(custom_intro='\n The bare BertGeneration model transformer outputting raw hidden-states without any specific head on top.\n ') class BertGenerationEncoder(BertGenerationPreTrainedModel): ''' The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a...
12
2
27
3
18
7
4
0.46
1
7
3
0
5
3
5
6
164
23
97
37
70
45
47
21
41
15
2
2
20
817
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationIntermediate
import torch from torch import nn from ...activations import ACT2FN class BertGenerationIntermediate(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.inter...
class BertGenerationIntermediate(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
818
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationLayer
import torch from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...cache_utils import Cache, EncoderDecoderCache from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from ...modeling_layers import GradientCheckpoint...
class BertGenerationLayer(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...
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
819
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationOnlyLMHead
from torch import nn import torch class BertGenerationOnlyLMHead(nn.Module): def __init__(self, config): super().__init__() self.decoder = nn.Linear(config.hidden_size, config.vocab_size) self.bias = nn.Parameter(torch.zeros(config.vocab_size)) self.decoder.bias = self.bias de...
class BertGenerationOnlyLMHead(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass def _tie_weights(self): pass
4
0
5
0
4
1
1
0.14
1
1
0
0
3
2
3
13
18
2
14
7
10
2
13
7
9
2
1
1
4
820
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationOutput
import torch from torch import nn class BertGenerationOutput(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 = n...
class BertGenerationOutput(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
821
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationPreTrainedModel
from torch import nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_bert_generation import BertGenerationConfig from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging @auto_docstring class BertGenerationPreTrainedModel(PreTrainedModel)...
@auto_docstring class BertGenerationPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.44
1
0
0
2
1
0
1
1
25
2
16
5
14
7
14
5
12
6
1
2
6
822
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationSelfAttention
from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...cache_utils import Cache, EncoderDecoderCache from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging import torch from torch import nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS...
class BertGenerationSelfAttention(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: O...
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
823
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/modeling_bert_generation.py
transformers.models.bert_generation.modeling_bert_generation.BertGenerationSelfOutput
import torch from torch import nn class BertGenerationSelfOutput(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....
class BertGenerationSelfOutput(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
824
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_generation/tokenization_bert_generation.py
transformers.models.bert_generation.tokenization_bert_generation.BertGenerationTokenizer
from typing import Any, Optional import sentencepiece as spm from shutil import copyfile import os from ...tokenization_utils import PreTrainedTokenizer from ...utils.import_utils import requires @requires(backends=('sentencepiece',)) class BertGenerationTokenizer(PreTrainedTokenizer): """ Construct a BertGene...
@requires(backends=('sentencepiece',)) class BertGenerationTokenizer(PreTrainedTokenizer): ''' Construct a BertGeneration tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should r...
13
5
9
1
7
1
2
0.53
1
4
0
0
10
4
10
99
141
23
77
38
55
41
54
26
43
5
3
2
18
825
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_japanese/tokenization_bert_japanese.py
transformers.models.bert_japanese.tokenization_bert_japanese.BertJapaneseTokenizer
import copy from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace import os import collections from typing import Any, Optional class BertJapaneseTokenizer(PreTrainedTokenizer): """ Construct a BERT tokenizer for Japanese text. This tokenizer inherits from [`P...
class BertJapaneseTokenizer(PreTrainedTokenizer): ''' Construct a BERT tokenizer for Japanese text. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to: this superclass for more information regarding those methods. Args: vocab_...
16
6
19
1
14
3
4
0.37
1
15
7
0
14
15
14
103
312
33
204
72
162
76
115
44
100
13
3
4
49
826
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_japanese/tokenization_bert_japanese.py
transformers.models.bert_japanese.tokenization_bert_japanese.CharacterTokenizer
import unicodedata class CharacterTokenizer: """Runs Character tokenization.""" def __init__(self, vocab, unk_token, normalize_text=True): """ Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str ...
class CharacterTokenizer: '''Runs Character tokenization.''' def __init__(self, vocab, unk_token, normalize_text=True): ''' Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol f...
3
3
20
4
7
10
3
1.33
0
0
0
0
2
3
2
2
44
9
15
8
12
20
15
8
12
4
0
2
5
827
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_japanese/tokenization_bert_japanese.py
transformers.models.bert_japanese.tokenization_bert_japanese.JumanppTokenizer
import unicodedata class JumanppTokenizer: """Runs basic tokenization with jumanpp morphological parser.""" def __init__(self, do_lower_case=False, never_split=None, normalize_text=True, trim_whitespace=False): """ Constructs a JumanppTokenizer. Args: **do_lower_case**: (*...
class JumanppTokenizer: '''Runs basic tokenization with jumanpp morphological parser.''' def __init__(self, do_lower_case=False, never_split=None, normalize_text=True, trim_whitespace=False): ''' Constructs a JumanppTokenizer. Args: **do_lower_case**: (*optional*) boolean (...
3
3
31
6
18
7
5
0.41
0
1
0
0
2
5
2
2
65
13
37
18
27
15
27
12
23
7
0
3
10
828
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_japanese/tokenization_bert_japanese.py
transformers.models.bert_japanese.tokenization_bert_japanese.MecabTokenizer
import unicodedata from typing import Any, Optional import os class MecabTokenizer: """Runs basic tokenization with MeCab morphological parser.""" def __init__(self, do_lower_case=False, never_split=None, normalize_text=True, mecab_dic: Optional[str]='unidic_lite', mecab_option: Optional[str]=None): "...
class MecabTokenizer: '''Runs basic tokenization with MeCab morphological parser.''' def __init__(self, do_lower_case=False, never_split=None, normalize_text=True, mecab_dic: Optional[str]='unidic_lite', mecab_option: Optional[str]=None): ''' Constructs a MecabTokenizer. Args: ...
3
3
51
9
34
9
8
0.26
0
3
0
0
2
4
2
2
106
19
69
24
55
18
44
16
37
11
0
3
16
829
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_japanese/tokenization_bert_japanese.py
transformers.models.bert_japanese.tokenization_bert_japanese.SentencepieceTokenizer
from typing import Any, Optional import unicodedata class SentencepieceTokenizer: """ Runs sentencepiece tokenization. Based on transformers.models.albert.tokenization_albert.AlbertTokenizer. """ def __init__(self, vocab, unk_token, do_lower_case=False, remove_space=True, keep_accents=True, sp_model_k...
class SentencepieceTokenizer: ''' Runs sentencepiece tokenization. Based on transformers.models.albert.tokenization_albert.AlbertTokenizer. ''' def __init__(self, vocab, unk_token, do_lower_case=False, remove_space=True, keep_accents=True, sp_model_kwargs: Optional[dict[str, Any]]=None): pass ...
4
2
20
2
15
3
4
0.23
0
2
0
0
3
7
3
3
67
9
47
24
35
11
36
16
32
5
0
4
11
830
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert_japanese/tokenization_bert_japanese.py
transformers.models.bert_japanese.tokenization_bert_japanese.SudachiTokenizer
from ...utils import is_sentencepiece_available, is_sudachi_projection_available, logging import unicodedata class SudachiTokenizer: """Runs basic tokenization with Sudachi morphological parser.""" def __init__(self, do_lower_case=False, never_split=None, normalize_text=True, trim_whitespace=False, sudachi_sp...
class SudachiTokenizer: '''Runs basic tokenization with Sudachi morphological parser.''' def __init__(self, do_lower_case=False, never_split=None, normalize_text=True, trim_whitespace=False, sudachi_split_mode='A', sudachi_config_path=None, sudachi_resource_dir=None, sudachi_dict_type='core', sudachi_projecti...
3
3
46
6
29
11
8
0.4
0
2
0
0
2
7
2
2
95
14
58
26
43
23
36
15
32
8
0
3
15
831
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bertweet/tokenization_bertweet.py
transformers.models.bertweet.tokenization_bertweet.BertweetTokenizer
from ...tokenization_utils import PreTrainedTokenizer import os import re from typing import Optional from shutil import copyfile class BertweetTokenizer(PreTrainedTokenizer): """ Constructs a BERTweet tokenizer, using Byte-Pair-Encoding. This tokenizer inherits from [`PreTrainedTokenizer`] which contains...
class BertweetTokenizer(PreTrainedTokenizer): ''' Constructs a BERTweet tokenizer, using Byte-Pair-Encoding. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. Args: ...
17
11
20
2
14
3
3
0.44
1
16
1
0
15
10
15
104
370
58
218
80
181
95
154
56
137
9
3
3
47
832
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bertweet/tokenization_bertweet.py
transformers.models.bertweet.tokenization_bertweet.TweetTokenizer
class TweetTokenizer: """ Examples: ```python >>> # Tokenizer for tweets. >>> from nltk.tokenize import TweetTokenizer >>> tknzr = TweetTokenizer() >>> s0 = "This is a cooool #dummysmiley: :-) :-P <3 and some arrows < > -> <--" >>> tknzr.tokenize(s0) ['This', 'is', 'a', 'cooool', '...
class TweetTokenizer: ''' Examples: ```python >>> # Tokenizer for tweets. >>> from nltk.tokenize import TweetTokenizer >>> tknzr = TweetTokenizer() >>> s0 = "This is a cooool #dummysmiley: :-) :-P <3 and some arrows < > -> <--" >>> tknzr.tokenize(s0) ['This', 'is', 'a', 'cooool', '#d...
3
2
14
1
8
6
3
1.69
0
0
0
0
2
3
2
2
49
6
16
8
13
27
16
8
13
5
0
1
6
833
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/configuration_big_bird.py
transformers.models.big_bird.configuration_big_bird.BigBirdConfig
from ...configuration_utils import PretrainedConfig class BigBirdConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BigBirdModel`]. It is used to instantiate an BigBird model according to the specified arguments, defining the model architecture. Instantiating a ...
class BigBirdConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BigBirdModel`]. It is used to instantiate an BigBird model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a sim...
2
1
55
2
53
0
1
1.16
1
1
0
0
1
19
1
1
131
12
55
48
27
64
23
22
21
1
1
0
1
834
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/configuration_big_bird.py
transformers.models.big_bird.configuration_big_bird.BigBirdOnnxConfig
from collections.abc import Mapping from ...onnx import OnnxConfig from collections import OrderedDict class BigBirdOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: if self.task == 'multiple-choice': dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequenc...
class BigBirdOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass
3
0
11
0
11
0
2
0
1
3
0
0
1
0
1
1
13
0
13
4
10
0
6
3
4
2
1
1
2
835
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdAttention
from torch import nn from ...utils.deprecation import deprecate_kwarg class BigBirdAttention(nn.Module): def __init__(self, config, seed=None): super().__init__() self.attention_type = config.attention_type self.config = config self.seed = seed if self.config.attention_type...
class BigBirdAttention(nn.Module): def __init__(self, config, seed=None): pass def set_attention_type(self, value: str, layer_idx=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, attention_mask=None, head_mask=...
5
0
28
2
24
2
5
0.08
1
6
3
0
3
5
3
13
86
7
74
27
56
6
42
13
38
6
1
2
14
836
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdBlockSparseAttention
from torch import nn import math import numpy as np import torch class BigBirdBlockSparseAttention(nn.Module): def __init__(self, config, seed=None): super().__init__() self.max_seqlen = config.max_position_embeddings self.seed = seed if config.hidden_size % config.num_attention_he...
class BigBirdBlockSparseAttention(nn.Module): def __init__(self, config, seed=None): pass def forward(self, hidden_states, band_mask=None, from_mask=None, to_mask=None, from_blocked_mask=None, to_blocked_mask=None, output_attentions=None): pass @staticmethod def torch_bmm_nd(inp_1, in...
18
7
72
8
48
19
5
0.39
1
7
0
0
6
10
12
22
886
108
582
189
497
225
274
115
261
20
1
5
65
837
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdClassificationHead
from torch import nn from ...activations import ACT2FN class BigBirdClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) classifier_dropout = conf...
class BigBirdClassificationHead(nn.Module): '''Head for sentence-level classification tasks.''' def __init__(self, config): pass def forward(self, features, **kwargs): pass
3
1
9
1
9
1
2
0.11
1
1
0
0
2
4
2
12
22
3
18
9
15
2
16
9
13
2
1
0
3
838
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdEmbeddings
from torch import nn import torch class BigBirdEmbeddings(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_t...
class BigBirdEmbeddings(nn.Module): '''Construct the embeddings from word, position and token_type embeddings.''' def __init__(self, config): pass def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None, past_key_values_length=0): pass
3
1
31
6
22
4
4
0.2
1
1
0
0
2
8
2
12
67
13
45
20
40
9
37
18
34
7
1
2
8
839
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdEncoder
from ...cache_utils import Cache, DynamicCache from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...
class BigBirdEncoder(nn.Module): def __init__(self, config): pass def set_attention_type(self, value: str): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, past_key_values=None, use_cache=None, output_att...
4
0
39
3
36
0
7
0.01
1
8
2
0
3
4
3
13
120
11
108
33
88
1
44
17
40
17
1
3
22
840
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForCausalLM
from ...cache_utils import Cache, DynamicCache from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, SequenceClassifi...
@auto_docstring(custom_intro='\n BigBird Model with a `language modeling` head on top for CLM fine-tuning.\n ') class BigBirdForCausalLM(BigBirdPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, n...
7
1
22
2
15
5
2
0.27
2
6
3
0
5
2
5
6
121
14
84
34
55
23
31
16
25
5
2
1
11
841
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForMaskedLM
from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, SequenceClassifierOutput, TokenClassifierOutput from typing imp...
@auto_docstring class BigBirdForMaskedLM(BigBirdPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, atte...
8
1
26
4
14
9
2
0.59
1
6
3
0
5
2
5
6
140
23
74
33
52
44
36
18
30
5
2
1
11
842
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForMultipleChoice
from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, SequenceClassifierOutput, TokenClassifierOutput from typing imp...
@auto_docstring class BigBirdForMultipleChoice(BigBirdPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Opt...
5
1
37
5
29
4
6
0.1
1
4
2
0
2
3
2
3
84
10
67
29
44
7
28
14
25
11
2
1
12
843
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForPreTraining
from ...utils import ModelOutput, auto_docstring, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from typing import Optional, Union import torch class BigBirdForPreTraining(BigBirdPreTrainedModel): _tied_weights_keys = ['cls.predictions.decoder.weight', 'cls.predictions.decoder.bias'] ...
class BigBirdForPreTraining(BigBirdPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: ...
6
1
24
4
14
7
2
0.44
1
5
3
0
4
2
4
5
104
19
59
29
39
26
28
15
23
6
2
1
9
844
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForPreTrainingOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass from typing import Optional, Union import torch @dataclass @auto_docstring(custom_intro='\n Output type of [`BigBirdForPreTraining`].\n ') class BigBirdForPreTrainingOutput(ModelOutput): """ loss (*optional*, retu...
@dataclass @auto_docstring(custom_intro='\n Output type of [`BigBirdForPreTraining`].\n ') class BigBirdForPreTrainingOutput(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 ...
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
845
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForQuestionAnswering
from ...utils import ModelOutput, auto_docstring, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from typing import Optional, Union import torch @auto_docstring class BigBirdForQuestionAnswering(BigBirdPreTrainedModel): def __init__(self, config, add_pooling_layer=False): """ ...
@auto_docstring class BigBirdForQuestionAnswering(BigBirdPreTrainedModel): def __init__(self, config, add_pooling_layer=False): ''' add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer ''' pass @auto_docstring def forward(self,...
7
2
51
8
28
16
5
0.55
1
7
3
0
2
4
3
4
159
25
87
37
66
48
53
21
49
12
2
2
14
846
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForQuestionAnsweringHead
from torch import nn class BigBirdForQuestionAnsweringHead(nn.Module): """Head for question answering tasks.""" def __init__(self, config): super().__init__() self.dropout = nn.Dropout(config.hidden_dropout_prob) self.intermediate = BigBirdIntermediate(config) self.output = Big...
class BigBirdForQuestionAnsweringHead(nn.Module): '''Head for question answering tasks.''' def __init__(self, config): pass def forward(self, encoder_output): pass
3
1
6
0
6
0
1
0.08
1
3
2
0
2
4
2
12
16
2
13
8
10
1
13
8
10
1
1
0
2
847
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForSequenceClassification
from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, SequenceClassifierOutput, TokenClassifierOutput from typing imp...
@auto_docstring(custom_intro='\n BigBird Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ') class BigBirdForSequenceClassification(BigBirdPreTrainedModel): def __init__(self, config): pass @auto_docst...
5
1
58
7
32
19
7
0.55
1
6
3
0
2
4
2
3
119
15
67
26
50
37
33
13
30
12
2
3
13
848
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdForTokenClassification
from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, SequenceClassifierOutput, TokenClassifierOutput from typing imp...
@auto_docstring class BigBirdForTokenClassification(BigBirdPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids...
5
1
32
4
26
3
4
0.09
1
4
2
0
2
4
2
3
72
9
58
27
37
5
23
14
20
5
2
1
7
849
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdIntermediate
from torch import nn from ...activations import ACT2FN import torch class BigBirdIntermediate(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 BigBirdIntermediate(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
850
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdLMPredictionHead
from torch import nn import torch class BigBirdLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = BigBirdPredictionHeadTransform(config) self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.bias = nn.Parameter(to...
class BigBirdLMPredictionHead(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
851
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdLayer
from ...modeling_layers import GradientCheckpointingLayer from ...utils.deprecation import deprecate_kwarg from ...pytorch_utils import apply_chunking_to_forward class BigBirdLayer(GradientCheckpointingLayer): def __init__(self, config, seed=None): super().__init__() self.config = config s...
class BigBirdLayer(GradientCheckpointingLayer): def __init__(self, config, seed=None): pass def set_attention_type(self, value: str, layer_idx=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, attention_mask=Non...
6
0
27
2
23
2
4
0.09
1
7
3
0
4
10
4
14
112
12
94
39
76
8
52
26
47
7
1
2
15
852
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdModel
from ...cache_utils import Cache, DynamicCache from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, SequenceClassifi...
@auto_docstring class BigBirdModel(BigBirdPreTrainedModel): ''' 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](htt...
12
4
42
4
29
8
5
0.27
1
9
3
0
6
7
7
8
338
42
236
73
196
63
118
47
109
24
2
2
41
853
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdOnlyMLMHead
from torch import nn import torch class BigBirdOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = BigBirdLMPredictionHead(config) def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: prediction_scores = self.predictions(sequence_outp...
class BigBirdOnlyMLMHead(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
854
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdOnlyNSPHead
from torch import nn class BigBirdOnlyNSPHead(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 BigBirdOnlyNSPHead(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
855
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdOutput
import torch from torch import nn class BigBirdOutput(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.Dropo...
class BigBirdOutput(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
856
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdPreTrainedModel
from ...utils import ModelOutput, auto_docstring, logging from torch import nn from ...modeling_utils import PreTrainedModel from .configuration_big_bird import BigBirdConfig @auto_docstring class BigBirdPreTrainedModel(PreTrainedModel): config: BigBirdConfig base_model_prefix = 'bert' supports_gradient_ch...
@auto_docstring class BigBirdPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.41
1
0
0
8
1
0
1
1
26
2
17
6
15
7
15
6
13
6
1
2
6
857
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdPreTrainingHeads
from torch import nn class BigBirdPreTrainingHeads(nn.Module): def __init__(self, config): super().__init__() self.predictions = BigBirdLMPredictionHead(config) self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, sequence_output, pooled_output): predicti...
class BigBirdPreTrainingHeads(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
858
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdPredictionHeadTransform
from torch import nn from ...activations import ACT2FN import torch class BigBirdPredictionHeadTransform(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.transfo...
class BigBirdPredictionHeadTransform(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
859
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdSelfAttention
from torch import nn import math from ...utils.deprecation import deprecate_kwarg import torch class BigBirdSelfAttention(nn.Module): def __init__(self, config, layer_idx=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')): ...
class BigBirdSelfAttention(nn.Module): def __init__(self, config, layer_idx=None): 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...
4
0
33
5
22
6
4
0.25
1
3
0
0
3
8
3
13
102
18
67
32
54
17
52
23
48
9
1
1
12
860
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/modeling_big_bird.py
transformers.models.big_bird.modeling_big_bird.BigBirdSelfOutput
from torch import nn import torch class BigBirdSelfOutput(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 BigBirdSelfOutput(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
861
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/tokenization_big_bird.py
transformers.models.big_bird.tokenization_big_bird.BigBirdTokenizer
import re from typing import Any, Optional from shutil import copyfile import os import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils.import_utils import requires @requires(backends=('sentencepiece',)) class BigBirdTokenizer(PreTrainedTokenizer): """ Const...
@requires(backends=('sentencepiece',)) class BigBirdTokenizer(PreTrainedTokenizer): ''' Construct a BigBird tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to th...
16
7
16
2
11
4
3
0.58
1
6
0
0
14
5
14
103
289
41
157
69
116
91
108
42
93
9
3
3
42
862
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/big_bird/tokenization_big_bird_fast.py
transformers.models.big_bird.tokenization_big_bird_fast.BigBirdTokenizerFast
from typing import Optional from ...tokenization_utils_fast import PreTrainedTokenizerFast import os from shutil import copyfile from ...tokenization_utils import AddedToken class BigBirdTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" BigBird tokenizer (backed by HuggingFace's *tokenizers* libra...
class BigBirdTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" BigBird tokenizer (backed by HuggingFace's *tokenizers* library). Based on [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This tokenizer inherits from [`PreTrainedToken...
5
3
23
3
13
7
4
0.91
1
5
0
0
6
1
6
94
192
30
85
36
59
77
47
17
40
8
3
2
24
863
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py
transformers.models.bigbird_pegasus.configuration_bigbird_pegasus.BigBirdPegasusConfig
from ...configuration_utils import PretrainedConfig class BigBirdPegasusConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BigBirdPegasusModel`]. It is used to instantiate an BigBirdPegasus model according to the specified arguments, defining the model architect...
class BigBirdPegasusConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BigBirdPegasusModel`]. It is used to instantiate an BigBirdPegasus model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defa...
2
1
67
2
64
3
1
1.03
1
1
0
0
1
24
1
1
156
12
72
60
39
74
30
29
28
1
1
0
1
864
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py
transformers.models.bigbird_pegasus.configuration_bigbird_pegasus.BigBirdPegasusOnnxConfig
from collections.abc import Mapping from collections import OrderedDict from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeq2SeqConfigWithPast from typing import Any from ...utils import is_torch_available, logging from ... import PreTrainedTokenizer from ...onnx.utils import compute_effective_axis_dimension cl...
class BigBirdPegasusOnnxConfig(OnnxSeq2SeqConfigWithPast): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def outputs(self) -> Mapping[str, Mapping[int, str]]: pass def _generate_dummy_inputs_for_default_and_seq2seq_lm(self, tokenizer: PreTrainedToke...
10
0
30
2
27
1
4
0.05
1
9
0
0
7
1
7
7
221
20
191
73
151
10
89
42
79
8
1
3
28
865
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusBlockSparseAttention
from torch import nn import torch import numpy as np import math class BigBirdPegasusBlockSparseAttention(nn.Module): def __init__(self, config, seed=None): super().__init__() self.max_seqlen = config.max_position_embeddings self.seed = seed if config.hidden_size % config.num_atten...
class BigBirdPegasusBlockSparseAttention(nn.Module): def __init__(self, config, seed=None): pass def forward(self, hidden_states, band_mask=None, from_mask=None, to_mask=None, from_blocked_mask=None, to_blocked_mask=None, output_attentions=None): pass @staticmethod def torch_bmm_nd(in...
18
7
72
8
48
19
5
0.39
1
7
0
0
6
10
12
22
886
108
582
189
497
225
274
115
261
20
1
5
65
866
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusClassificationHead
import torch from torch import nn class BigBirdPegasusClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, input_dim: int, inner_dim: int, num_classes: int, pooler_dropout: float): super().__init__() self.dense = nn.Linear(input_dim, inner_dim) ...
class BigBirdPegasusClassificationHead(nn.Module): '''Head for sentence-level classification tasks.''' def __init__(self, input_dim: int, inner_dim: int, num_classes: int, pooler_dropout: float): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
1
9
0
9
0
1
0.05
1
4
0
0
2
3
2
12
22
2
19
12
10
1
13
6
10
1
1
0
2
867
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusDecoder
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from typing import Callable, Optional, Union import math from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput...
class BigBirdPegasusDecoder(BigBirdPegasusPreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`BigBirdPegasusDecoderLayer`] Args: config: BigBirdPegasusConfig embed_tokens (nn.Embedding): output embedding ''' def __init__(self, c...
3
2
61
9
36
16
11
0.48
1
13
5
0
4
9
4
6
254
40
145
43
126
69
78
29
73
37
2
3
42
868
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusDecoderAttention
from ...modeling_flash_attention_utils import FlashAttentionKwargs from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from typing import Callable, Optional, Union from ...utils.deprecation import deprecate_kwarg from ...processing_utils import Unpack from torch import nn from .configuration_bigbird_...
class BigBirdPegasusDecoderAttention(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[BigBirdPegasusConfig]=None, layer_idx: Op...
4
2
50
7
35
8
5
0.24
1
7
1
0
3
12
3
13
156
23
107
44
86
26
68
27
64
12
1
2
15
869
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusDecoderLayer
from torch import nn from .configuration_bigbird_pegasus import BigBirdPegasusConfig from ...modeling_layers import GradientCheckpointingLayer import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...activations import ACT2FN from typing import Callable, Optional, Union class BigBirdPeg...
class BigBirdPegasusDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: BigBirdPegasusConfig, layer_idx: Optional[int]=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, encoder_hidden_states: Optional[torch.Tensor]=None, encoder_a...
3
1
57
5
40
13
4
0.33
1
5
2
0
2
11
2
12
117
11
80
32
66
26
44
21
41
6
1
1
7
870
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusDecoderWrapper
class BigBirdPegasusDecoderWrapper(BigBirdPegasusPreTrainedModel): """ This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is used in combination with the [`EncoderDecoderModel`] framework. """ def __init__(self, config): super().__in...
class BigBirdPegasusDecoderWrapper(BigBirdPegasusPreTrainedModel): ''' This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is used in combination with the [`EncoderDecoderModel`] framework. ''' def __init__(self, config): pass de...
3
1
3
0
3
0
1
0.67
1
2
1
0
2
1
2
4
12
2
6
4
3
4
6
4
3
1
2
0
2
871
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusEncoder
from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa from typing import Callable, Optional, Union import math from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqL...
class BigBirdPegasusEncoder(BigBirdPegasusPreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`BigBirdPegasusEncoderLayer`]. Args: config: BigBirdPegasusConfig embed_tokens (nn.Embedding): output embedding ''' ...
8
4
51
7
33
11
7
0.32
1
14
5
0
4
12
5
7
300
47
194
59
177
62
117
49
110
29
2
3
41
872
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusEncoderAttention
from torch import nn class BigBirdPegasusEncoderAttention(nn.Module): def __init__(self, config, seed=None): super().__init__() self.config = config self.seed = seed self.attention_type = config.attention_type if self.attention_type == 'original_full': self.self...
class BigBirdPegasusEncoderAttention(nn.Module): def __init__(self, config, seed=None): pass def set_attention_type(self, value: str): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False, band_mask=None, from_mask=None, to_mask=None, from_bl...
4
0
25
3
21
2
4
0.08
1
5
2
0
3
5
3
13
77
10
63
25
47
5
35
13
31
5
1
1
11
873
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusEncoderLayer
from ...activations import ACT2FN from torch import nn from .configuration_bigbird_pegasus import BigBirdPegasusConfig from ...modeling_layers import GradientCheckpointingLayer import torch class BigBirdPegasusEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: BigBirdPegasusConfig, seed=None): ...
class BigBirdPegasusEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: BigBirdPegasusConfig, seed=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, band_mask=None, from_mask=None, to_mask=None, from_blocked_mask=N...
4
1
27
3
21
3
2
0.15
1
7
2
0
3
10
3
13
85
10
65
29
50
10
40
18
36
3
1
1
7
874
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusForCausalLM
from torch import nn import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from typing import Callable, Optional, Union from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ....
class BigBirdPegasusForCausalLM(BigBirdPegasusPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def set_decoder(self, decoder): pass def get_decoder(self): ...
8
1
19
3
9
8
2
0.84
2
6
2
0
8
2
9
11
184
33
82
37
55
69
41
20
31
7
2
1
16
875
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusForConditionalGeneration
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from typing import Callable, Optional, Union from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...generation import GenerationMixin from ...modeling_outputs import BaseModelOutput, BaseModelOutputWi...
@auto_docstring(custom_intro='\n The BigBirdPegasus Model with a language modeling head. Can be used for summarization.\n ') class BigBirdPegasusForConditionalGeneration(BigBirdPegasusPreTrainedModel, GenerationMixin): def __init__(self, config: BigBirdPegasusConfig): pass def get_encoder(self):...
11
1
12
1
10
1
2
0.08
2
8
3
0
9
3
10
12
139
18
112
50
77
9
56
27
45
8
2
2
19
876
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusForQuestionAnswering
from torch import nn import torch from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from typing import Callable, Optional, Union from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAn...
@auto_docstring class BigBirdPegasusForQuestionAnswering(BigBirdPegasusPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, decoder_input_ids: Optional[torch.LongTensor]=None, decode...
5
1
52
5
41
7
5
0.16
1
5
2
0
2
3
2
4
115
12
89
36
62
14
36
17
33
8
2
2
9
877
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusForSequenceClassification
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from typing import Callable, Optional, Union from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWi...
@auto_docstring(custom_intro='\n BigBirdPegasus model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g.\n for GLUE tasks.\n ') class BigBirdPegasusForSequenceClassification(BigBirdPegasusPreTrainedModel): def __init__(self, config: BigBirdPegasusConfig, **kwargs)...
5
1
55
4
48
4
8
0.08
1
10
4
0
2
2
2
4
120
10
103
32
77
8
41
14
38
15
2
3
16
878
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusLearnedPositionalEmbedding
from typing import Callable, Optional, Union from torch import nn import torch class BigBirdPegasusLearnedPositionalEmbedding(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. """ def __init__(self, num_embeddings: int, embedding_dim: int): super().__init_...
class BigBirdPegasusLearnedPositionalEmbedding(nn.Embedding): ''' This module learns positional embeddings up to a fixed maximum size. ''' def __init__(self, num_embeddings: int, embedding_dim: int): pass def forward(self, input_ids_shape: torch.Size, past_key_values_length: int=0, positi...
3
2
5
0
4
1
1
0.44
1
2
0
0
2
0
2
2
15
2
9
5
6
4
7
5
4
1
1
0
2
879
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusModel
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQue...
@auto_docstring class BigBirdPegasusModel(BigBirdPegasusPreTrainedModel): def __init__(self, config: BigBirdPegasusConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def _tie_weights(self): pass def get_encoder(self): ...
9
1
16
1
14
1
3
0.06
1
10
6
0
7
3
7
9
131
16
109
33
77
6
40
15
32
12
2
2
20
880
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusPreTrainedModel
from torch import nn from .configuration_bigbird_pegasus import BigBirdPegasusConfig import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attenti...
@auto_docstring class BigBirdPegasusPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass @property def dummy_inputs(self): pass def _update_causal_mask(self, attention_mask: Optional[Union[torch.Tensor, 'BlockMask']], input_tensor: torch.Tensor, cache_position: torch...
9
1
9
0
9
0
3
0
1
0
0
8
2
0
2
2
28
2
26
14
22
0
21
13
18
5
1
2
6
881
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusScaledWordEmbedding
import torch from torch import nn from typing import Callable, Optional, Union class BigBirdPegasusScaledWordEmbedding(nn.Embedding): """ This module overrides nn.Embeddings' forward by multiplying with embeddings scale. """ def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int,...
class BigBirdPegasusScaledWordEmbedding(nn.Embedding): ''' This module overrides nn.Embeddings' forward by multiplying with embeddings scale. ''' def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0): pass def forward(self, input_i...
3
1
3
0
3
0
1
0.5
1
4
0
0
2
1
2
2
11
2
6
4
3
3
6
4
3
1
1
0
2
882
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
transformers.models.bigbird_pegasus.modeling_bigbird_pegasus.BigBirdPegasusSelfAttention
from torch import nn from ...utils.deprecation import deprecate_kwarg import math import torch class BigBirdPegasusSelfAttention(nn.Module): def __init__(self, config, layer_idx=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_si...
class BigBirdPegasusSelfAttention(nn.Module): def __init__(self, config, layer_idx=None): 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=Non...
4
0
33
5
22
6
4
0.25
1
3
0
0
3
8
3
13
102
18
67
32
54
17
52
23
48
9
1
1
12
883
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/configuration_biogpt.py
transformers.models.biogpt.configuration_biogpt.BioGptConfig
from ...configuration_utils import PretrainedConfig class BioGptConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BioGptModel`]. It is used to instantiate an BioGPT model according to the specified arguments, defining the model architecture. Instantiating a con...
class BioGptConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BioGptModel`]. It is used to instantiate an BioGPT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simila...
2
1
38
0
38
0
1
1.45
1
1
0
0
1
15
1
1
108
10
40
39
17
58
19
18
17
1
1
0
1
884
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/convert_biogpt_original_pytorch_checkpoint_to_pytorch.py
transformers.models.biogpt.convert_biogpt_original_pytorch_checkpoint_to_pytorch.Dictionary
class Dictionary: """A mapping from symbols to consecutive integers""" def __init__(self, *, bos='<s>', pad='<pad>', eos='</s>', unk='<unk>', extra_special_symbols=None): self.bos_word, self.unk_word, self.pad_word, self.eos_word = (bos, unk, pad, eos) self.symbols = [] self.count = [] ...
class Dictionary: '''A mapping from symbols to consecutive integers''' def __init__(self, *, bos='<s>', pad='<pad>', eos='</s>', unk='<unk>', extra_special_symbols=None): pass def __eq__(self, other): pass def __getitem__(self, idx): pass def __len__(self): '''Ret...
11
5
11
0
9
2
2
0.19
0
7
0
0
8
12
9
9
108
12
83
40
64
16
66
29
56
8
0
3
20
885
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptAttention
import torch.nn as nn import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from .configuration_biogpt import BioGptConfig from ...modeling_flash_attention_utils import FlashAtt...
class BioGptAttention(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[BioGptConfig]=None, layer_idx: Optional[int]=None): ...
4
2
50
7
35
8
5
0.24
1
7
1
1
3
12
3
13
156
23
107
44
86
26
68
27
64
12
1
2
15
886
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptDecoderLayer
from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...modeling_layers import GradientCheckpointingLayer import torch.nn as nn from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...activations import ACT2FN from .configuration_biogpt import BioGptConfig import ...
class BioGptDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: BioGptConfig, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=N...
4
1
41
5
26
10
3
0.36
1
4
1
0
2
9
2
12
83
11
53
24
42
19
33
16
30
4
1
1
5
887
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptForCausalLM
import torch import torch.nn as nn from ...processing_utils import Unpack from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...generation import GenerationMixin from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWi...
@auto_docstring(custom_intro='\n BioGPT Model with a `language modeling` head on top for CLM fine-tuning.\n ') class BioGptForCausalLM(BioGptPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_...
7
1
15
1
13
1
2
0.1
2
6
2
0
4
2
5
6
91
12
72
31
46
7
28
16
22
5
2
1
10
888
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptForSequenceClassification
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, SequenceClassifierOutputWithPast, TokenClassifierOutput import torch.nn as nn from typing import Callable, Optional, Union from .configuration...
null
7
1
25
2
21
2
5
0.08
1
7
3
0
4
3
4
5
109
11
91
29
68
7
46
16
41
15
2
3
18
889
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptForTokenClassification
from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Se...
@auto_docstring class BioGptForTokenClassification(BioGptPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Opt...
5
1
38
4
31
4
4
0.1
1
5
2
0
2
4
2
3
83
8
68
31
46
7
30
17
27
6
2
2
8
890
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptLearnedPositionalEmbedding
import torch import torch.nn as nn from typing import Callable, Optional, Union class BioGptLearnedPositionalEmbedding(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. """ def __init__(self, num_embeddings: int, embedding_dim: int): self.offset = 2 ...
class BioGptLearnedPositionalEmbedding(nn.Embedding): ''' This module learns positional embeddings up to a fixed maximum size. ''' def __init__(self, num_embeddings: int, embedding_dim: int): pass def forward(self, attention_mask: torch.LongTensor, past_key_values_length: int=0, position_...
3
2
8
2
4
3
1
0.89
1
2
0
0
2
1
2
2
22
5
9
5
6
8
9
5
6
1
1
0
2
891
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptModel
import torch from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging import torch.nn as nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, SequenceClassifierOutputWithPast, TokenClassifierOutput import math from .config...
@auto_docstring class BioGptModel(BioGptPreTrainedModel): def __init__(self, config: BioGptConfig): 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: Option...
5
0
41
6
34
2
9
0.06
1
12
5
0
4
11
4
5
175
26
141
43
118
9
75
30
70
32
2
3
36
892
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptPreTrainedModel
from typing import Callable, Optional, Union import torch.nn as nn from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from .configuration_biogpt import BioGptConfig from ...modeling_utils import ALL_ATTENTION...
@auto_docstring class BioGptPreTrainedModel(PreTrainedModel): def _update_causal_mask(self, attention_mask: Optional[Union[torch.Tensor, 'BlockMask']], input_tensor: torch.Tensor, cache_position: torch.Tensor, past_key_values: Cache): pass @staticmethod def _prepare_4d_causal_attention_mask_with_ca...
5
1
15
0
12
3
6
0.41
1
0
0
4
1
0
1
1
26
2
17
6
15
7
15
6
13
6
1
2
6
893
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/modeling_biogpt.py
transformers.models.biogpt.modeling_biogpt.BioGptScaledWordEmbedding
import torch.nn as nn from typing import Callable, Optional, Union import torch class BioGptScaledWordEmbedding(nn.Embedding): """ This module overrides nn.Embeddings' forward by multiplying with embeddings scale. """ def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_...
class BioGptScaledWordEmbedding(nn.Embedding): ''' This module overrides nn.Embeddings' forward by multiplying with embeddings scale. ''' def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0): pass def forward(self, input_ids: torc...
3
1
3
0
3
0
1
0.5
1
4
0
0
2
1
2
2
11
2
6
4
3
3
6
4
3
1
1
0
2
894
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/biogpt/tokenization_biogpt.py
transformers.models.biogpt.tokenization_biogpt.BioGptTokenizer
from typing import Optional import json import os from ...tokenization_utils import PreTrainedTokenizer class BioGptTokenizer(PreTrainedTokenizer): """ Construct an FAIRSEQ Transformer tokenizer. Moses tokenization followed by Byte-Pair Encoding. This tokenizer inherits from [`PreTrainedTokenizer`] which ...
class BioGptTokenizer(PreTrainedTokenizer): ''' Construct an FAIRSEQ Transformer tokenizer. Moses tokenization followed by Byte-Pair Encoding. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to this superclass for more information regardi...
17
8
16
1
11
3
3
0.47
1
12
0
0
16
9
16
105
313
50
179
71
143
84
135
50
116
10
3
3
41
895
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/configuration_bit.py
transformers.models.bit.configuration_bit.BitConfig
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices from ...configuration_utils import PretrainedConfig class BitConfig(BackboneConfigMixin, PretrainedConfig): """ This is the configuration class to store the configuration of a [`BitModel`]. It is used to instant...
class BitConfig(BackboneConfigMixin, PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BitModel`]. It is used to instantiate an BiT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yi...
2
1
43
1
42
0
4
1.17
2
3
0
0
1
15
1
6
109
9
46
36
27
54
26
19
24
4
1
2
4
896
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/image_processing_bit.py
transformers.models.bit.image_processing_bit.BitImageProcessor
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images, validate_preprocess_arguments from ...image_processing_utils import BaseImageProcessor, BatchFeature, g...
class BitImageProcessor(BaseImageProcessor): ''' Constructs a BiT image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by `do_resize` in the `preprocess`...
5
3
75
6
47
23
10
0.73
1
8
2
0
3
11
3
23
271
23
143
60
99
105
67
20
63
21
3
2
29
897
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py
transformers.models.bit.modeling_bit.BitBackbone
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...utils import auto_docstring, logging from torch import Tensor, nn from typing import Optional from ...utils.backbone_utils import BackboneMixin @auto_do...
@auto_docstring(custom_intro='\n BiT backbone, to be used with frameworks like DETR and MaskFormer.\n ') class BitBackbone(BitPreTrainedModel, BackboneMixin): def __init__(self, config): pass @auto_docstring def forward(self, pixel_values: Tensor, output_hidden_states: Optional[bool]=None, re...
5
1
29
6
15
8
5
0.5
2
6
2
0
2
2
2
15
61
13
32
13
25
16
22
10
19
8
2
2
9
898
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py
transformers.models.bit.modeling_bit.BitBottleneckLayer
from ...activations import ACT2FN from torch import Tensor, nn class BitBottleneckLayer(nn.Module): """Non Pre-activation bottleneck block, equivalent to V1.5/V1b bottleneck. Used for ViT Hybrid.""" def __init__(self, config, in_channels, out_channels=None, bottle_ratio=0.25, stride=1, dilation=1, first_dilat...
class BitBottleneckLayer(nn.Module): '''Non Pre-activation bottleneck block, equivalent to V1.5/V1b bottleneck. Used for ViT Hybrid.''' def __init__(self, config, in_channels, out_channels=None, bottle_ratio=0.25, stride=1, dilation=1, first_dilation=None, groups=1, drop_path_rate=0.0, is_first_layer=False): ...
3
1
34
4
29
1
3
0.05
1
5
4
0
2
9
2
12
71
10
58
26
43
3
30
14
27
3
1
1
5
899
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py
transformers.models.bit.modeling_bit.BitDownsampleConv
from torch import Tensor, nn class BitDownsampleConv(nn.Module): def __init__(self, config, in_channels, out_channels, stride=1, preact=True): super().__init__() self.conv = WeightStandardizedConv2d(in_channels, out_channels, 1, stride=stride, eps=1e-08, padding=config.global_padding) self...
class BitDownsampleConv(nn.Module): def __init__(self, config, in_channels, out_channels, stride=1, preact=True): pass def forward(self, x): pass
3
0
10
0
10
0
2
0
1
3
2
0
2
2
2
12
21
1
20
12
10
0
7
5
4
2
1
0
3