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
700
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaForCausalLM
from transformers.models.jamba.modeling_jamba import HybridMambaAttentionDynamicCache, JambaAttentionDecoderLayer import torch from transformers.models.llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaRMSNorm, LlamaRotaryEmbedding, rotate_half from typing import Optional, TypedDict, Union fr...
class BambaForCausalLM(LlamaForCausalLM): def __init__(self, config): pass def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[HybridMambaAttentionDynamicCache]=None, inputs...
4
1
60
6
38
19
4
0.47
1
6
2
0
2
2
2
11
125
13
79
32
48
37
20
5
17
7
3
2
8
701
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaMLP
from transformers.models.llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaRMSNorm, LlamaRotaryEmbedding, rotate_half class BambaMLP(LlamaMLP): pass
class BambaMLP(LlamaMLP): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
12
2
0
2
1
1
0
2
1
1
0
2
0
0
702
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaMixer
from transformers.models.jamba.modeling_jamba import HybridMambaAttentionDynamicCache, JambaAttentionDecoderLayer import torch from .configuration_bamba import BambaConfig from transformers.activations import ACT2FN from typing import Optional, TypedDict, Union from torch import nn from transformers.models.mamba2.model...
class BambaMixer(nn.Module): ''' Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`. A, D are input independent (see Mamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective) ∆, B, C are input-dependent (this is a key difference between Mam...
5
1
113
15
81
20
5
0.29
1
7
3
0
4
25
4
14
471
65
323
107
300
94
181
89
176
8
1
3
20
703
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaModel
import torch from .configuration_bamba import BambaConfig from ...modeling_attn_mask_utils import AttentionMaskConverter from ...utils import auto_docstring, can_return_tuple, logging from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from torch import nn from typing import Optional, TypedD...
@auto_docstring class BambaModel(BambaPreTrainedModel): def __init__(self, config: BambaConfig): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_...
10
2
38
4
28
6
6
0.24
1
14
7
0
6
8
7
137
279
38
196
71
157
47
102
40
94
23
3
3
41
704
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaPreTrainedModel
import torch from ...modeling_utils import PreTrainedModel from .configuration_bamba import BambaConfig from ...utils import auto_docstring, can_return_tuple, logging @auto_docstring class BambaPreTrainedModel(PreTrainedModel): config: BambaConfig base_model_prefix = 'model' supports_gradient_checkpointing...
@auto_docstring class BambaPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
10
0
10
0
5
0.05
1
0
0
1
1
0
1
130
21
1
20
12
18
1
19
12
17
5
2
2
5
705
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaRMSNorm
from transformers.models.llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaRMSNorm, LlamaRotaryEmbedding, rotate_half class BambaRMSNorm(LlamaRMSNorm): pass
class BambaRMSNorm(LlamaRMSNorm): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
13
2
0
2
1
1
0
2
1
1
0
2
0
0
706
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaRMSNormGated
from transformers.models.mamba2.modeling_mamba2 import MambaRMSNormGated, pad_tensor_by_size, reshape_into_chunks, segment_sum class BambaRMSNormGated(MambaRMSNormGated): pass
class BambaRMSNormGated(MambaRMSNormGated): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
12
2
0
2
1
1
0
2
1
1
0
2
0
0
707
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.BambaRotaryEmbedding
from transformers.models.llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaRMSNorm, LlamaRotaryEmbedding, rotate_half class BambaRotaryEmbedding(LlamaRotaryEmbedding): pass
class BambaRotaryEmbedding(LlamaRotaryEmbedding): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
13
2
0
2
1
1
0
2
1
1
0
2
0
0
708
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bamba/modular_bamba.py
transformers.models.bamba.modular_bamba.HybridMambaAttentionDynamicCache
import torch from .configuration_bamba import BambaConfig from transformers.models.jamba.modeling_jamba import HybridMambaAttentionDynamicCache, JambaAttentionDecoderLayer class HybridMambaAttentionDynamicCache(HybridMambaAttentionDynamicCache): """ A dynamic cache that can handle both the attention cache (whi...
class HybridMambaAttentionDynamicCache(HybridMambaAttentionDynamicCache): ''' A dynamic cache that can handle both the attention cache (which has a seq_len dimension) and the mamba cache (which has a constant shape regardless of seq_len). This cache has two sets of lists of tensors: `key_cache` and `va...
2
1
38
2
36
1
3
0.32
1
3
1
0
1
7
1
39
52
4
37
12
35
12
19
12
17
3
4
2
3
709
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/configuration_bark.py
transformers.models.bark.configuration_bark.BarkCoarseConfig
from ...utils import add_start_docstrings, logging @add_start_docstrings(BARK_SUBMODELCONFIG_START_DOCSTRING.format(config='BarkCoarseConfig', model='BarkCoarseModel'), '\n Example:\n\n ```python\n >>> from transformers import BarkCoarseConfig, BarkCoarseModel\n\n >>> # Initializing a Bark sub-module style...
@add_start_docstrings(BARK_SUBMODELCONFIG_START_DOCSTRING.format(config='BarkCoarseConfig', model='BarkCoarseModel'), '\n Example:\n\n ```python\n >>> from transformers import BarkCoarseConfig, BarkCoarseModel\n\n >>> # Initializing a Bark sub-module style configuration\n >>> configuration = BarkCoarseCo...
2
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
3
0
3
3
2
0
3
3
2
0
2
0
0
710
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/configuration_bark.py
transformers.models.bark.configuration_bark.BarkConfig
from ...configuration_utils import PretrainedConfig from ..auto import CONFIG_MAPPING, AutoConfig from typing import Optional class BarkConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BarkModel`]. It is used to instantiate a Bark model according to the specif...
class BarkConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BarkModel`]. It is used to instantiate a Bark model according to the specified sub-models configurations, defining the model architecture. Instantiating a configuration with the defaults will yield...
4
2
28
4
22
3
4
0.88
1
4
3
0
1
5
2
2
118
20
52
27
33
46
25
11
22
6
1
1
7
711
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/configuration_bark.py
transformers.models.bark.configuration_bark.BarkFineConfig
from ...utils import add_start_docstrings, logging @add_start_docstrings(BARK_SUBMODELCONFIG_START_DOCSTRING.format(config='BarkFineConfig', model='BarkFineModel'), '\n n_codes_total (`int`, *optional*, defaults to 8):\n The total number of audio codebooks predicted. Used in the fine acoustics sub-mo...
@add_start_docstrings(BARK_SUBMODELCONFIG_START_DOCSTRING.format(config='BarkFineConfig', model='BarkFineModel'), '\n n_codes_total (`int`, *optional*, defaults to 8):\n The total number of audio codebooks predicted. Used in the fine acoustics sub-model.\n n_codes_given (`int`, *optional*, defa...
3
0
5
1
4
0
1
0
1
1
0
0
1
2
1
2
9
2
7
6
5
0
7
6
5
1
2
0
1
712
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/configuration_bark.py
transformers.models.bark.configuration_bark.BarkSemanticConfig
from ...utils import add_start_docstrings, logging @add_start_docstrings(BARK_SUBMODELCONFIG_START_DOCSTRING.format(config='BarkSemanticConfig', model='BarkSemanticModel'), '\n Example:\n\n ```python\n >>> from transformers import BarkSemanticConfig, BarkSemanticModel\n\n >>> # Initializing a Bark sub-modu...
@add_start_docstrings(BARK_SUBMODELCONFIG_START_DOCSTRING.format(config='BarkSemanticConfig', model='BarkSemanticModel'), '\n Example:\n\n ```python\n >>> from transformers import BarkSemanticConfig, BarkSemanticModel\n\n >>> # Initializing a Bark sub-module style configuration\n >>> configuration = Bark...
2
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
3
0
3
3
2
0
3
3
2
0
2
0
0
713
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/configuration_bark.py
transformers.models.bark.configuration_bark.BarkSubModelConfig
from ...configuration_utils import PretrainedConfig class BarkSubModelConfig(PretrainedConfig): keys_to_ignore_at_inference = ['past_key_values'] attribute_map = {'num_attention_heads': 'num_heads', 'num_hidden_layers': 'num_layers', 'vocab_size': 'input_vocab_size', 'window_size': 'block_size'} def __ini...
class BarkSubModelConfig(PretrainedConfig): def __init__(self, block_size=1024, input_vocab_size=10048, output_vocab_size=10048, num_layers=12, num_heads=12, hidden_size=768, dropout=0.0, bias=True, initializer_range=0.02, use_cache=True, **kwargs): pass
2
0
26
1
25
1
1
0.03
1
1
0
3
1
10
1
1
36
3
33
27
18
1
15
14
13
1
1
0
1
714
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/generation_configuration_bark.py
transformers.models.bark.generation_configuration_bark.BarkCoarseGenerationConfig
from ...generation.configuration_utils import GenerationConfig class BarkCoarseGenerationConfig(GenerationConfig): model_type = 'coarse_acoustics' def __init__(self, renormalize_logits=True, output_scores=False, return_dict_in_generate=False, output_hidden_states=False, output_attentions=False, temperature=1....
class BarkCoarseGenerationConfig(GenerationConfig): def __init__(self, renormalize_logits=True, output_scores=False, return_dict_in_generate=False, output_hidden_states=False, output_attentions=False, temperature=1.0, do_sample=False, coarse_semantic_pad_token=12048, coarse_rate_hz=75, n_coarse_codebooks=2, coars...
2
1
75
3
35
37
1
1
1
2
0
0
1
7
1
18
78
4
37
27
18
37
11
10
9
1
2
0
1
715
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/generation_configuration_bark.py
transformers.models.bark.generation_configuration_bark.BarkFineGenerationConfig
from ...generation.configuration_utils import GenerationConfig class BarkFineGenerationConfig(GenerationConfig): model_type = 'fine_acoustics' def __init__(self, temperature=1.0, max_fine_history_length=512, max_fine_input_length=1024, n_fine_codebooks=8, **kwargs): """Class that holds a generation co...
class BarkFineGenerationConfig(GenerationConfig): def __init__(self, temperature=1.0, max_fine_history_length=512, max_fine_input_length=1024, n_fine_codebooks=8, **kwargs): '''Class that holds a generation configuration for [`BarkFineModel`]. [`BarkFineModel`] is an autoencoder model, so should n...
3
2
19
2
7
10
1
1.19
1
1
0
0
2
3
2
19
41
6
16
14
6
19
9
7
6
1
2
0
2
716
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/generation_configuration_bark.py
transformers.models.bark.generation_configuration_bark.BarkGenerationConfig
from ...generation.configuration_utils import GenerationConfig from typing import Optional import copy class BarkGenerationConfig(GenerationConfig): model_type = 'bark' def __init__(self, semantic_config: Optional[dict]=None, coarse_acoustics_config: Optional[dict]=None, fine_acoustics_config: Optional[dict]=...
class BarkGenerationConfig(GenerationConfig): def __init__(self, semantic_config: Optional[dict]=None, coarse_acoustics_config: Optional[dict]=None, fine_acoustics_config: Optional[dict]=None, sample_rate=24000, codebook_size=1024, **kwargs): '''Class that holds a generation configuration for [`BarkModel`...
5
3
27
4
14
9
2
0.62
1
3
3
0
2
5
3
20
91
15
47
27
28
29
27
12
23
4
2
1
6
717
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/generation_configuration_bark.py
transformers.models.bark.generation_configuration_bark.BarkSemanticGenerationConfig
from ...generation.configuration_utils import GenerationConfig class BarkSemanticGenerationConfig(GenerationConfig): model_type = 'semantic' def __init__(self, eos_token_id=10000, renormalize_logits=True, max_new_tokens=768, output_scores=False, return_dict_in_generate=False, output_hidden_states=False, outpu...
class BarkSemanticGenerationConfig(GenerationConfig): def __init__(self, eos_token_id=10000, renormalize_logits=True, max_new_tokens=768, output_scores=False, return_dict_in_generate=False, output_hidden_states=False, output_attentions=False, temperature=1.0, do_sample=False, text_encoding_offset=10048, text_pad_...
2
1
86
3
40
43
1
1.02
1
1
0
0
1
8
1
18
89
4
42
30
21
43
12
11
10
1
2
0
1
718
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkBlock
from ...modeling_layers import GradientCheckpointingLayer from torch import nn class BarkBlock(GradientCheckpointingLayer): def __init__(self, config, is_causal=False, layer_idx=None): super().__init__() if is_causal: self.layernorm_1 = nn.LayerNorm(config.hidden_size, bias=config.bias...
class BarkBlock(GradientCheckpointingLayer): def __init__(self, config, is_causal=False, layer_idx=None): pass def forward(self, hidden_states, past_key_values=None, attention_mask=None, head_mask=None, use_cache=False, output_attentions=False, cache_position=None): pass
3
0
25
4
20
3
2
0.13
1
3
2
0
2
4
2
12
52
9
40
19
29
5
21
11
18
2
1
1
4
719
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkCausalModel
from ...modeling_outputs import CausalLMOutputWithPast, MaskedLMOutput from typing import Optional, Union import torch from ...modeling_attn_mask_utils import _prepare_4d_attention_mask from .configuration_bark import BarkCoarseConfig, BarkConfig, BarkFineConfig, BarkSemanticConfig, BarkSubModelConfig from ...utils imp...
class BarkCausalModel(BarkPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings): pass def prepare_inputs_for_generation(self, ...
8
1
41
6
30
5
7
0.17
2
12
3
2
5
9
6
9
254
43
183
55
159
31
110
38
103
30
2
2
43
720
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkCoarseModel
from .generation_configuration_bark import BarkCoarseGenerationConfig, BarkFineGenerationConfig, BarkSemanticGenerationConfig from ...utils import auto_docstring, is_accelerate_available, is_torch_accelerator_available, logging import numpy as np import torch from ...generation.logits_process import AlternatingCodebook...
@auto_docstring(custom_intro='\n Bark coarse acoustics model.\n It shares the same architecture as the semantic (or text) model. It is a GPT-2 like autoregressive model with a\n language modeling head on top.\n ') class BarkCoarseModel(BarkCausalModel): def preprocess_histories(self, max_coarse_history...
4
2
104
18
59
28
5
0.45
1
10
3
0
2
0
2
11
213
37
121
48
101
55
60
31
57
5
3
3
9
721
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkFineModel
from torch import nn from ...modeling_attn_mask_utils import _prepare_4d_attention_mask from typing import Optional, Union from .generation_configuration_bark import BarkCoarseGenerationConfig, BarkFineGenerationConfig, BarkSemanticGenerationConfig import numpy as np from ...utils import auto_docstring, is_accelerate_a...
@auto_docstring(custom_intro='\n Bark fine acoustics model. It is a non-causal GPT-like model with `config.n_codes_total` embedding layers and\n language modeling heads, one for each codebook.\n ') class BarkFineModel(BarkPreTrainedModel): def __init__(self, config): pass def get_input_embedd...
15
4
35
6
21
8
5
0.38
1
15
5
0
11
13
11
14
401
75
239
101
200
91
170
73
158
22
2
3
52
722
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkMLP
from torch import nn class BarkMLP(nn.Module): def __init__(self, config): super().__init__() self.in_proj = nn.Linear(config.hidden_size, 4 * config.hidden_size, bias=config.bias) self.out_proj = nn.Linear(4 * config.hidden_size, config.hidden_size, bias=config.bias) self.dropout ...
class BarkMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
6
0
6
0
1
0
1
1
0
0
2
4
2
12
14
1
13
7
10
0
13
7
10
1
1
0
2
723
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkModel
import warnings from ...modeling_utils import PreTrainedModel, get_parameter_device from .configuration_bark import BarkCoarseConfig, BarkConfig, BarkFineConfig, BarkSemanticConfig, BarkSubModelConfig from .generation_configuration_bark import BarkCoarseGenerationConfig, BarkFineGenerationConfig, BarkSemanticGeneration...
@auto_docstring(custom_intro="\n The full Bark model, a text-to-speech model composed of 4 sub-models:\n - [`BarkSemanticModel`] (also referred to as the 'text' model): a causal auto-regressive transformer model that\n takes\n as input tokenized text, and predicts semantic text tokens that capture the mea...
12
5
43
6
23
14
5
0.58
1
14
7
0
5
7
6
9
270
43
145
52
121
84
90
36
82
15
2
3
27
724
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkPreTrainedModel
import torch from ...modeling_utils import PreTrainedModel, get_parameter_device from ...utils import auto_docstring, is_accelerate_available, is_torch_accelerator_available, logging from torch import nn from .configuration_bark import BarkCoarseConfig, BarkConfig, BarkFineConfig, BarkSemanticConfig, BarkSubModelConfig...
@auto_docstring class BarkPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights.''' pass def __init__(self, *inputs, **kwargs): pass @property def device(self) -> torch.device: ''' `torch.device`: The device on which the mo...
6
2
12
1
8
3
4
0.4
1
1
0
3
3
0
3
3
48
6
30
9
25
12
23
8
19
6
1
2
11
725
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkSelfAttention
import math import torch from torch import nn class BarkSelfAttention(nn.Module): def __init__(self, config, is_causal=False, layer_idx=None): super().__init__() self.dropout = config.dropout self.attn_dropout = nn.Dropout(config.dropout) self.resid_dropout = nn.Dropout(config.drop...
class BarkSelfAttention(nn.Module): def __init__(self, config, is_causal=False, layer_idx=None): pass def _split_heads(self, tensor, num_heads, attn_head_size): ''' Splits hidden_size dim into attn_head_size and num_heads ''' pass def _merge_heads(self, tensor, nu...
6
2
23
4
15
4
3
0.29
1
3
0
1
5
9
5
15
123
26
76
35
62
22
61
27
55
4
1
1
13
726
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkSelfFlashAttention2
from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available class BarkSelfFlashAttention2(BarkSelfAttention): """ Bark flash attention module. This module inherits from `BarkSelfAttention` as the weights of the module stays untouched. The only required change wo...
class BarkSelfFlashAttention2(BarkSelfAttention): ''' Bark flash attention module. This module inherits from `BarkSelfAttention` as the weights of the module stays untouched. The only required change would be on the forward pass where it needs to correctly call the public API of flash attention and dea...
5
3
19
2
13
4
2
0.42
1
1
0
0
4
2
4
19
87
13
52
23
39
22
34
15
29
5
2
1
8
727
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/modeling_bark.py
transformers.models.bark.modeling_bark.BarkSemanticModel
from typing import Optional, Union from .generation_configuration_bark import BarkCoarseGenerationConfig, BarkFineGenerationConfig, BarkSemanticGenerationConfig from ...generation.logits_process import AlternatingCodebooksLogitsProcessor, BarkEosPrioritizerLogitsProcessor, SuppressTokensLogitsProcessor from .configurat...
@auto_docstring(custom_intro='\n Bark semantic (or text) model. It shares the same architecture as the coarse model.\n It is a GPT-2 like autoregressive model with a language modeling head on top.\n ') class BarkSemanticModel(BarkCausalModel): def generate(self, input_ids: torch.Tensor, semantic_generatio...
3
1
98
17
59
23
4
0.37
1
10
3
0
1
1
1
10
102
18
62
22
53
23
26
14
24
4
3
1
4
728
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bark/processing_bark.py
transformers.models.bark.processing_bark.BarkProcessor
from ...utils.hub import cached_file import json from ...feature_extraction_utils import BatchFeature from ...tokenization_utils_base import BatchEncoding from ..auto import AutoTokenizer from typing import Optional from ...processing_utils import ProcessorMixin import os import numpy as np class BarkProcessor(Process...
class BarkProcessor(ProcessorMixin): ''' Constructs a Bark processor which wraps a text tokenizer and optional Bark voice presets into a single processor. Args: tokenizer ([`PreTrainedTokenizer`]): An instance of [`PreTrainedTokenizer`]. speaker_embeddings (`dict[dict[str]]`, *o...
11
5
37
5
23
10
4
0.48
1
8
2
0
5
1
6
23
253
39
145
47
118
69
67
25
60
6
2
4
24
729
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/configuration_bart.py
transformers.models.bart.configuration_bart.BartConfig
from ...configuration_utils import PretrainedConfig import warnings class BartConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BartModel`]. It is used to instantiate a BART model according to the specified arguments, defining the model architecture. Instantiat...
class BartConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BartModel`]. It is used to instantiate a BART model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar confi...
2
1
69
2
66
2
2
0.97
1
1
0
0
1
21
1
1
149
12
70
55
39
68
29
26
27
2
1
1
2
730
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/configuration_bart.py
transformers.models.bart.configuration_bart.BartOnnxConfig
from typing import Any from collections import OrderedDict from ... import PreTrainedTokenizer from ...onnx.utils import compute_effective_axis_dimension from collections.abc import Mapping from ...utils import is_torch_available, logging from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeq2SeqConfigWithPast cl...
class BartOnnxConfig(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: PreTrainedTokenizer, bat...
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
731
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartAttention
from typing import Callable, Optional, Union from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...processing_utils import Unpack from torch import nn from .configuration_bart import BartConfig from ...utils.deprecation import deprecate_kwarg import torch from ...cache_utils import Cache, Dynam...
class BartAttention(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[BartConfig]=None, layer_idx: Optional[int]=None): ...
4
2
50
7
35
8
5
0.24
1
7
1
2
3
12
3
13
156
23
107
44
86
26
68
27
64
12
1
2
15
732
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartClassificationHead
from torch import nn import torch class BartClassificationHead(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) se...
class BartClassificationHead(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
733
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartDecoder
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging import math from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Ca...
class BartDecoder(BartPreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`BartDecoderLayer`] Args: config: BartConfig embed_tokens (nn.Embedding): output embedding ''' def __init__(self, config: BartConfig, embed_tokens: Optiona...
3
2
68
9
42
18
12
0.45
1
13
5
0
4
11
4
6
285
41
168
45
149
76
88
31
83
43
2
3
48
734
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartDecoderLayer
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...utils.deprecation import deprecate_kwarg from ...activations import ACT2FN from typing import Callable, Optional, Union from torch import nn from .configuration_bart import BartConfig from ...modeling_layers import GradientCheckpointingLayer im...
class BartDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: BartConfig, 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]=None,...
4
1
58
6
40
13
4
0.31
1
4
1
0
2
11
2
12
118
12
81
32
67
25
44
21
41
6
1
1
7
735
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartDecoderWrapper
class BartDecoderWrapper(BartPreTrainedModel): """ 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().__init__(config) ...
class BartDecoderWrapper(BartPreTrainedModel): ''' 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 def forward(self, *arg...
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
736
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartEncoder
from typing import Callable, Optional, Union import math from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput from torch import nn from .con...
class BartEncoder(BartPreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`BartEncoderLayer`]. Args: config: BartConfig embed_tokens (nn.Embedding): output embedding ''' def __init__(self, config: BartConfig, e...
3
2
43
6
27
10
8
0.43
1
12
5
0
4
11
4
6
186
30
110
35
96
47
71
26
66
27
2
3
32
737
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartEncoderLayer
from torch import nn from .configuration_bart import BartConfig from ...modeling_layers import GradientCheckpointingLayer import torch from ...activations import ACT2FN from typing import Callable, Optional, Union class BartEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: BartConfig, layer_idx...
class BartEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: BartConfig, layer_idx: Optional[int]=None): pass def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, layer_head_mask: torch.FloatTensor, output_attentions: Optional[bool]=False) -> tuple[...
3
1
33
3
25
6
2
0.22
1
3
1
0
2
9
2
12
68
7
50
22
41
11
32
16
29
3
1
1
4
738
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartForCausalLM
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...generation import GenerationMixi...
@auto_docstring(custom_intro='\n BART decoder with a language modeling head on top (linear layer with weights tied to the input embeddings).\n ') class BartForCausalLM(BartPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_input_embeddings(self): pass def se...
9
1
19
3
9
8
2
0.84
2
6
2
0
8
2
9
11
186
33
83
37
56
70
42
20
32
7
2
1
16
739
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartForConditionalGeneration
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...generation import GenerationMixi...
@auto_docstring(custom_intro='\n The BART Model with a language modeling head. Can be used for summarization.\n ') class BartForConditionalGeneration(BartPreTrainedModel, GenerationMixin): def __init__(self, config: BartConfig): pass def get_encoder(self): pass def get_decoder(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
740
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartForQuestionAnswering
from typing import Callable, Optional, Union from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWi...
@auto_docstring class BartForQuestionAnswering(BartPreTrainedModel): 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, decoder_attention_mask: Op...
5
1
52
5
41
7
5
0.14
1
5
2
0
2
3
2
4
116
12
91
36
62
13
36
17
33
8
2
2
9
741
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartForSequenceClassification
from typing import Callable, Optional, Union from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWi...
@auto_docstring(custom_intro='\n Bart model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g. for GLUE\n tasks.\n ') class BartForSequenceClassification(BartPreTrainedModel): def __init__(self, config: BartConfig, **kwargs): pass @auto_docstring d...
5
1
55
4
48
4
8
0.07
1
10
4
0
2
2
2
4
121
10
105
32
77
7
41
14
38
15
2
3
16
742
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartLearnedPositionalEmbedding
import torch from torch import nn from typing import Callable, Optional, Union class BartLearnedPositionalEmbedding(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 s...
class BartLearnedPositionalEmbedding(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: torch.Tensor, past_key_values_length: int=0, position_ids: Option...
3
2
7
1
5
2
1
0.6
1
3
0
0
2
1
2
2
20
4
10
6
7
6
8
6
5
1
1
0
2
743
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartModel
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutput...
@auto_docstring class BartModel(BartPreTrainedModel): def __init__(self, config: BartConfig): pass def _tie_weights(self): pass def get_input_embeddings(self): pass def set_input_embeddings(self, value): pass def get_encoder(self): pass @auto_docstrin...
9
1
16
1
14
1
3
0.05
1
10
6
0
7
3
7
9
128
16
107
33
75
5
40
15
32
12
2
2
20
744
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartPreTrainedModel
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdyna...
@auto_docstring class BartPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass @property def dummy_inputs(self): pass def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs_embeds: torch.Tensor): pass def _update_causal_mask(self, ...
10
1
9
0
9
0
3
0
1
0
0
10
2
0
2
2
30
2
28
16
24
0
23
15
20
5
1
2
6
745
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartPretrainedModel
import warnings class BartPretrainedModel(BartPreTrainedModel): def __init_subclass__(self): warnings.warn('The class `PretrainedBartModel` has been depreciated, please use `BartPreTrainedModel` instead.', FutureWarning)
class BartPretrainedModel(BartPreTrainedModel): def __init_subclass__(self): pass
2
0
5
0
5
0
1
0
1
1
0
0
1
0
1
3
6
0
6
2
4
0
3
2
1
1
2
0
1
746
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.BartScaledWordEmbedding
from typing import Callable, Optional, Union import torch from torch import nn class BartScaledWordEmbedding(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_sca...
class BartScaledWordEmbedding(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: torch....
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
747
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/modeling_bart.py
transformers.models.bart.modeling_bart.PretrainedBartModel
import warnings class PretrainedBartModel(BartPreTrainedModel): def __init_subclass__(self): warnings.warn('The class `PretrainedBartModel` has been depreciated, please use `BartPreTrainedModel` instead.', FutureWarning)
class PretrainedBartModel(BartPreTrainedModel): def __init_subclass__(self): pass
2
0
5
0
5
0
1
0
1
1
0
0
1
0
1
3
6
0
6
2
4
0
3
2
1
1
2
0
1
748
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/tokenization_bart.py
transformers.models.bart.tokenization_bart.BartTokenizer
import regex as re from typing import Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer import json import os class BartTokenizer(PreTrainedTokenizer): """ Constructs a BART tokenizer, which is smilar to the ROBERTa tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer ha...
class BartTokenizer(PreTrainedTokenizer): ''' Constructs a BART tokenizer, which is smilar to the ROBERTa tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will be encoded differently whether it ...
15
8
17
1
12
4
3
0.63
1
11
0
0
13
9
13
102
317
51
165
70
130
104
120
45
106
9
3
3
39
749
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bart/tokenization_bart_fast.py
transformers.models.bart.tokenization_bart_fast.BartTokenizerFast
import json from .tokenization_bart import BartTokenizer from tokenizers import processors from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...tokenization_utils_base import AddedToken, BatchEncoding from typing import Optional class BartTokenizerFast(PreTrainedTokenizerFast): """ Construct ...
class BartTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" BART tokenizer (backed by HuggingFace's *tokenizers* library), derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepie...
11
4
18
2
12
3
3
0.84
1
6
1
0
8
1
8
96
234
43
104
45
75
87
59
25
50
8
3
2
22
750
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/barthez/tokenization_barthez.py
transformers.models.barthez.tokenization_barthez.BarthezTokenizer
import os from ...utils.import_utils import requires from shutil import copyfile from ...tokenization_utils import AddedToken, PreTrainedTokenizer import sentencepiece as spm from typing import Any, Optional @requires(backends=('sentencepiece',)) class BarthezTokenizer(PreTrainedTokenizer): """ Adapted from [`...
@requires(backends=('sentencepiece',)) class BarthezTokenizer(PreTrainedTokenizer): ''' Adapted from [`CamembertTokenizer`] and [`BartTokenizer`]. Construct a BARThez tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which ...
16
7
13
1
8
3
2
0.86
1
6
0
0
13
4
13
102
250
44
111
52
78
95
76
32
62
5
3
3
27
751
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/barthez/tokenization_barthez_fast.py
transformers.models.barthez.tokenization_barthez_fast.BarthezTokenizerFast
from shutil import copyfile from ...tokenization_utils import AddedToken import os from ...tokenization_utils_fast import PreTrainedTokenizerFast from typing import Optional class BarthezTokenizerFast(PreTrainedTokenizerFast): """ Adapted from [`CamembertTokenizer`] and [`BartTokenizer`]. Construct a "fast" BA...
class BarthezTokenizerFast(PreTrainedTokenizerFast): ''' Adapted from [`CamembertTokenizer`] and [`BartTokenizer`]. Construct a "fast" BARThez tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of th...
5
3
19
2
12
5
3
0.97
1
5
0
0
5
1
5
93
156
28
65
32
42
63
32
15
26
5
3
1
13
752
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bartpho/tokenization_bartpho.py
transformers.models.bartpho.tokenization_bartpho.BartphoTokenizer
from shutil import copyfile import os from ...utils.import_utils import requires from typing import Any, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer import sentencepiece as spm @requires(backends=('sentencepiece',)) class BartphoTokenizer(PreTrainedTokenizer): """ Adapted from [`...
@requires(backends=('sentencepiece',)) class BartphoTokenizer(PreTrainedTokenizer): ''' Adapted from [`XLMRobertaTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to...
16
7
15
2
10
3
3
0.75
1
6
0
0
13
7
13
102
280
52
130
60
96
98
88
37
74
10
3
4
34
753
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/configuration_beit.py
transformers.models.beit.configuration_beit.BeitConfig
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices from ...configuration_utils import PretrainedConfig import warnings class BeitConfig(BackboneConfigMixin, PretrainedConfig): """ This is the configuration class to store the configuration of a [`BeitModel`]. It ...
class BeitConfig(BackboneConfigMixin, PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BeitModel`]. It is used to instantiate an BEiT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will...
2
1
83
4
75
4
2
1.21
2
3
0
0
1
32
1
6
182
12
77
68
41
93
38
34
36
2
1
1
2
754
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/configuration_beit.py
transformers.models.beit.configuration_beit.BeitOnnxConfig
from packaging import version from collections import OrderedDict from collections.abc import Mapping from ...onnx import OnnxConfig class BeitOnnxConfig(OnnxConfig): torch_onnx_minimum_version = version.parse('1.11') @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return OrderedDic...
class BeitOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def atol_for_validation(self) -> float: pass
5
0
4
0
4
0
1
0
1
4
0
0
2
0
2
2
14
2
12
6
7
0
6
4
3
1
1
0
2
755
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/feature_extraction_beit.py
transformers.models.beit.feature_extraction_beit.BeitFeatureExtractor
from .image_processing_beit import BeitImageProcessor from ...utils.import_utils import requires import warnings @requires(backends=('vision',)) class BeitFeatureExtractor(BeitImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class BeitFeatureExtractor is deprecated and will...
@requires(backends=('vision',)) class BeitFeatureExtractor(BeitImageProcessor): def __init__(self, *args, **kwargs) -> None: pass
3
0
7
0
7
0
1
0
1
2
0
0
1
0
1
31
8
0
8
2
6
0
4
2
2
1
4
0
1
756
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/image_processing_beit.py
transformers.models.beit.image_processing_beit.BeitImageProcessor
from ...image_processing_utils import INIT_SERVICE_KWARGS, BaseImageProcessor, BatchFeature, get_size_dict from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array...
@requires(backends=('vision',)) class BeitImageProcessor(BaseImageProcessor): ''' Constructs a BEiT 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 the ...
13
6
40
2
28
10
5
0.47
1
10
2
1
9
11
10
30
456
34
287
113
191
135
116
30
105
16
3
2
46
757
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitAttention
from torch import Tensor, nn import torch from ...pytorch_utils import compile_compatible_method_lru_cache, find_pruneable_heads_and_indices, prune_linear_layer from .configuration_beit import BeitConfig from typing import Optional, Union class BeitAttention(nn.Module): def __init__(self, config: BeitConfig, wind...
class BeitAttention(nn.Module): def __init__(self, config: BeitConfig, window_size: Optional[tuple]=None) -> None: pass def prune_heads(self, heads): pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, relative_positi...
4
0
13
1
11
1
1
0.09
1
8
2
0
3
3
3
13
42
6
34
19
22
3
22
11
18
2
1
1
4
758
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitBackbone
from ...utils import auto_docstring, logging, torch_int from torch import Tensor, nn from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedLMOutput, SemanticSegmenterOutput from ...utils.backbone_utils import BackboneMixin from typing import Optional, ...
@auto_docstring(custom_intro='\n BEiT backbone, to be used with frameworks like DETR and MaskFormer.\n ') class BeitBackbone(BeitPreTrainedModel, BackboneMixin): def __init__(self, config): pass def get_input_embeddings(self): pass @auto_docstring def forward(self, pixel_values: ...
6
1
38
6
25
7
5
0.27
2
10
3
0
3
7
3
16
120
20
79
27
67
21
44
20
40
12
2
3
16
759
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitConvModule
import torch from typing import Optional, Union from torch import Tensor, nn class BeitConvModule(nn.Module): """ A convolutional block that bundles conv/norm/activation layers. This block simplifies the usage of convolution layers, which are commonly used with a norm layer (e.g., BatchNorm) and activation...
class BeitConvModule(nn.Module): ''' A convolutional block that bundles conv/norm/activation layers. This block simplifies the usage of convolution layers, which are commonly used with a norm layer (e.g., BatchNorm) and activation layer (e.g., ReLU). Based on OpenMMLab's implementation, found in https:...
3
1
13
1
13
0
1
0.19
1
5
0
0
2
3
2
12
35
4
26
15
15
5
11
7
8
1
1
0
2
760
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitDropPath
import torch from typing import Optional, Union from torch import Tensor, nn class BeitDropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).""" def __init__(self, drop_prob: Optional[float]=None) -> None: super().__init__() self.drop_p...
class BeitDropPath(nn.Module): '''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).''' def __init__(self, drop_prob: Optional[float]=None) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass def extra_repr(self) ->...
4
1
2
0
2
0
1
0.13
1
4
0
0
3
1
3
13
12
3
8
5
4
1
8
5
4
1
1
0
3
761
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitEmbeddings
import warnings from ...utils import auto_docstring, logging, torch_int from torch import Tensor, nn import torch import collections.abc from .configuration_beit import BeitConfig from typing import Optional, Union class BeitEmbeddings(nn.Module): """ Construct the CLS token, position and patch embeddings. Opt...
class BeitEmbeddings(nn.Module): ''' Construct the CLS token, position and patch embeddings. Optionally, also the mask token. ''' def __init__(self, config: BeitConfig) -> None: pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor: ...
4
2
30
5
22
3
4
0.2
1
7
2
0
3
7
3
13
99
20
66
31
57
13
47
26
43
5
1
2
11
762
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitEncoder
from .configuration_beit import BeitConfig from typing import Optional, Union from torch import Tensor, nn from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedLMOutput, SemanticSegmenterOutput import torch class BeitEncoder(nn.Module): def __in...
class BeitEncoder(nn.Module): def __init__(self, config: BeitConfig, window_size: Optional[tuple]=None) -> None: pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, interpolate_pos_encoding: bool=...
3
0
41
4
36
1
7
0.01
1
11
4
0
2
4
2
12
83
9
73
25
61
1
31
16
28
11
1
2
14
763
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitFCNHead
from typing import Optional, Union from .configuration_beit import BeitConfig from torch import Tensor, nn import torch class BeitFCNHead(nn.Module): """ Fully Convolution Networks for Semantic Segmentation. This head is implemented of [FCNNet](https://huggingface.co/papers/1411.4038>). Args: ...
class BeitFCNHead(nn.Module): ''' Fully Convolution Networks for Semantic Segmentation. This head is implemented of [FCNNet](https://huggingface.co/papers/1411.4038>). Args: config (BeitConfig): Configuration. in_channels kernel_size (int): The kernel size for convs in the head....
3
1
21
1
19
1
3
0.28
1
6
2
0
2
8
2
12
57
7
39
18
34
11
26
16
23
4
1
1
6
764
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitForImageClassification
from ...utils import auto_docstring, logging, torch_int from torch import Tensor, nn from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedLMOutput, SemanticSegmenterOutput import torch from .configuration_beit import BeitConfig from typing import Opti...
@auto_docstring(custom_intro='\n Beit Model transformer with an image classification head on top (a linear layer on top of the average of the final\n hidden states of the patch tokens) e.g. for ImageNet.\n ') class BeitForImageClassification(BeitPreTrainedModel): def __init__(self, config: BeitConfig) -> ...
5
1
37
4
29
4
8
0.12
1
8
3
0
2
3
2
3
82
9
65
22
46
8
32
12
29
13
2
3
15
765
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitForMaskedImageModeling
from torch.nn import CrossEntropyLoss from ...utils import auto_docstring, logging, torch_int from torch import Tensor, nn from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedLMOutput, SemanticSegmenterOutput import torch from .configuration_beit imp...
@auto_docstring(custom_intro="\n Beit Model transformer with a 'language' modeling head on top. BEiT does masked image modeling by predicting\n visual tokens of a Vector-Quantize Variational Autoencoder (VQ-VAE), whereas other vision models like ViT and DeiT\n predict RGB pixel values. As a result, this class ...
6
1
45
8
22
15
3
0.64
1
7
3
0
2
4
2
3
93
17
47
24
32
30
22
13
19
5
2
1
6
766
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitForSemanticSegmentation
import torch from typing import Optional, Union from ...utils import auto_docstring, logging, torch_int from torch.nn import CrossEntropyLoss from torch import Tensor, nn from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedLMOutput, SemanticSegmenter...
@auto_docstring class BeitForSemanticSegmentation(BeitPreTrainedModel): def __init__(self, config: BeitConfig) -> None: pass def compute_loss(self, logits, auxiliary_logits, labels): pass @auto_docstring def forward(self, pixel_values: Optional[torch.Tensor]=None, head_mask: Optional[t...
6
1
47
7
31
9
6
0.29
1
12
5
0
3
8
3
4
145
23
95
39
80
28
52
29
48
12
2
2
18
767
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitIntermediate
from ...activations import ACT2FN from .configuration_beit import BeitConfig import torch from torch import Tensor, nn class BeitIntermediate(nn.Module): def __init__(self, config: BeitConfig) -> None: super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) ...
class BeitIntermediate(nn.Module): def __init__(self, config: BeitConfig) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
1
6
0
2
0
1
4
1
0
2
2
2
12
14
2
12
5
9
0
11
5
8
2
1
1
3
768
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitLayer
from torch import Tensor, nn import torch from .configuration_beit import BeitConfig from ...modeling_layers import GradientCheckpointingLayer from typing import Optional, Union class BeitLayer(GradientCheckpointingLayer): """This corresponds to the Block class in the timm implementation.""" def __init__(self...
class BeitLayer(GradientCheckpointingLayer): '''This corresponds to the Block class in the timm implementation.''' def __init__(self, config: BeitConfig, window_size: Optional[tuple]=None, drop_path_rate: float=0.0) -> None: pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[...
3
1
30
5
23
3
3
0.15
1
11
5
0
2
10
2
12
63
11
47
26
36
7
31
18
28
3
1
1
6
769
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitModel
from .configuration_beit import BeitConfig from typing import Optional, Union from ...utils import auto_docstring, logging, torch_int from torch import Tensor, nn import torch @auto_docstring class BeitModel(BeitPreTrainedModel): def __init__(self, config: BeitConfig, add_pooling_layer: bool=True) -> None: ...
@auto_docstring class BeitModel(BeitPreTrainedModel): def __init__(self, config: BeitConfig, add_pooling_layer: bool=True) -> None: ''' add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer ''' pass def get_input_embeddings(self): ...
7
3
20
2
14
4
3
0.22
1
9
5
0
4
5
4
5
90
11
65
27
43
14
29
17
24
7
2
1
13
770
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitModelOutputWithPooling
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedLMOutput, SemanticSegmenterOutput from ...utils import auto_docstring, logging, torch_int from dataclasses import dataclass @dataclass @auto_docstring(custom_intro='\n Class for outputs of [`Bei...
@dataclass @auto_docstring(custom_intro='\n Class for outputs of [`BeitModel`].\n ') class BeitModelOutputWithPooling(BaseModelOutputWithPooling): ''' pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): Average of the last layer hidden states of the patch tokens (excluding th...
3
1
0
0
0
0
0
19
1
0
0
0
0
0
0
0
23
3
1
1
0
19
1
1
0
0
2
0
0
771
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitOutput
from .configuration_beit import BeitConfig import torch from torch import Tensor, nn class BeitOutput(nn.Module): def __init__(self, config: BeitConfig) -> None: super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_...
class BeitOutput(nn.Module): def __init__(self, config: BeitConfig) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
5
1
4
0
1
0
1
3
1
0
2
2
2
12
11
2
9
5
6
0
9
5
6
1
1
0
2
772
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitPatchEmbeddings
from torch import Tensor, nn import collections.abc import torch class BeitPatchEmbeddings(nn.Module): """ This class turns `pixel_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...
class BeitPatchEmbeddings(nn.Module): ''' This class turns `pixel_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, config): ...
3
1
22
3
18
1
3
0.16
1
4
0
0
2
6
2
12
51
8
37
20
30
6
27
16
24
3
1
1
6
773
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitPooler
from torch import Tensor, nn from .configuration_beit import BeitConfig import torch class BeitPooler(nn.Module): def __init__(self, config: BeitConfig) -> None: super().__init__() self.layernorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) if config.use_mean_pooling else None ...
class BeitPooler(nn.Module): def __init__(self, config: BeitConfig) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
8
1
6
1
2
0.15
1
3
1
0
2
1
2
12
17
2
13
6
10
2
10
6
7
2
1
1
4
774
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitPreTrainedModel
from ...modeling_utils import PreTrainedModel from .configuration_beit import BeitConfig from ...utils import auto_docstring, logging, torch_int from torch import Tensor, nn @auto_docstring class BeitPreTrainedModel(PreTrainedModel): config: BeitConfig base_model_prefix = 'beit' main_input_name = 'pixel_va...
@auto_docstring class BeitPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.35
1
0
0
5
1
0
1
1
29
2
20
9
18
7
18
9
16
6
1
2
6
775
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitPyramidPoolingBlock
import torch from torch import Tensor, nn class BeitPyramidPoolingBlock(nn.Module): def __init__(self, pool_scale: int, in_channels: int, channels: int) -> None: super().__init__() self.layers = [nn.AdaptiveAvgPool2d(pool_scale), BeitConvModule(in_channels, channels, kernel_size=1)] for i,...
class BeitPyramidPoolingBlock(nn.Module): def __init__(self, pool_scale: int, in_channels: int, channels: int) -> None: pass def forward(self, input: torch.Tensor) -> torch.Tensor: pass
3
0
7
0
7
0
2
0
1
6
1
0
2
1
2
12
15
1
14
7
11
0
11
7
8
2
1
1
4
776
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitPyramidPoolingModule
import torch from torch import Tensor, nn class BeitPyramidPoolingModule(nn.Module): """ Pyramid Pooling Module (PPM) used in PSPNet. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. in_channels (int): Input channels. channels (int): Channe...
class BeitPyramidPoolingModule(nn.Module): ''' Pyramid Pooling Module (PPM) used in PSPNet. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. in_channels (int): Input channels. channels (int): Channels after modules, before conv_seg. ...
3
1
10
0
10
0
2
0.48
1
7
1
0
2
5
2
12
35
4
21
14
18
10
19
14
16
2
1
1
4
777
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitRelativePositionBias
import torch from ...utils import auto_docstring, logging, torch_int from ...pytorch_utils import compile_compatible_method_lru_cache, find_pruneable_heads_and_indices, prune_linear_layer from torch import Tensor, nn from .configuration_beit import BeitConfig class BeitRelativePositionBias(nn.Module): def __init_...
class BeitRelativePositionBias(nn.Module): def __init__(self, config: BeitConfig, window_size: tuple) -> None: pass @compile_compatible_method_lru_cache(maxsize=10) def generate_relative_position_index(self, window_size: tuple[int, int]) -> torch.Tensor: ''' This method creates the...
5
2
27
4
19
6
2
0.32
1
6
1
0
3
4
3
13
84
13
59
27
55
19
46
27
42
3
1
1
5
778
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitSdpaSelfAttention
import math import torch from typing import Optional, Union class BeitSdpaSelfAttention(BeitSelfAttention): def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, relative_position_bias: Optional[torch.Tensor]=None, interpolate_pos_encoding: bool=Fals...
class BeitSdpaSelfAttention(BeitSelfAttention): def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, relative_position_bias: Optional[torch.Tensor]=None, interpolate_pos_encoding: bool=False, resolution: Optional[tuple[int]]=None) -> Union[tuple[tor...
2
0
59
4
54
1
6
0.02
1
4
0
0
1
0
1
14
60
4
55
20
45
1
24
12
22
6
2
2
6
779
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitSelfAttention
from torch import Tensor, nn import math import torch from .configuration_beit import BeitConfig from typing import Optional, Union class BeitSelfAttention(nn.Module): def __init__(self, config: BeitConfig, window_size: Optional[tuple]=None) -> None: super().__init__() self.config = config ...
class BeitSelfAttention(nn.Module): def __init__(self, config: BeitConfig, window_size: Optional[tuple]=None) -> None: pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, relative_position_bias: Optional[torch.Tensor]=None, interp...
3
0
26
5
19
2
3
0.12
1
8
2
1
3
9
3
13
82
18
57
33
45
7
43
25
39
5
1
1
9
780
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitSelfOutput
from .configuration_beit import BeitConfig import torch from torch import Tensor, nn class BeitSelfOutput(nn.Module): """ The residual connection is defined in BeitLayer instead of here (as is the case with other models), due to the layernorm applied before each block. """ def __init__(self, confi...
class BeitSelfOutput(nn.Module): ''' The residual connection is defined in BeitLayer instead of here (as is the case with other models), due to the layernorm applied before each block. ''' def __init__(self, config: BeitConfig) -> None: pass def forward(self, hidden_states: torch.Tens...
3
1
5
1
4
0
1
0.44
1
3
1
0
2
2
2
12
16
3
9
5
6
4
9
5
6
1
1
0
2
781
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/beit/modeling_beit.py
transformers.models.beit.modeling_beit.BeitUperHead
from .configuration_beit import BeitConfig import torch from torch import Tensor, nn class BeitUperHead(nn.Module): """ Unified Perceptual Parsing for Scene Understanding. This head is the implementation of [UPerNet](https://huggingface.co/papers/1807.10221). Based on OpenMMLab's implementation, found...
class BeitUperHead(nn.Module): ''' Unified Perceptual Parsing for Scene Understanding. This head is the implementation of [UPerNet](https://huggingface.co/papers/1807.10221). Based on OpenMMLab's implementation, found in https://github.com/open-mmlab/mmsegmentation. ''' def __init__(self, conf...
4
1
24
3
19
3
2
0.24
1
7
3
0
3
10
3
13
83
13
59
25
55
14
40
25
36
3
1
1
6
782
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/configuration_bert.py
transformers.models.bert.configuration_bert.BertConfig
from ...configuration_utils import PretrainedConfig class BertConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BertModel`] or a [`TFBertModel`]. It is used to instantiate a BERT model according to the specified arguments, defining the model architecture. Insta...
class BertConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`BertModel`] or a [`TFBertModel`]. It is used to instantiate a BERT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will ...
2
1
37
1
36
0
1
1.53
1
1
0
0
1
15
1
1
107
11
38
37
17
58
19
18
17
1
1
0
1
783
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/configuration_bert.py
transformers.models.bert.configuration_bert.BertOnnxConfig
from collections.abc import Mapping from ...onnx import OnnxConfig from collections import OrderedDict class BertOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: if self.task == 'multiple-choice': dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequence'}...
class BertOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass
3
0
12
0
12
0
2
0
1
3
0
0
1
0
1
1
14
0
14
4
11
0
6
3
4
2
1
1
2
784
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertAttention
from ...cache_utils import Cache, EncoderDecoderCache import torch from torch import nn from ...processing_utils import Unpack from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from typing import Callable, Optional, Union from ...utils import ModelOutput, Trans...
class BertAttention(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]=None, he...
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
785
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertEmbeddings
from typing import Callable, Optional, Union from torch import nn import torch class BertEmbeddings(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, co...
class BertEmbeddings(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]=N...
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
786
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertEncoder
from ...cache_utils import Cache, EncoderDecoderCache import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOut...
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
787
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForMaskedLM
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from ...utils.generic import can_return_tuple, check_model_inputs from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...processing_utils import Unp...
@auto_docstring class BertForMaskedLM(BertPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor...
11
2
18
2
14
2
2
0.11
1
7
3
0
5
2
5
6
105
17
80
33
52
9
36
18
30
5
2
1
11
788
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForMultipleChoice
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput f...
@auto_docstring class BertForMultipleChoice(BertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: ...
6
1
39
5
31
4
7
0.1
1
5
2
0
2
3
2
3
85
10
68
28
47
7
29
15
26
11
2
1
13
789
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForNextSentencePrediction
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from ...utils.generic import can_return_tuple, check_model_inputs from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...processing_utils import Unp...
@auto_docstring(custom_intro='\n Bert Model with a `next sentence prediction (classification)` head on top.\n ') class BertForNextSentencePrediction(BertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]...
6
1
46
9
27
11
4
0.39
1
7
3
0
2
2
2
3
96
18
56
25
38
22
22
11
19
6
2
1
7
790
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForPreTraining
import torch from ...processing_utils import Unpack from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils.generic import can_return_tuple, check_model_inputs from typing import Callable, Optional, Union from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_av...
@auto_docstring(custom_intro='\n Bert Model with two heads on top as done during the pretraining: a `masked language modeling` head and a `next\n sentence prediction (classification)` head.\n ') class BertForPreTraining(BertPreTrainedModel): def __init__(self, config): pass def get_output_emb...
8
1
24
4
14
7
2
0.45
1
6
3
0
4
2
4
5
102
18
58
30
38
26
27
16
22
5
2
1
8
791
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForPreTrainingOutput
import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from dataclasses import dataclass @dataclass @auto_docstring(custom_intro='\n Output type of [`BertForPreTraining`].\n ') class BertForPreTrainingO...
@dataclass @auto_docstring(custom_intro='\n Output type of [`BertForPreTraining`].\n ') class BertForPreTrainingOutput(ModelOutput): ''' loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`): Total loss as the sum of the masked language modeling loss and the ne...
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
792
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForQuestionAnswering
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput f...
@auto_docstring class BertForQuestionAnswering(BertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_id...
6
0
41
5
30
7
4
0.18
1
5
2
0
2
3
2
3
94
10
71
30
45
13
32
16
29
7
2
2
8
793
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForSequenceClassification
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput f...
@auto_docstring(custom_intro='\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 ') class BertForSequenceClassification(BertPreTrainedModel): def __init__(self, config): pass @can_return_tuple ...
6
1
42
4
35
4
7
0.09
1
6
2
0
2
5
2
3
94
9
78
28
55
7
36
15
33
12
2
3
14
794
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertForTokenClassification
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput f...
@auto_docstring class BertForTokenClassification(BertPreTrainedModel): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_...
6
1
32
4
26
3
4
0.08
1
5
2
0
2
4
2
3
74
9
60
27
37
5
23
14
20
5
2
1
7
795
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertIntermediate
from ...activations import ACT2FN from torch import nn import torch class BertIntermediate(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_ac...
class BertIntermediate(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
796
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertLMHeadModel
from ...utils.generic import can_return_tuple, check_model_inputs from typing import Callable, Optional, Union from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from ...cache_utils import Cache, EncoderDecoderCache import torch from ...modeling_outputs import Ba...
@auto_docstring(custom_intro='\n Bert Model with a `language modeling` head on top for CLM fine-tuning.\n ') class BertLMHeadModel(BertPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embedd...
8
1
21
2
14
5
2
0.29
2
7
3
0
5
2
5
6
117
15
79
34
50
23
33
16
27
6
2
1
12
797
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertLMPredictionHead
import torch from torch import nn class BertLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = BertPredictionHeadTransform(config) self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.bias = nn.Parameter(torch.ze...
class BertLMPredictionHead(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
798
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertLayer
from ...modeling_layers import GradientCheckpointingLayer from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging from typing import Callable, Optional, Union from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer ...
class BertLayer(GradientCheckpointingLayer): def __init__(self, config, layer_idx=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_...
4
0
27
2
23
2
4
0.1
1
7
3
0
3
8
3
13
84
9
70
32
57
7
41
23
37
7
1
2
11
799
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/bert/modeling_bert.py
transformers.models.bert.modeling_bert.BertModel
import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput f...
null
12
2
37
4
25
8
5
0.35
1
8
4
0
5
6
5
6
211
29
135
45
108
47
65
29
59
21
2
2
27