id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
2,700
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitLayer
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from ...utils.deprecation import deprecate_kwarg from ...modeling_layers import GradientCheckpointingLayer from ...cache_utils import Cache, DynamicCache from typing import Callable, Optional, Union import torch...
class GitLayer(GradientCheckpointingLayer): 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: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.Flo...
5
0
15
1
12
1
1
0.08
1
7
4
0
3
5
3
13
47
6
38
24
26
3
21
16
17
1
1
0
3
2,701
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, BaseModelOutputWithPooling, CausalLMOutputWithPast from ...cache_utils import Cache, DynamicCache import torch from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging, torch_int from ...modeling_attn_mask_utils import _prepare...
@auto_docstring(custom_intro='\n The bare GIT Model transformer consisting of a CLIP image encoder and text decoder outputting raw hidden-states\n ') class GitModel(GitPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def set_input_embeddings(se...
10
2
36
5
25
6
4
0.24
1
14
7
0
7
6
7
137
262
43
176
59
152
43
93
43
85
18
3
3
29
2,702
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitOutput
import torch from torch import nn class GitOutput(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(c...
class GitOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
2,703
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitPreTrainedModel
from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging, torch_int from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn from .configuration_git import GitConfig, GitVisionConfig @auto_docstring class GitPreTrainedModel(PreTrainedModel): config: GitConfig ...
@auto_docstring class GitPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
19
0
16
3
7
0.32
1
1
1
3
1
0
1
130
31
2
22
7
20
7
20
7
18
7
2
2
7
2,704
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitProjection
import torch from torch import nn from .configuration_git import GitConfig, GitVisionConfig class GitProjection(nn.Module): def __init__(self, config: GitConfig): super().__init__() self.config = config self.visual_projection = nn.Sequential(nn.Linear(config.vision_config.hidden_size, conf...
class GitProjection(nn.Module): def __init__(self, config: GitConfig): pass def forward(self, embeddings: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
3
1
0
2
2
2
12
11
1
10
5
7
0
7
5
4
1
1
0
2
2,705
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitSelfAttention
import torch from ...utils.deprecation import deprecate_kwarg import math from ...cache_utils import Cache, DynamicCache from typing import Callable, Optional, Union from torch import nn class GitSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None, layer_idx=None): super().__...
class GitSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None, layer_idx=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.FloatTensor]=None, head_mas...
4
0
37
6
29
3
5
0.09
1
6
1
0
3
12
3
13
115
19
89
44
77
8
66
36
62
10
1
2
16
2,706
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitSelfOutput
from torch import nn import torch class GitSelfOutput(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(con...
class GitSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
2,707
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitVisionAttention
from typing import Callable, Optional, Union import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn class GitVisionAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__init__() ...
class GitVisionAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, causal_attention_mask: Optional[torch.Tensor]=None, output_attentio...
3
2
32
5
25
2
4
0.11
1
5
0
0
3
10
3
13
102
19
75
30
65
8
54
24
50
8
1
2
11
2,708
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitVisionEmbeddings
from .configuration_git import GitConfig, GitVisionConfig from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging, torch_int import torch from torch import nn class GitVisionEmbeddings(nn.Module): def __init__(self, config: GitVisionConfig): super().__init__() self.config = con...
class GitVisionEmbeddings(nn.Module): def __init__(self, config: GitVisionConfig): pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor: ''' This method allows to interpolate the pre-trained position encodings, to be able to use th...
4
1
26
5
19
3
2
0.16
1
5
1
0
3
9
3
13
81
16
57
27
53
9
43
27
39
3
1
1
6
2,709
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitVisionEncoder
import torch from .configuration_git import GitConfig, GitVisionConfig from typing import Callable, Optional, Union from torch import nn from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging, torch_int from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, BaseModelOutputWithPoo...
class GitVisionEncoder(nn.Module): ''' Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a [`GitVisionEncoderLayer`]. Args: config: GitVisionConfig ''' def __init__(self, config: GitVisionConfig): pass @can_return_tuple de...
4
2
43
5
25
13
7
0.61
1
9
3
0
2
3
2
12
95
13
51
19
40
31
27
11
24
12
1
2
13
2,710
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitVisionEncoderLayer
from ...modeling_layers import GradientCheckpointingLayer from .configuration_git import GitConfig, GitVisionConfig import torch from typing import Callable, Optional, Union from torch import nn class GitVisionEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: GitVisionConfig): super()._...
class GitVisionEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: GitVisionConfig): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]: ''...
3
1
23
3
16
5
2
0.31
1
6
3
0
2
5
2
12
48
6
32
17
23
10
21
11
18
2
1
1
3
2,711
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitVisionMLP
from ...activations import ACT2FN import torch from torch import nn class GitVisionMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.activation_fn = ACT2FN[config.hidden_act] self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size) ...
class GitVisionMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
1
0
1
2
0
0
2
4
2
12
13
1
12
7
9
0
12
7
9
1
1
0
2
2,712
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitVisionModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, BaseModelOutputWithPooling, CausalLMOutputWithPast from .configuration_git import GitConfig, GitVisionConfig from typing import Callable, Optional, Union from torch import nn from ...utils import ModelOutput, auto_docstring, can_return_tuple, log...
@auto_docstring(custom_intro='\n The vision model from CLIP, used in GIT, without any head or projection on top.\n ') class GitVisionModel(GitPreTrainedModel): def __init__(self, config: GitVisionConfig): pass def get_input_embeddings(self) -> nn.Module: pass @auto_docstring def ...
6
1
15
2
7
5
1
0.63
1
5
3
0
3
1
3
133
54
10
27
15
14
17
12
7
8
2
3
0
4
2,713
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py
transformers.models.git.modeling_git.GitVisionTransformer
from torch import nn from .configuration_git import GitConfig, GitVisionConfig import torch from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging, torch_int from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, BaseModelOutputWithPooling, CausalLMOutputWithPast from typing impo...
class GitVisionTransformer(nn.Module): def __init__(self, config: GitVisionConfig): pass @auto_docstring def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, interpolate_pos_encoding: Optional[bool]=Fal...
4
0
26
5
20
2
4
0.09
1
7
4
0
2
5
2
12
57
10
43
20
31
4
23
12
20
6
1
1
7
2,714
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/git/processing_git.py
transformers.models.git.processing_git.GitProcessor
from ...processing_utils import ProcessorMixin class GitProcessor(ProcessorMixin): """ Constructs a GIT processor which wraps a CLIP image processor and a BERT tokenizer into a single processor. [`GitProcessor`] offers all the functionalities of [`CLIPImageProcessor`] and [`BertTokenizerFast`]. See the ...
class GitProcessor(ProcessorMixin): ''' Constructs a GIT processor which wraps a CLIP image processor and a BERT tokenizer into a single processor. [`GitProcessor`] offers all the functionalities of [`CLIPImageProcessor`] and [`BertTokenizerFast`]. See the [`~GitProcessor.__call__`] and [`~GitProcessor...
2
1
18
2
9
7
2
0.96
1
4
2
0
5
1
5
22
114
18
49
23
35
47
32
15
26
6
2
2
10
2,715
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/configuration_glm.py
transformers.models.glm.configuration_glm.GlmConfig
from ...configuration_utils import PretrainedConfig class GlmConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GlmModel`]. It is used to instantiate an Glm model according to the specified arguments, defining the model architecture. Instantiating a configuratio...
class GlmConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GlmModel`]. It is used to instantiate an Glm model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configu...
2
1
48
1
47
0
1
1.14
1
1
0
0
1
16
1
1
125
3
58
44
33
66
22
21
20
1
1
0
1
2,716
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmAttention
from ...processing_utils import Unpack from ...utils.deprecation import deprecate_kwarg import torch.nn as nn from .configuration_glm import GlmConfig from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTraine...
class GlmAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: GlmConfig, 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.Te...
4
1
34
4
30
1
3
0.03
1
6
3
1
2
11
2
12
72
9
61
31
50
2
34
23
31
5
1
2
6
2,717
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmDecoderLayer
from ...processing_utils import Unpack from typing import Callable, Optional, Union from .configuration_glm import GlmConfig import torch.nn as nn from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer from ...utils.deprecation import deprecate_kwarg f...
class GlmDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: GlmConfig, layer_idx: int): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Op...
4
0
25
4
21
2
2
0.07
1
10
6
0
2
5
2
12
52
8
42
22
28
3
21
11
18
2
1
1
3
2,718
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmForCausalLM
from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from ...processing_utils import Unpack from ...utils import TransformersKwargs, auto_docstring, can_return_tuple import torch from ...generation imp...
@auto_docstring class GlmForCausalLM(GlmPreTrainedModel, GenerationMixin): def __init__(self, config): pass @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None,...
6
1
14
2
9
4
2
0.38
2
9
4
0
8
3
8
9
123
21
74
36
47
28
36
20
27
8
2
1
15
2,719
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmForSequenceClassification
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class GlmForSequenceClassification(GenericForSequenceClassification, GlmPreTrainedModel): pass
class GlmForSequenceClassification(GenericForSequenceClassification, GlmPreTrainedModel): pass
1
0
21
2
17
2
3
0.11
1
7
3
0
4
3
4
5
90
11
71
31
53
8
36
18
31
9
2
1
12
2,720
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmForTokenClassification
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class GlmForTokenClassification(GenericForTokenClassification, GlmPreTrainedModel): pass
class GlmForTokenClassification(GenericForTokenClassification, GlmPreTrainedModel): pass
1
0
17
1
14
2
3
0.11
1
5
2
0
4
4
4
5
79
8
64
28
41
7
29
15
24
5
2
1
10
2,721
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmMLP
import torch import torch.nn as nn from ...activations import ACT2FN class GlmMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.gate_up_proj = nn.Linear(config.hidden_size, 2 * config.intermediate_size, bias=False) self.down_proj = nn.Linear(c...
class GlmMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: pass
3
0
7
2
6
0
1
0
1
1
0
0
2
4
2
12
16
4
12
9
9
0
12
9
9
1
1
0
2
2,722
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmModel
from ...cache_utils import Cache, DynamicCache from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from .configuration_glm import GlmConfig from ...masking_utils import create_causal_mask from ...utils.generic impo...
@auto_docstring class GlmModel(GlmPreTrainedModel): def __init__(self, config: GlmConfig): pass @check_model_inputs @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_...
6
0
40
5
30
6
6
0.22
1
16
10
0
5
7
6
7
257
34
184
65
146
40
89
34
82
21
2
2
37
2,723
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmPreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from .configuration_glm import GlmConfig @auto_docstring class GlmPreTrainedModel(PreTrainedModel): config: GlmConfig base_model_prefix = 'model' supports_gradien...
@auto_docstring class GlmPreTrainedModel(PreTrainedModel): pass
2
0
10
0
10
0
5
0
1
0
0
4
1
0
1
1
24
1
23
15
21
0
22
15
20
5
1
2
5
2,724
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmRMSNorm
import torch.nn as nn from ...integrations import use_kernel_forward_from_hub import torch @use_kernel_forward_from_hub('RMSNorm') class GlmRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ GlmRMSNorm is equivalent to T5LayerNorm """ super().__init__() sel...
@use_kernel_forward_from_hub('RMSNorm') class GlmRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' GlmRMSNorm is equivalent to T5LayerNorm ''' pass def forward(self, hidden_states): pass def extra_repr(self): pass
5
1
5
0
4
1
1
0.23
1
2
0
0
3
2
3
13
18
2
13
8
9
3
13
8
9
1
1
0
3
2,725
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modeling_glm.py
transformers.models.glm.modeling_glm.GlmRotaryEmbedding
from .configuration_glm import GlmConfig import torch.nn as nn from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update import torch class GlmRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: GlmConfig, device=None): super().__init__() if hasattr(...
class GlmRotaryEmbedding(nn.Module): def __init__(self, config: GlmConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
18
2
13
5
3
0.35
1
4
1
1
3
7
3
13
59
8
40
21
35
14
38
20
34
3
1
1
8
2,726
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modular_glm.py
transformers.models.glm.modular_glm.GlmAttention
import torch.nn as nn from .configuration_glm import GlmConfig from typing import Optional from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification class GlmAttention(LlamaAttention): def __init__(self, config: GlmConfig, layer_idx: Optional[...
class GlmAttention(LlamaAttention): def __init__(self, config: GlmConfig, layer_idx: Optional[int]=None): pass
2
0
3
0
3
0
1
0
1
3
1
0
1
2
1
13
4
0
4
3
2
0
4
3
2
1
2
0
1
2,727
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modular_glm.py
transformers.models.glm.modular_glm.GlmForCausalLM
from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification class GlmForCausalLM(LlamaForCausalLM): pass
class GlmForCausalLM(LlamaForCausalLM): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
9
2
0
2
1
1
0
2
1
1
0
3
0
0
2,728
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modular_glm.py
transformers.models.glm.modular_glm.GlmForSequenceClassification
from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification class GlmForSequenceClassification(LlamaForSequenceClassification): pass
class GlmForSequenceClassification(LlamaForSequenceClassification): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
2,729
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modular_glm.py
transformers.models.glm.modular_glm.GlmForTokenClassification
from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification class GlmForTokenClassification(LlamaForTokenClassification): pass
class GlmForTokenClassification(LlamaForTokenClassification): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
2,730
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glm/modular_glm.py
transformers.models.glm.modular_glm.GlmMLP
from ..phi3.modeling_phi3 import Phi3MLP class GlmMLP(Phi3MLP): pass
class GlmMLP(Phi3MLP): 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
2,731
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/configuration_glpn.py
transformers.models.glpn.configuration_glpn.GLPNConfig
from ...configuration_utils import PretrainedConfig class GLPNConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GLPNModel`]. It is used to instantiate an GLPN model according to the specified arguments, defining the model architecture. Instantiating a configura...
class GLPNConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GLPNModel`]. It is used to instantiate an GLPN model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar conf...
2
1
42
1
41
0
1
1.3
1
1
0
0
1
18
1
1
109
10
43
42
20
56
22
21
20
1
1
0
1
2,732
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/feature_extraction_glpn.py
transformers.models.glpn.feature_extraction_glpn.GLPNFeatureExtractor
from ...utils.import_utils import requires import warnings from .image_processing_glpn import GLPNImageProcessor @requires(backends=('vision',)) class GLPNFeatureExtractor(GLPNImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class GLPNFeatureExtractor is deprecated and will...
@requires(backends=('vision',)) class GLPNFeatureExtractor(GLPNImageProcessor): def __init__(self, *args, **kwargs) -> None: pass
3
0
7
0
7
0
1
0
1
2
0
0
1
0
1
25
8
0
8
2
6
0
4
2
2
1
4
0
1
2,733
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/image_processing_glpn.py
transformers.models.glpn.image_processing_glpn.GLPNImageProcessor
from ...utils import TensorType, filter_out_non_signature_kwargs, logging, requires_backends from ...utils.import_utils import requires from ...image_transforms import resize, to_channel_dimension_format from ...image_utils import ChannelDimension, PILImageResampling, get_image_size, infer_channel_dimension_format, is_...
@requires(backends=('vision',)) class GLPNImageProcessor(BaseImageProcessor): ''' Constructs a GLPN image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions, rounding them down to the closest multiple of ...
7
4
49
5
25
19
4
0.89
1
8
2
1
4
4
4
24
221
27
103
47
68
92
49
17
44
10
3
2
17
2,734
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNAttention
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer from torch import nn class GLPNAttention(nn.Module): def __init__(self, config, hidden_size, num_attention_heads, sequence_reduction_ratio): super().__init__() self.self = GLPNEfficientSelfAttention(config=config, hi...
class GLPNAttention(nn.Module): def __init__(self, config, hidden_size, num_attention_heads, sequence_reduction_ratio): pass def prune_heads(self, heads): pass def forward(self, hidden_states, height, width, output_attentions=False): pass
4
0
11
1
9
1
1
0.1
1
4
2
0
3
3
3
13
36
5
29
11
25
3
22
11
18
2
1
1
4
2,735
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNDWConv
from torch import nn class GLPNDWConv(nn.Module): def __init__(self, dim=768): super().__init__() self.dwconv = nn.Conv2d(dim, dim, 3, 1, 1, bias=True, groups=dim) def forward(self, hidden_states, height, width): batch_size, seq_len, num_channels = hidden_states.shape hidden_s...
class GLPNDWConv(nn.Module): def __init__(self, dim=768): pass def forward(self, hidden_states, height, width): pass
3
0
5
1
5
0
1
0
1
1
0
0
2
1
2
12
12
2
10
5
7
0
10
5
7
1
1
0
2
2,736
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNDecoder
import torch from torch import nn class GLPNDecoder(nn.Module): def __init__(self, config): super().__init__() reserved_hidden_sizes = config.hidden_sizes[::-1] out_channels = config.decoder_hidden_size self.stages = nn.ModuleList([GLPNDecoderStage(hidden_size, out_channels) for hi...
class GLPNDecoder(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: list[torch.Tensor]) -> list[torch.Tensor]: pass
3
0
12
2
9
1
2
0.11
1
4
1
0
2
2
2
12
25
5
18
10
15
2
16
10
13
2
1
1
3
2,737
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNDecoderStage
from torch import nn class GLPNDecoderStage(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() should_skip = in_channels == out_channels self.convolution = nn.Conv2d(in_channels, out_channels, kernel_size=1) if not should_skip else nn.Identity() self.fusi...
class GLPNDecoderStage(nn.Module): def __init__(self, in_channels, out_channels): pass def forward(self, hidden_state, residual=None): pass
3
0
8
1
7
0
2
0
1
2
1
0
2
3
2
12
18
3
15
7
12
0
15
7
12
2
1
1
4
2,738
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNDepthEstimationHead
import torch from torch import nn class GLPNDepthEstimationHead(nn.Module): def __init__(self, config): super().__init__() self.config = config channels = config.decoder_hidden_size self.head = nn.Sequential(nn.Conv2d(channels, channels, kernel_size=3, stride=1, padding=1), nn.ReLU...
class GLPNDepthEstimationHead(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: list[torch.Tensor]) -> torch.Tensor: pass
3
0
11
3
8
1
1
0.06
1
2
0
0
2
2
2
12
23
6
16
7
13
1
12
7
9
1
1
0
2
2,739
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNDropPath
import torch from torch import nn from typing import Optional, Union class GLPNDropPath(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_prob = dr...
class GLPNDropPath(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
2,740
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNEfficientSelfAttention
from torch import nn import math import torch class GLPNEfficientSelfAttention(nn.Module): """SegFormer's efficient self-attention mechanism. Employs the sequence reduction process introduced in the [PvT paper](https://huggingface.co/papers/2102.12122).""" def __init__(self, config, hidden_size, num_atten...
class GLPNEfficientSelfAttention(nn.Module): '''SegFormer's efficient self-attention mechanism. Employs the sequence reduction process introduced in the [PvT paper](https://huggingface.co/papers/2102.12122).''' def __init__(self, config, hidden_size, num_attention_heads, sequence_reduction_ratio): ...
3
1
24
5
17
2
2
0.17
1
3
0
0
3
11
3
13
79
18
52
31
42
9
41
25
37
3
1
1
7
2,741
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNEncoder
from ...modeling_outputs import BaseModelOutput, DepthEstimatorOutput from torch import nn import torch class GLPNEncoder(nn.Module): def __init__(self, config): super().__init__() self.config = config dpr = [x.item() for x in torch.linspace(0, config.drop_path_rate, sum(config.depths), de...
class GLPNEncoder(nn.Module): def __init__(self, config): pass def forward(self, pixel_values, output_attentions=False, output_hidden_states=False, return_dict=True): pass
3
0
42
4
34
5
7
0.13
1
8
3
0
2
4
2
12
86
9
68
29
59
9
40
23
37
8
1
3
14
2,742
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNForDepthEstimation
from ...utils import auto_docstring, logging import torch from ...modeling_outputs import BaseModelOutput, DepthEstimatorOutput from typing import Optional, Union @auto_docstring(custom_intro='\n GLPN Model transformer with a lightweight depth estimation head on top e.g. for KITTI, NYUv2.\n ') class GLPNForDepth...
@auto_docstring(custom_intro='\n GLPN Model transformer with a lightweight depth estimation head on top e.g. for KITTI, NYUv2.\n ') class GLPNForDepthEstimation(GLPNPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, pixel_values: torch.FloatTensor, labels: Op...
5
1
46
9
22
16
5
0.7
1
8
5
0
2
3
2
3
95
18
46
21
34
32
24
13
21
9
2
2
10
2,743
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNLayer
from torch import nn class GLPNLayer(nn.Module): """This corresponds to the Block class in the original implementation.""" def __init__(self, config, hidden_size, num_attention_heads, drop_path, sequence_reduction_ratio, mlp_ratio): super().__init__() self.layer_norm_1 = nn.LayerNorm(hidden_si...
class GLPNLayer(nn.Module): '''This corresponds to the Block class in the original implementation.''' def __init__(self, config, hidden_size, num_attention_heads, drop_path, sequence_reduction_ratio, mlp_ratio): pass def forward(self, hidden_states, height, width, output_attentions=False): ...
3
1
19
3
15
2
2
0.17
1
5
3
0
2
5
2
12
41
8
30
14
27
5
20
14
17
2
1
0
3
2,744
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNMixFFN
from torch import nn from ...activations import ACT2FN class GLPNMixFFN(nn.Module): def __init__(self, config, in_features, hidden_features=None, out_features=None): super().__init__() out_features = out_features or in_features self.dense1 = nn.Linear(in_features, hidden_features) ...
class GLPNMixFFN(nn.Module): def __init__(self, config, in_features, hidden_features=None, out_features=None): pass def forward(self, hidden_states, height, width): pass
3
0
10
0
10
0
2
0
1
3
1
0
2
5
2
12
21
1
20
8
17
0
19
8
16
2
1
1
3
2,745
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNModel
from typing import Optional, Union from ...utils import auto_docstring, logging import torch from ...modeling_outputs import BaseModelOutput, DepthEstimatorOutput @auto_docstring class GLPNModel(GLPNPreTrainedModel): def __init__(self, config): super().__init__(config) self.config = config ...
@auto_docstring class GLPNModel(GLPNPreTrainedModel): def __init__(self, config): pass def _prune_heads(self, heads_to_prune): ''' Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} See base class PreTrainedModel ...
6
1
15
2
11
2
3
0.19
1
4
2
0
3
2
3
4
58
7
43
16
25
8
18
9
14
5
2
1
8
2,746
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNOverlapPatchEmbeddings
from torch import nn class GLPNOverlapPatchEmbeddings(nn.Module): """Construct the overlapping patch embeddings.""" def __init__(self, patch_size, stride, num_channels, hidden_size): super().__init__() self.proj = nn.Conv2d(num_channels, hidden_size, kernel_size=patch_size, stride=stride, padd...
class GLPNOverlapPatchEmbeddings(nn.Module): '''Construct the overlapping patch embeddings.''' def __init__(self, patch_size, stride, num_channels, hidden_size): pass def forward(self, pixel_values): pass
3
1
10
1
8
1
1
0.18
1
1
0
0
2
2
2
12
23
3
17
7
14
3
11
7
8
1
1
0
2
2,747
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNPreTrainedModel
from torch import nn from ...modeling_utils import PreTrainedModel from ...utils import auto_docstring, logging from .configuration_glpn import GLPNConfig @auto_docstring class GLPNPreTrainedModel(PreTrainedModel): config: GLPNConfig base_model_prefix = 'glpn' main_input_name = 'pixel_values' _no_split...
@auto_docstring class GLPNPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.47
1
0
0
2
1
0
1
1
27
2
17
6
15
8
15
6
13
6
1
2
6
2,748
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNSelectiveFeatureFusion
import torch from torch import nn class GLPNSelectiveFeatureFusion(nn.Module): """ Selective Feature Fusion module, as explained in the [paper](https://huggingface.co/papers/2201.07436) (section 3.4). This module adaptively selects and integrates local and global features by attaining an attention map for ...
class GLPNSelectiveFeatureFusion(nn.Module): ''' Selective Feature Fusion module, as explained in the [paper](https://huggingface.co/papers/2201.07436) (section 3.4). This module adaptively selects and integrates local and global features by attaining an attention map for each feature. ''' def __i...
3
1
18
3
13
2
1
0.3
1
2
0
0
2
4
2
12
42
7
27
10
24
8
15
10
12
1
1
0
2
2,749
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.GLPNSelfOutput
from torch import nn class GLPNSelfOutput(nn.Module): def __init__(self, config, hidden_size): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_prob) def forward(self, hidden_states, input_tensor): hidden_state...
class GLPNSelfOutput(nn.Module): def __init__(self, config, hidden_size): pass def forward(self, hidden_states, input_tensor): pass
3
0
4
0
4
0
1
0
1
1
0
0
2
2
2
12
10
1
9
5
6
0
9
5
6
1
1
0
2
2,750
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/glpn/modeling_glpn.py
transformers.models.glpn.modeling_glpn.SiLogLoss
import torch from torch import nn class SiLogLoss(nn.Module): """ Implements the Scale-invariant log scale loss [Eigen et al., 2014](https://huggingface.co/papers/1406.2283). $$L=\\frac{1}{n} \\sum_{i} d_{i}^{2}-\\frac{1}{2 n^{2}}\\left(\\sum_{i} d_{i}^{2}\\right)$$ where $d_{i}=\\log y_{i}-\\log y_{i...
class SiLogLoss(nn.Module): ''' Implements the Scale-invariant log scale loss [Eigen et al., 2014](https://huggingface.co/papers/1406.2283). $$L=\frac{1}{n} \sum_{i} d_{i}^{2}-\frac{1}{2 n^{2}}\left(\sum_{i} d_{i}^{2}\right)$$ where $d_{i}=\log y_{i}-\log y_{i}^{*}$. ''' def __init__(self, lam...
3
1
5
1
4
0
1
0.56
1
1
0
0
2
1
2
12
19
5
9
7
6
5
9
7
6
1
1
0
2
2,751
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/convert_got_ocr2_weights_to_hf.py
transformers.models.got_ocr2.convert_got_ocr2_weights_to_hf.GotOcr2Converter
from transformers import GotOcr2Config, GotOcr2ForConditionalGeneration, GotOcr2ImageProcessor, GotOcr2Processor, PreTrainedTokenizerFast, is_vision_available from transformers.convert_slow_tokenizer import TikTokenConverter from typing import Optional class GotOcr2Converter(TikTokenConverter): def __init__(self,...
class GotOcr2Converter(TikTokenConverter): def __init__(self, vocab_file, special_tokens: list[str], pattern: str, model_max_length: int, chat_template: Optional[str]=None, **kwargs): pass
2
0
20
0
20
0
2
0
1
4
0
0
1
2
1
5
21
0
21
13
11
0
8
5
6
2
1
1
2
2,752
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/image_processing_got_ocr2.py
transformers.models.got_ocr2.image_processing_got_ocr2.GotOcr2ImageProcessor
from ...image_transforms import convert_to_rgb, resize, to_channel_dimension_format import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging from typing import Optional, Union f...
class GotOcr2ImageProcessor(BaseImageProcessor): ''' Constructs a GOT_OCR2 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 `do_resize` parame...
7
5
76
6
44
27
8
0.78
1
10
2
0
4
9
4
24
346
31
177
80
127
138
88
35
83
17
3
3
33
2,753
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2CausalLMOutputWithPast
import torch.nn.functional as F import torch.nn as nn from dataclasses import dataclass from typing import Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput import torch from ...cache_utils import Cache @datacl...
@dataclass @auto_docstring(custom_intro='\n Base class for GotOcr2 causal language model (or autoregressive) outputs.\n ') class GotOcr2CausalLMOutputWithPast(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for n...
3
1
0
0
0
0
0
3.57
1
0
0
0
0
0
0
0
37
5
7
7
6
25
7
7
6
0
1
0
0
2,754
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2ForConditionalGeneration
import torch.nn.functional as F from typing import Optional, Union from .configuration_got_ocr2 import GotOcr2Config, GotOcr2VisionConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple import torch from ...processing_utils import Unpack import torch.nn as nn from ...cache_utils import Cache f...
@auto_docstring(custom_intro='\n The GOT_OCR2 model which consists of a vision backbone and a language model.\n ') class GotOcr2ForConditionalGeneration(GotOcr2PreTrainedModel, GenerationMixin): def __init__(self, config: GotOcr2Config): pass def get_input_embeddings(self): pass def...
19
1
26
3
17
6
3
0.34
2
10
5
0
11
6
11
12
301
47
190
81
148
65
109
52
97
14
2
2
32
2,755
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2LayerNorm
import torch import torch.nn.functional as F import torch.nn as nn class GotOcr2LayerNorm(nn.LayerNorm): """LayerNorm that supports two data formats: channels_last (default) or channels_first. The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height, ...
class GotOcr2LayerNorm(nn.LayerNorm): '''LayerNorm that supports two data formats: channels_last (default) or channels_first. The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height, width, channels) while channels_first corresponds to inputs with sh...
3
2
11
0
11
0
3
0.18
1
3
0
0
2
5
2
12
28
2
22
11
19
4
21
11
18
3
1
1
5
2,756
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2MLPBlock
from ...activations import ACT2FN import torch.nn as nn import torch.nn.functional as F import torch class GotOcr2MLPBlock(nn.Module): def __init__(self, config): super().__init__() self.lin1 = nn.Linear(config.hidden_size, config.mlp_dim) self.lin2 = nn.Linear(config.mlp_dim, config.hidde...
class GotOcr2MLPBlock(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
2,757
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2MultiModalProjector
import torch import torch.nn.functional as F from .configuration_got_ocr2 import GotOcr2Config, GotOcr2VisionConfig import torch.nn as nn class GotOcr2MultiModalProjector(nn.Module): def __init__(self, config: GotOcr2Config): super().__init__() vision_output_channels = config.vision_config.output_...
class GotOcr2MultiModalProjector(nn.Module): def __init__(self, config: GotOcr2Config): pass def forward(self, vision_embeddings: torch.Tensor) -> torch.Tensor: pass
3
0
9
0
9
0
1
0
1
3
1
0
2
3
2
12
19
1
18
9
15
0
14
9
11
1
1
0
2
2,758
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2PatchEmbeddings
import collections import torch.nn as nn class GotOcr2PatchEmbeddings(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...
class GotOcr2PatchEmbeddings(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
13
1
12
0
3
0.2
1
2
0
0
2
5
2
12
33
3
25
13
22
5
21
13
18
3
1
1
6
2,759
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2PreTrainedModel
from .configuration_got_ocr2 import GotOcr2Config, GotOcr2VisionConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...modeling_utils import PreTrainedModel @auto_docstring class GotOcr2PreTrainedModel(PreTrainedModel): config: GotOcr2Config base_model_prefix = '' supports...
@auto_docstring class GotOcr2PreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
21
2
16
3
7
0.12
1
0
0
1
1
0
1
1
31
3
25
11
23
3
20
11
18
7
1
2
7
2,760
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2VisionAttention
import torch.nn.functional as F import torch import torch.nn as nn class GotOcr2VisionAttention(nn.Module): """Multi-head Attention block with relative position embeddings.""" def __init__(self, config, window_size): super().__init__() input_size = (config.image_size // config.patch_size, conf...
class GotOcr2VisionAttention(nn.Module): '''Multi-head Attention block with relative position embeddings.''' def __init__(self, config, window_size): pass def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor) -> torch.Tensor: ''' Get relative positional embeddings...
5
3
33
5
19
10
2
0.51
1
4
0
0
4
8
4
14
138
23
76
43
63
39
53
35
48
4
1
2
9
2,761
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2VisionEncoder
from .configuration_got_ocr2 import GotOcr2Config, GotOcr2VisionConfig import torch.nn as nn import torch.nn.functional as F from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from typing import Optional, Union from ...processing_utils import Unpack from transformers.utils.generic import check_mo...
class GotOcr2VisionEncoder(GotOcr2PreTrainedModel): def __init__(self, config: GotOcr2VisionConfig): pass def get_input_embeddings(self): pass @check_model_inputs def forward(self, pixel_values: Optional[torch.FloatTensor]=None, **kwargs: Unpack[TransformersKwargs]) -> GotOcr2VisionEn...
5
0
30
5
24
0
7
0.01
1
10
5
0
3
7
3
13
93
18
74
25
64
1
48
19
44
16
1
2
21
2,762
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2VisionLayer
import torch.nn as nn from ...modeling_layers import GradientCheckpointingLayer import torch import torch.nn.functional as F class GotOcr2VisionLayer(GradientCheckpointingLayer): def __init__(self, config, window_size): super().__init__() self.layer_norm1 = nn.LayerNorm(config.hidden_size, eps=con...
class GotOcr2VisionLayer(GradientCheckpointingLayer): def __init__(self, config, window_size): pass def window_partition(self, hidden_states: torch.Tensor, window_size: int) -> tuple[torch.Tensor, tuple[int, int]]: ''' Args: Partition into non-overlapping windows with padding ...
5
2
22
3
14
6
2
0.43
1
6
2
0
4
5
4
14
93
13
56
31
45
24
41
25
36
4
1
1
7
2,763
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modeling_got_ocr2.py
transformers.models.got_ocr2.modeling_got_ocr2.GotOcr2VisionNeck
from .configuration_got_ocr2 import GotOcr2Config, GotOcr2VisionConfig import torch.nn as nn class GotOcr2VisionNeck(nn.Module): def __init__(self, config: GotOcr2VisionConfig): super().__init__() self.config = config self.conv1 = nn.Conv2d(config.hidden_size, config.output_channels, kerne...
class GotOcr2VisionNeck(nn.Module): def __init__(self, config: GotOcr2VisionConfig): pass def forward(self, hidden_states): pass
3
0
8
1
7
0
1
0
1
3
2
0
2
5
2
12
18
3
15
8
12
0
15
8
12
1
1
0
2
2,764
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2CausalLMOutputWithPast
from ..llava.modeling_llava import LlavaCausalLMOutputWithPast, LlavaForConditionalGeneration, LlavaModel, LlavaModelOutputWithPast, LlavaPreTrainedModel, TransformersKwargs class GotOcr2CausalLMOutputWithPast(LlavaCausalLMOutputWithPast): pass
class GotOcr2CausalLMOutputWithPast(LlavaCausalLMOutputWithPast): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
2
0
0
2,765
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2Config
from ..auto import CONFIG_MAPPING, AutoConfig from ...configuration_utils import PretrainedConfig class GotOcr2Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GotOcr2ForConditionalGeneration`]. It is used to instantiate a GotOcr2 model according to the specif...
class GotOcr2Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GotOcr2ForConditionalGeneration`]. It is used to instantiate a GotOcr2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the default...
2
1
50
4
46
0
7
0.59
1
3
1
0
1
6
1
33
92
14
49
19
38
29
18
10
16
7
2
1
7
2,766
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2ForConditionalGeneration
from ..llava.modeling_llava import LlavaCausalLMOutputWithPast, LlavaForConditionalGeneration, LlavaModel, LlavaModelOutputWithPast, LlavaPreTrainedModel, TransformersKwargs from ...utils import auto_docstring, can_return_tuple, logging from ...cache_utils import Cache from typing import Optional, Union from ...process...
class GotOcr2ForConditionalGeneration(LlavaForConditionalGeneration): @can_return_tuple @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, pixel_values: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, ...
4
1
55
8
31
16
6
0.48
1
11
5
0
3
6
3
17
170
26
97
42
73
47
50
23
46
14
3
2
17
2,767
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2MLPBlock
from ..sam.modeling_sam import SamMLPBlock, SamPreTrainedModel, SamVisionAttention, SamVisionEncoder, SamVisionLayer class GotOcr2MLPBlock(SamMLPBlock): pass
class GotOcr2MLPBlock(SamMLPBlock): 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
2,768
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2MultiModalProjector
import torch.nn as nn import torch class GotOcr2MultiModalProjector(nn.Module): def __init__(self, config: GotOcr2Config): super().__init__() vision_output_channels = config.vision_config.output_channels language_hidden_size = config.text_config.hidden_size self.conv_upsampler1 = n...
class GotOcr2MultiModalProjector(nn.Module): def __init__(self, config: GotOcr2Config): pass def forward(self, vision_embeddings: torch.Tensor) -> torch.Tensor: pass
3
0
9
0
9
0
1
0
1
3
1
0
2
3
2
12
19
1
18
9
15
0
14
9
11
1
1
0
2
2,769
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2PreTrainedModel
from ..sam.modeling_sam import SamMLPBlock, SamPreTrainedModel, SamVisionAttention, SamVisionEncoder, SamVisionLayer class GotOcr2PreTrainedModel(SamPreTrainedModel): pass
class GotOcr2PreTrainedModel(SamPreTrainedModel): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
2
0
2
1
1
0
2
1
1
0
2
0
0
2,770
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2VisionAttention
from ..sam.modeling_sam import SamMLPBlock, SamPreTrainedModel, SamVisionAttention, SamVisionEncoder, SamVisionLayer class GotOcr2VisionAttention(SamVisionAttention): pass
class GotOcr2VisionAttention(SamVisionAttention): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
14
2
0
2
1
1
0
2
1
1
0
2
0
0
2,771
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2VisionConfig
from ...configuration_utils import PretrainedConfig class GotOcr2VisionConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GotOcr2VisionModel`]. It is used to instantiate a GOT_OCR2 vision encoder according to the specified arguments, defining the model architect...
class GotOcr2VisionConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GotOcr2VisionModel`]. It is used to instantiate a GOT_OCR2 vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration defaults will...
2
1
40
1
39
0
1
1.05
1
1
0
0
1
17
1
33
89
5
41
40
19
43
21
20
19
1
2
0
1
2,772
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2VisionEncoder
from ..sam.modeling_sam import SamMLPBlock, SamPreTrainedModel, SamVisionAttention, SamVisionEncoder, SamVisionLayer class GotOcr2VisionEncoder(SamVisionEncoder, GotOcr2PreTrainedModel): pass
class GotOcr2VisionEncoder(SamVisionEncoder, GotOcr2PreTrainedModel): 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
2,773
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/modular_got_ocr2.py
transformers.models.got_ocr2.modular_got_ocr2.GotOcr2VisionLayer
from ..sam.modeling_sam import SamMLPBlock, SamPreTrainedModel, SamVisionAttention, SamVisionEncoder, SamVisionLayer import torch.nn as nn class GotOcr2VisionLayer(SamVisionLayer): def __init__(self, config, window_size): super().__init__(config, window_size) self.layer_norm1 = nn.LayerNorm(config...
class GotOcr2VisionLayer(SamVisionLayer): def __init__(self, config, window_size): pass
2
0
7
0
7
0
1
0
1
3
2
0
1
5
1
15
8
0
8
7
6
0
8
7
6
1
2
0
1
2,774
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/processing_got_ocr2.py
transformers.models.got_ocr2.processing_got_ocr2.GotOcr2ImagesKwargs
from transformers.processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack from typing import Optional, Union class GotOcr2ImagesKwargs(ImagesKwargs, total=False): box: Optional[Union[list, tuple[float, float], tuple[float, float, float, float]]] color: Optional[str] num_i...
class GotOcr2ImagesKwargs(ImagesKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
8
0
8
1
7
0
8
1
7
0
2
0
0
2,775
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/processing_got_ocr2.py
transformers.models.got_ocr2.processing_got_ocr2.GotOcr2Processor
from transformers.tokenization_utils_base import PreTokenizedInput, TextInput import numpy as np from ...image_utils import ImageInput from typing import Optional, Union from ...image_processing_utils import BatchFeature from transformers.processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, TextKwarg...
class GotOcr2Processor(ProcessorMixin): ''' Constructs a GotOcr2 processor which wraps a [`GotOcr2ImageProcessor`] and [`PretrainedTokenizerFast`] tokenizer into a single processor that inherits both the image processor and tokenizer functionalities. See the [`~GotOcr2Processor.__call__`] and [`~GotOcr...
4
2
30
2
18
10
4
0.61
1
10
2
0
6
6
6
23
205
20
115
43
100
70
68
34
61
14
2
3
26
2,776
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/processing_got_ocr2.py
transformers.models.got_ocr2.processing_got_ocr2.GotOcr2ProcessorKwargs
from transformers.processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack class GotOcr2ProcessorKwargs(ProcessingKwargs, total=False): text_kwargs: GotOcr2TextKwargs images_kwargs: GotOcr2ImagesKwargs _defaults = {'text_kwargs': {'padding': False, 'format': False}, 'image...
class GotOcr2ProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
16
0
16
2
15
0
4
2
3
0
3
0
0
2,777
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/got_ocr2/processing_got_ocr2.py
transformers.models.got_ocr2.processing_got_ocr2.GotOcr2TextKwargs
from transformers.processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack from typing import Optional, Union class GotOcr2TextKwargs(TextKwargs, total=False): format: Optional[bool]
class GotOcr2TextKwargs(TextKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
2
0
0
2,778
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/configuration_gpt2.py
transformers.models.gpt2.configuration_gpt2.GPT2Config
from ...configuration_utils import PretrainedConfig class GPT2Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GPT2Model`] or a [`TFGPT2Model`]. It is used to instantiate a GPT-2 model according to the specified arguments, defining the model architecture. Inst...
class GPT2Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GPT2Model`] or a [`TFGPT2Model`]. It is used to instantiate a GPT-2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will...
2
1
53
2
51
0
1
1.37
1
1
0
0
1
23
1
1
160
18
60
54
32
82
29
28
27
1
1
0
1
2,779
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/configuration_gpt2.py
transformers.models.gpt2.configuration_gpt2.GPT2OnnxConfig
from ... import PreTrainedTokenizer, is_torch_available from collections import OrderedDict from typing import Any, Optional from ...onnx import OnnxConfigWithPast, PatchingSpec from ...configuration_utils import PretrainedConfig from collections.abc import Mapping class GPT2OnnxConfig(OnnxConfigWithPast): def __...
class GPT2OnnxConfig(OnnxConfigWithPast): def __init__(self, config: PretrainedConfig, task: str='default', patching_specs: Optional[list[PatchingSpec]]=None, use_past: bool=False): pass @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def num_layers(se...
11
0
12
1
10
1
2
0.06
1
8
0
0
6
0
6
6
79
11
64
33
39
4
34
15
26
4
1
2
11
2,780
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2Attention
from typing import Callable, Optional, Union from torch import nn from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch from ...utils.deprecation import deprecate_kwarg from ...modeling_utils import ALL_...
class GPT2Attention(nn.Module): def __init__(self, config, is_cross_attention=False, layer_idx=None): pass def prune_heads(self, heads): pass def _upcast_and_reordered_attn(self, query, key, value, attention_mask=None, head_mask=None): pass @deprecate_kwarg('past_key_value', ...
6
0
49
8
37
4
6
0.11
1
9
1
0
4
17
4
14
199
33
150
57
134
17
107
46
102
10
1
2
22
2,781
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2Block
from typing import Callable, Optional, Union from torch import nn from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch from ...modeling_layers import GradientCheckpointingLayer from ...utils.deprecation import deprecate_kwarg class GPT2Block(GradientCheckpointingLayer): def __init__(se...
class GPT2Block(GradientCheckpointingLayer): 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: Optional[tuple[torch.FloatTensor]], past_key_values: Optional[Cache]=None, cache_position: O...
4
0
37
4
32
4
4
0.11
1
6
2
0
2
6
2
12
76
8
64
27
51
7
36
17
33
4
1
2
7
2,782
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModel
from typing import Callable, Optional, Union from ...utils import ModelOutput, add_start_docstrings, auto_docstring, logging from ...generation import GenerationMixin from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss import warnings from torch import nn from ...utils.model_parallel_utils import assert_d...
@auto_docstring(custom_intro='\n The GPT2 Model transformer with a language modeling and a multiple-choice classification head on top e.g. for\n RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the\n input embeddings, the classification head tak...
9
1
24
2
16
6
2
0.33
2
8
2
0
6
5
7
9
182
24
119
47
87
39
59
24
51
8
2
2
15
2,783
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput
from typing import Callable, Optional, Union from ...utils import ModelOutput, add_start_docstrings, auto_docstring, logging from dataclasses import dataclass from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch @dataclass @auto_docstring(custom_intro='\n Base class for outputs of models...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of models predicting if two sentences are consecutive or not.\n ') class GPT2DoubleHeadsModelOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling los...
3
1
0
0
0
0
0
3.25
1
0
0
0
0
0
0
0
39
5
8
8
7
26
8
8
7
0
1
0
0
2,784
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2ForQuestionAnswering
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import ModelOutput, add_start_docstrings, auto_docstring, logging from typing import Callable, Optional, Union import torch from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Questi...
@auto_docstring class GPT2ForQuestionAnswering(GPT2PreTrainedModel): 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: Option...
5
1
43
5
31
7
4
0.2
1
4
2
0
2
5
2
4
94
10
70
32
47
14
34
18
31
7
2
2
8
2,785
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2ForSequenceClassification
from typing import Callable, Optional, Union from ...utils import ModelOutput, add_start_docstrings, auto_docstring, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions...
null
5
1
54
5
45
5
9
0.09
1
7
2
0
2
5
2
4
115
10
96
34
73
9
47
19
44
16
2
3
17
2,786
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2ForTokenClassification
from typing import Callable, Optional, Union from ...utils import ModelOutput, add_start_docstrings, auto_docstring, logging from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions...
@auto_docstring class GPT2ForTokenClassification(GPT2PreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[tor...
5
1
39
4
31
4
4
0.12
1
5
2
0
2
6
2
4
102
9
83
31
45
10
29
16
26
5
2
1
8
2,787
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2LMHeadModel
import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...utils.model_parallel_utils import assert_device_map, get_device_map from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOutpu...
@auto_docstring(custom_intro='\n The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ') class GPT2LMHeadModel(GPT2PreTrainedModel, GenerationMixin): def __init__(self, config): pass @add_start_docstrings(PARALLELIZE_DOCS...
9
1
18
1
15
2
2
0.13
2
8
2
0
6
4
7
9
144
15
114
41
78
15
44
18
36
6
2
1
13
2,788
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2MLP
import torch from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer from torch import nn from typing import Callable, Optional, Union from ...activations import ACT2FN, get_activation class GPT2MLP(nn.Module): def __init__(self, intermediate_size, config): super().__init...
class GPT2MLP(nn.Module): def __init__(self, intermediate_size, config): pass def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]]) -> torch.FloatTensor: pass
3
0
7
0
7
0
1
0
1
2
1
0
2
4
2
12
15
1
14
8
11
0
14
8
11
1
1
0
2
2,789
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2Model
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask_for_sdpa import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...utils.model_parallel_utils import assert_device_map, get_device_map from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutp...
@auto_docstring class GPT2Model(GPT2PreTrainedModel): def __init__(self, config): pass @add_start_docstrings(PARALLELIZE_DOCSTRING) def parallelize(self, device_map=None): pass @add_start_docstrings(DEPARALLELIZE_DOCSTRING) def deparallelize(self): pass def get_input_em...
12
2
39
4
31
4
8
0.14
1
10
2
0
7
12
7
9
288
34
224
63
193
31
141
45
133
46
2
4
58
2,790
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/modeling_gpt2.py
transformers.models.gpt2.modeling_gpt2.GPT2PreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel import math from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer from torch import nn from .configuration_gpt2 import GPT2Config from ...utils import ModelOutput, add_start_docstrings, auto_docstring, logging @a...
@auto_docstring class GPT2PreTrainedModel(PreTrainedModel): def __init__(self, *inputs, **kwargs): pass def _init_weights(self, module): '''Initialize the weights.''' pass
4
1
14
1
9
5
5
0.52
1
2
1
6
2
0
2
2
45
4
27
13
24
14
25
13
22
8
1
2
9
2,791
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/tokenization_gpt2.py
transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer
from typing import Optional import json import os from ...tokenization_utils import AddedToken, PreTrainedTokenizer import regex as re class GPT2Tokenizer(PreTrainedTokenizer): """ Construct a GPT-2 tokenizer. Based on byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like par...
class GPT2Tokenizer(PreTrainedTokenizer): ''' Construct a GPT-2 tokenizer. Based on 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 is at the beginning of the sentence (wi...
14
6
16
1
13
2
3
0.41
1
11
0
0
12
10
12
101
257
40
156
62
128
64
116
43
103
9
3
3
36
2,792
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt2/tokenization_gpt2_fast.py
transformers.models.gpt2.tokenization_gpt2_fast.GPT2TokenizerFast
from typing import Optional from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...tokenization_utils_base import BatchEncoding from .tokenization_gpt2 import GPT2Tokenizer class GPT2TokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" GPT-2 tokenizer (backed by HuggingFace's *tokeniz...
class GPT2TokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" GPT-2 tokenizer (backed by HuggingFace's *tokenizers* library). Based on 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 enco...
5
1
11
1
10
0
1
0.91
1
4
1
0
4
1
4
92
101
19
43
22
28
39
18
12
13
1
3
0
4
2,793
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/configuration_gpt_bigcode.py
transformers.models.gpt_bigcode.configuration_gpt_bigcode.GPTBigCodeConfig
from ...configuration_utils import PretrainedConfig class GPTBigCodeConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`GPTBigCodeModel`]. It is used to instantiate a GPTBigCode model according to the specified arguments, defining the model architecture. Instanti...
class GPTBigCodeConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`GPTBigCodeModel`]. It is used to instantiate a GPTBigCode model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yie...
2
1
45
2
43
0
1
1.06
1
1
0
0
1
19
1
1
118
11
52
46
28
55
25
24
23
1
1
0
1
2,794
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodeAttention
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from typing import Callable, Optional, Union from torch import nn class GPTBigCodeAttention(nn.Module): def __init__(self, config, is_cross_attention=False, layer...
class GPTBigCodeAttention(nn.Module): def __init__(self, config, is_cross_attention=False, layer_idx=None): pass def forward(self, hidden_states: torch.Tensor, layer_past: Optional[Cache]=None, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, encoder_hidden_states:...
3
0
46
6
34
6
7
0.16
1
5
0
2
4
21
4
14
186
28
137
60
119
22
103
47
98
12
1
2
28
2,795
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodeBlock
from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch from torch import nn class GPTBigCodeBlock(nn.Module): def __init__(self, config, layer_idx=None): super().__init__() hidden_size = config.hidden_size self.inner_di...
class GPTBigCodeBlock(nn.Module): def __init__(self, config, layer_idx=None): pass def forward(self, hidden_states: Optional[tuple[torch.Tensor]], layer_past: Optional[Cache]=None, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, encoder_hidden_states: Optional[tor...
3
0
43
6
35
4
4
0.1
1
6
1
0
2
7
2
12
87
12
71
30
55
7
38
17
35
4
1
2
8
2,796
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodeForCausalLM
from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, SequenceClassifierOutputWithPast, TokenClassifierOutput from ...generation import GenerationMixin from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache import torch from typin...
@auto_docstring(custom_intro='\n The GPT_BIGCODE Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ') class GPTBigCodeForCausalLM(GPTBigCodePreTrainedModel, GenerationMixin): def __init__(self, config): pass @auto_docstring ...
5
1
22
2
17
3
3
0.17
2
6
2
0
6
2
7
9
169
20
127
45
93
22
61
24
53
8
2
2
21
2,797
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodeForSequenceClassification
import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...utils import auto_docstring, can_return_tuple, logging from typing import Callable, Optional, Union from torch import nn from ...modeling_outputs import BaseModelOut...
null
5
1
53
5
44
4
9
0.09
1
7
2
0
2
3
2
4
108
10
90
32
72
8
46
17
43
16
2
3
17
2,798
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodeForTokenClassification
from ...utils import auto_docstring, can_return_tuple, logging from torch import nn import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutput...
@auto_docstring class GPTBigCodeForTokenClassification(GPTBigCodePreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, past_key_values: Optional[Cache]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[...
5
1
36
4
29
4
4
0.12
1
5
2
0
2
4
2
4
75
8
60
29
42
7
26
14
23
5
2
1
8
2,799
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
transformers.models.gpt_bigcode.modeling_gpt_bigcode.GPTBigCodeMLP
from ...activations import ACT2FN import torch from torch import nn from typing import Callable, Optional, Union class GPTBigCodeMLP(nn.Module): def __init__(self, intermediate_size, config): super().__init__() embed_dim = config.hidden_size self.c_fc = nn.Linear(embed_dim, intermediate_si...
class GPTBigCodeMLP(nn.Module): def __init__(self, intermediate_size, config): pass def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]]) -> torch.FloatTensor: pass
3
0
7
0
7
0
1
0.07
1
1
0
0
2
4
2
12
16
1
14
8
11
1
14
8
11
1
1
0
2