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,000
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltDecoderOutput
from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from typing import Optional, Union from dataclasses import dataclass import torch @dataclass class TvltDecoderOutput(ModelOutput): """ Class for TvltDecoder's outputs, with potenti...
@dataclass class TvltDecoderOutput(ModelOutput): ''' Class for TvltDecoder's outputs, with potential hidden states and attentions. Args: logits (`torch.FloatTensor` of shape `(batch_size, patch_size ** 2 * num_channels)`): Pixel reconstruction logits. hidden_states (`tuple(torch....
2
1
0
0
0
0
0
3.5
1
0
0
0
0
0
0
0
20
2
4
4
3
14
4
4
3
0
1
0
0
2,001
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltEncoder
from torch import nn from ....modeling_outputs import BaseModelOutput, SequenceClassifierOutput class TvltEncoder(nn.Module): def __init__(self, config): super().__init__() self.config = config self.layer = nn.ModuleList([TvltLayer(config) for _ in range(config.num_hidden_layers)]) ...
class TvltEncoder(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True): pass
3
0
25
4
21
0
6
0
1
6
2
0
2
3
2
12
51
8
43
19
32
0
24
11
21
10
1
2
11
2,002
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltForAudioVisualClassification
from typing import Optional, Union from ....modeling_outputs import BaseModelOutput, SequenceClassifierOutput from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss import torch from torch import nn from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, repla...
@add_start_docstrings('\n Tvlt Model transformer with a classifier head on top (an MLP on top of the final hidden state of the [CLS] token)\n for audiovisual classification tasks, e.g. CMU-MOSEI Sentiment Analysis and Audio to Video Retrieval.\n ', TVLT_START_DOCSTRING) class TvltForAudioVisualClassification(T...
6
1
42
6
26
11
4
0.41
1
4
2
0
2
3
2
132
87
12
54
23
39
22
23
12
20
7
3
2
8
2,003
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltForPreTraining
from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn @add_start_docstrings('The TVLT Model transformer wit...
@add_start_docstrings('The TVLT Model transformer with the decoder on top for self-supervised pre-training.', TVLT_START_DOCSTRING) class TvltForPreTraining(TvltPreTrainedModel): def __init__(self, config): pass def patchify_pixel(self, pixel_values): ''' pixel_values: [batch_size, num...
11
3
38
4
29
6
3
0.2
1
8
5
0
7
22
7
137
272
35
203
86
181
41
117
73
109
14
3
2
23
2,004
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltForPreTrainingOutput
from dataclasses import dataclass import torch from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings @dataclass class TvltForPreTrainingOutput(ModelOutput): """ Class for TvltForPreTraining's outputs...
@dataclass class TvltForPreTrainingOutput(ModelOutput): ''' Class for TvltForPreTraining's outputs, with potential hidden states and attentions. Args: loss (`torch.FloatTensor` of shape `(1,)`): Pixel reconstruction loss. matching_logits (`torch.FloatTensor` of shape `(batch_size...
2
1
0
0
0
0
0
3.14
1
0
0
0
0
0
0
0
31
2
7
7
6
22
7
7
6
0
1
0
0
2,005
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltIntermediate
from ....activations import ACT2FN from .configuration_tvlt import TvltConfig import torch from torch import nn class TvltIntermediate(nn.Module): def __init__(self, config: TvltConfig) -> None: super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isin...
class TvltIntermediate(nn.Module): def __init__(self, config: TvltConfig) -> 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
2,006
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltLayer
from torch import nn from ....modeling_layers import GradientCheckpointingLayer class TvltLayer(GradientCheckpointingLayer): """This corresponds to the Block class in the timm implementation.""" def __init__(self, config): super().__init__() self.chunk_size_feed_forward = config.chunk_size_fee...
class TvltLayer(GradientCheckpointingLayer): '''This corresponds to the Block class in the timm implementation.''' def __init__(self, config): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False): pass
3
1
16
3
12
3
1
0.24
1
4
3
0
2
7
2
12
36
7
25
14
22
6
20
14
17
1
1
0
2
2,007
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltMAEHead
from torch import nn class TvltMAEHead(nn.Module): def __init__(self, config, output_dim=None): super().__init__() self.config = config self.decoder = nn.Linear(config.decoder_hidden_size, output_dim) def forward(self, hidden_states): hidden_states = self.decoder(hidden_states...
class TvltMAEHead(nn.Module): def __init__(self, config, output_dim=None): pass def forward(self, hidden_states): pass
3
0
4
0
4
0
1
0
1
1
0
0
2
2
2
12
9
1
8
5
5
0
8
5
5
1
1
0
2
2,008
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltMatchingHead
from torch import nn class TvltMatchingHead(nn.Module): def __init__(self, config): super().__init__() self.pooler = TvltPooler(config) self.fc = nn.Linear(config.hidden_size, 1) def forward(self, hidden_states): hidden_states = self.fc(self.pooler(hidden_states)) retu...
class TvltMatchingHead(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
4
0
4
0
1
0
1
2
1
0
2
2
2
12
9
1
8
5
5
0
8
5
5
1
1
0
2
2,009
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltModel
import torch from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from torch import nn from typing import Optional, Union @add_start_docstrings('The bare TVLT Model transformer outputting raw hidden-states without any specific head on top.',...
@add_start_docstrings('The bare TVLT Model transformer outputting raw hidden-states without any specific head on top.', TVLT_START_DOCSTRING) class TvltModel(TvltPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def _prune_heads(self, heads_to_prune):...
8
2
39
5
28
6
4
0.21
1
6
4
0
4
6
4
134
161
24
113
43
95
24
53
31
48
10
3
1
15
2,010
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltModelOutput
from dataclasses import dataclass from typing import Optional, Union import torch from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings @dataclass class TvltModelOutput(ModelOutput): """ Class for TvltModel's outputs, with potential h...
@dataclass class TvltModelOutput(ModelOutput): ''' Class for TvltModel's outputs, with potential hidden states and attentions. Args: last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of...
2
1
0
0
0
0
0
2.6
1
0
0
0
0
0
0
0
38
2
10
10
9
26
10
10
9
0
1
0
0
2,011
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltOutput
from torch import nn from .configuration_tvlt import TvltConfig import torch class TvltOutput(nn.Module): def __init__(self, config: TvltConfig) -> None: super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_...
class TvltOutput(nn.Module): def __init__(self, config: TvltConfig) -> None: pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
6
1
5
0
1
0
1
3
1
0
2
2
2
12
13
3
10
5
7
0
10
5
7
1
1
0
2
2,012
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltPixelEmbeddings
import torch from torch import nn class TvltPixelEmbeddings(nn.Module): """Construct the patch and position embeddings.""" def __init__(self, config): super().__init__() self.patch_embeddings = TvltPixelPatchEmbeddings(config) self.num_patches_per_image = self.patch_embeddings.num_patc...
class TvltPixelEmbeddings(nn.Module): '''Construct the patch and position embeddings.''' def __init__(self, config): pass def forward(self, pixel_values, attention_masks=None): pass
3
1
11
3
8
1
1
0.13
1
2
1
0
2
6
2
12
25
7
16
11
13
2
16
11
13
1
1
0
2
2,013
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltPixelPatchEmbeddings
from torch import nn import torch import collections.abc class TvltPixelPatchEmbeddings(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...
class TvltPixelPatchEmbeddings(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, confi...
3
1
16
2
14
0
3
0.18
1
4
0
0
2
6
2
12
39
6
28
14
25
5
24
14
21
3
1
1
6
2,014
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltPooler
from torch import nn class TvltPooler(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states): first_token_tensor = hidden_states[:, 0] pooled...
class TvltPooler(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
5
0
5
0
1
0
1
1
0
0
2
2
2
12
11
1
10
7
7
0
10
7
7
1
1
0
2
2,015
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltPreTrainedModel
from .configuration_tvlt import TvltConfig from torch import nn from ....modeling_utils import PreTrainedModel class TvltPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ config: TvltCon...
class TvltPreTrainedModel(PreTrainedModel): ''' An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. ''' def _init_weights(self, module): '''Initialize the weights''' pass
2
2
11
0
8
3
4
0.54
1
0
0
3
1
0
1
130
22
2
13
6
11
7
12
6
10
4
2
2
4
2,016
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltSelfAttention
import torch import math from torch import nn class TvltSelfAttention(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')): raise ValueError(f'The hidden size {config.hidden_size} ...
class TvltSelfAttention(nn.Module): def __init__(self, config): pass def transpose_for_scores(self, x): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False): pass
4
0
18
4
12
2
2
0.16
1
3
0
0
3
7
3
13
58
14
38
21
34
6
35
21
31
4
1
1
7
2,017
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/modeling_tvlt.py
transformers.models.deprecated.tvlt.modeling_tvlt.TvltSelfOutput
import torch from .configuration_tvlt import TvltConfig from torch import nn class TvltSelfOutput(nn.Module): """ The residual connection is defined in TvltLayer instead of here (as is the case with other models), due to the layernorm applied before each block. """ def __init__(self, config: TvltC...
class TvltSelfOutput(nn.Module): ''' The residual connection is defined in TvltLayer instead of here (as is the case with other models), due to the layernorm applied before each block. ''' def __init__(self, config: TvltConfig) -> 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
2,018
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/tvlt/processing_tvlt.py
transformers.models.deprecated.tvlt.processing_tvlt.TvltProcessor
from ....processing_utils import ProcessorMixin class TvltProcessor(ProcessorMixin): """ Constructs a TVLT processor which wraps a TVLT image processor and TVLT feature extractor into a single processor. [`TvltProcessor`] offers all the functionalities of [`TvltImageProcessor`] and [`TvltFeatureExtractor`...
class TvltProcessor(ProcessorMixin): ''' Constructs a TVLT processor which wraps a TVLT image processor and TVLT feature extractor into a single processor. [`TvltProcessor`] offers all the functionalities of [`TvltImageProcessor`] and [`TvltFeatureExtractor`]. See the docstring of [`~TvltProcessor.__ca...
3
2
16
1
13
2
3
0.35
1
4
0
0
3
2
3
20
68
10
43
26
28
15
30
15
26
8
2
1
10
2,019
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/configuration_van.py
transformers.models.deprecated.van.configuration_van.VanConfig
from ....configuration_utils import PretrainedConfig class VanConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`VanModel`]. It is used to instantiate a VAN model according to the specified arguments, defining the model architecture. Instantiating a configuratio...
class VanConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`VanModel`]. It is used to instantiate a VAN model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configur...
2
1
31
0
31
0
1
1.36
1
1
0
0
1
13
1
33
84
6
33
32
15
45
17
16
15
1
2
0
1
2,020
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/convert_van_to_pytorch.py
transformers.models.deprecated.van.convert_van_to_pytorch.ModuleTransfer
from torch import Tensor from dataclasses import dataclass, field import torch.nn as nn @dataclass class ModuleTransfer: src: nn.Module dest: nn.Module verbose: int = 0 src_skip: list = field(default_factory=list) dest_skip: list = field(default_factory=list) def __call__(self, x: Tensor): ...
@dataclass class ModuleTransfer: def __call__(self, x: Tensor): ''' Transfer the weights of `self.src` to `self.dest` by performing a forward pass using `x` as input. Under the hood we tracked all the operations in both modules. ''' pass
3
1
21
3
14
4
4
0.2
0
7
1
0
1
0
1
1
28
4
20
8
18
4
17
8
15
4
0
2
4
2,021
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/convert_van_to_pytorch.py
transformers.models.deprecated.van.convert_van_to_pytorch.Tracker
import torch.nn as nn from torch import Tensor from transformers.models.deprecated.van.modeling_van import VanLayerScaling from dataclasses import dataclass, field @dataclass class Tracker: module: nn.Module traced: list[nn.Module] = field(default_factory=list) handles: list = field(default_factory=list) ...
@dataclass class Tracker: def _forward_hook(self, m, inputs: Tensor, outputs: Tensor): pass def __call__(self, x: Tensor): pass @property def parametrized(self): pass
6
0
5
0
4
0
2
0.06
0
4
0
0
3
0
3
3
22
3
18
9
13
1
17
8
13
3
0
2
6
2,022
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanDropPath
import torch from typing import Optional, Union from torch import nn class VanDropPath(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 = dro...
class VanDropPath(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,023
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanEncoder
from torch import nn from typing import Optional, Union import torch from ....modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from .configuration_van import VanConfig class VanEncoder(nn.Module): """ VanEncoder, consisting o...
class VanEncoder(nn.Module): ''' VanEncoder, consisting of multiple stages. ''' def __init__(self, config: VanConfig): pass def forward(self, hidden_state: torch.Tensor, output_hidden_states: Optional[bool]=False, return_dict: Optional[bool]=True) -> Union[tuple, BaseModelOutputWithNoAtte...
3
1
24
3
21
0
4
0.07
1
9
3
0
2
1
2
12
53
7
43
20
35
3
25
15
22
5
1
2
8
2,024
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanForImageClassification
import torch from torch import nn from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging from typing import Optional, Union from ....modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWith...
@add_start_docstrings('\n VAN Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n ImageNet.\n ', VAN_START_DOCSTRING) class VanForImageClassification(VanPreTrainedModel): def __init__(self, config): pass @add_start_docstrings_to_model_forwa...
6
1
30
4
22
4
8
0.16
1
5
2
0
2
2
2
132
68
9
51
18
35
8
31
11
28
13
3
3
15
2,025
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanLargeKernelAttention
import torch from torch import nn class VanLargeKernelAttention(nn.Module): """ Basic Large Kernel Attention (LKA). """ def __init__(self, hidden_size: int): super().__init__() self.depth_wise = nn.Conv2d(hidden_size, hidden_size, kernel_size=5, padding=2, groups=hidden_size) s...
class VanLargeKernelAttention(nn.Module): ''' Basic Large Kernel Attention (LKA). ''' def __init__(self, hidden_size: int): pass def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: pass
3
1
6
0
6
0
1
0.23
1
3
0
0
2
3
2
12
18
2
13
6
10
3
11
6
8
1
1
0
2
2,026
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanLargeKernelAttentionLayer
from torch import nn import torch class VanLargeKernelAttentionLayer(nn.Module): """ Computes attention using Large Kernel Attention (LKA) and attends the input. """ def __init__(self, hidden_size: int): super().__init__() self.attention = VanLargeKernelAttention(hidden_size) def ...
class VanLargeKernelAttentionLayer(nn.Module): ''' Computes attention using Large Kernel Attention (LKA) and attends the input. ''' def __init__(self, hidden_size: int): pass def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: pass
3
1
4
0
4
0
1
0.38
1
4
1
0
2
1
2
12
13
2
8
6
5
3
8
6
5
1
1
0
2
2,027
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanLayer
from torch import nn from .configuration_van import VanConfig import torch class VanLayer(nn.Module): """ Van layer composed by normalization layers, large kernel attention (LKA) and a multi layer perceptron (MLP). """ def __init__(self, config: VanConfig, hidden_size: int, mlp_ratio: int=4, drop_path...
class VanLayer(nn.Module): ''' Van layer composed by normalization layers, large kernel attention (LKA) and a multi layer perceptron (MLP). ''' def __init__(self, config: VanConfig, hidden_size: int, mlp_ratio: int=4, drop_path_rate: float=0.5): pass def forward(self, hidden_state: torch....
3
1
18
0
16
2
2
0.22
1
9
5
0
2
7
2
12
41
2
32
17
23
7
24
11
21
2
1
0
3
2,028
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanLayerScaling
import torch from torch import nn class VanLayerScaling(nn.Module): """ Scales the inputs by a learnable parameter initialized by `initial_value`. """ def __init__(self, hidden_size: int, initial_value: float=0.01): super().__init__() self.weight = nn.Parameter(initial_value * torch.on...
class VanLayerScaling(nn.Module): ''' Scales the inputs by a learnable parameter initialized by `initial_value`. ''' def __init__(self, hidden_size: int, initial_value: float=0.01): pass def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: pass
3
1
4
0
3
1
1
0.57
1
4
0
0
2
1
2
12
13
2
7
4
4
4
7
4
4
1
1
0
2
2,029
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanMlpLayer
from torch import nn from ....activations import ACT2FN import torch class VanMlpLayer(nn.Module): """ MLP with depth-wise convolution, from [PVTv2: Improved Baselines with Pyramid Vision Transformer](https://huggingface.co/papers/2106.13797). """ def __init__(self, in_channels: int, hidden_size: ...
class VanMlpLayer(nn.Module): ''' MLP with depth-wise convolution, from [PVTv2: Improved Baselines with Pyramid Vision Transformer](https://huggingface.co/papers/2106.13797). ''' def __init__(self, in_channels: int, hidden_size: int, out_channels: int, hidden_act: str='gelu', dropout_rate: float=0...
3
1
12
0
12
0
1
0.17
1
5
0
0
2
6
2
12
30
2
24
16
14
4
17
9
14
1
1
0
2
2,030
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanModel
from typing import Optional, Union from torch import nn import torch from ....modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forwa...
@add_start_docstrings('The bare VAN model outputting raw features without any specific head on top. Note, VAN does not have an embedding layer.', VAN_START_DOCSTRING) class VanModel(VanPreTrainedModel): def __init__(self, config): pass @add_start_docstrings_to_model_forward(VAN_INPUTS_DOCSTRING) @a...
6
0
18
2
15
2
3
0.08
1
4
2
0
2
3
2
132
46
4
39
15
23
3
16
9
13
4
3
1
5
2,031
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanOverlappingPatchEmbedder
from torch import nn import torch class VanOverlappingPatchEmbedder(nn.Module): """ Downsamples the input using a patchify operation with a `stride` of 4 by default making adjacent windows overlap by half of the area. From [PVTv2: Improved Baselines with Pyramid Vision Transformer](https://huggingface....
class VanOverlappingPatchEmbedder(nn.Module): ''' Downsamples the input using a patchify operation with a `stride` of 4 by default making adjacent windows overlap by half of the area. From [PVTv2: Improved Baselines with Pyramid Vision Transformer](https://huggingface.co/papers/2106.13797). ''' ...
3
1
5
0
5
0
1
0.45
1
3
0
0
2
2
2
12
18
2
11
6
8
5
9
6
6
1
1
0
2
2,032
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanPreTrainedModel
from ....modeling_utils import PreTrainedModel from torch import nn from .configuration_van import VanConfig import math class VanPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ config...
class VanPreTrainedModel(PreTrainedModel): ''' An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. ''' def _init_weights(self, module): '''Initialize the weights''' pass
2
2
15
0
14
1
6
0.26
1
0
0
2
1
0
1
130
26
2
19
7
17
5
17
7
15
6
2
2
6
2,033
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanSpatialAttentionLayer
import torch from torch import nn from collections import OrderedDict from ....activations import ACT2FN class VanSpatialAttentionLayer(nn.Module): """ Van spatial attention layer composed by projection (via conv) -> act -> Large Kernel Attention (LKA) attention -> projection (via conv) + residual connecti...
class VanSpatialAttentionLayer(nn.Module): ''' Van spatial attention layer composed by projection (via conv) -> act -> Large Kernel Attention (LKA) attention -> projection (via conv) + residual connection. ''' def __init__(self, hidden_size: int, hidden_act: str='gelu'): pass def forw...
3
1
10
0
10
0
1
0.2
1
6
1
0
2
3
2
12
26
2
20
7
17
4
13
7
10
1
1
0
2
2,034
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/van/modeling_van.py
transformers.models.deprecated.van.modeling_van.VanStage
import torch from .configuration_van import VanConfig from torch import nn class VanStage(nn.Module): """ VanStage, consisting of multiple layers. """ def __init__(self, config: VanConfig, in_channels: int, hidden_size: int, patch_size: int, stride: int, depth: int, mlp_ratio: int=4, drop_path_rate: f...
class VanStage(nn.Module): ''' VanStage, consisting of multiple layers. ''' def __init__(self, config: VanConfig, in_channels: int, hidden_size: int, patch_size: int, stride: int, depth: int, mlp_ratio: int=4, drop_path_rate: float=0.0): pass def forward(self, hidden_state: torch.Tensor) ...
3
1
18
0
17
1
1
0.15
1
8
3
0
2
3
2
12
41
2
34
18
21
5
14
7
11
1
1
0
2
2,035
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/configuration_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.configuration_vit_hybrid.ViTHybridConfig
from ...auto.configuration_auto import CONFIG_MAPPING from ....configuration_utils import PretrainedConfig from ...bit import BitConfig class ViTHybridConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ViTHybridModel`]. It is used to instantiate a ViT Hybrid mod...
class ViTHybridConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ViTHybridModel`]. It is used to instantiate a ViT Hybrid model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield...
4
1
72
5
67
0
7
0.88
1
4
1
0
1
19
1
33
144
14
69
45
45
61
38
23
36
7
2
2
7
2,036
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/image_processing_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.image_processing_vit_hybrid.ViTHybridImageProcessor
from ....utils import TensorType, is_vision_available, logging from ....image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images, validate_kwargs, validate_preprocess_ar...
class ViTHybridImageProcessor(BaseImageProcessor): ''' Constructs a ViT Hybrid image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by `do_resize` in the...
4
3
81
6
53
23
10
0.65
1
8
2
0
3
12
3
23
287
22
161
61
117
104
69
21
65
21
3
2
29
2,037
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridAttention
from .configuration_vit_hybrid import ViTHybridConfig from typing import Optional, Union import torch from ....pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer from torch import nn class ViTHybridAttention(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: super().__...
class ViTHybridAttention(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: pass def prune_heads(self, heads: set[int]) -> None: pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> Union[tuple[torch.T...
4
0
11
1
9
1
1
0.1
1
8
3
1
3
3
3
13
37
6
29
16
20
3
22
11
18
2
1
1
4
2,038
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridEmbeddings
from .configuration_vit_hybrid import ViTHybridConfig from torch import nn import torch from typing import Optional, Union from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, torch_int class ViTHybridEmbeddings(nn.Module): """ Construct the CL...
class ViTHybridEmbeddings(nn.Module): ''' Construct the CLS token, position and patch embeddings. Optionally, also the mask token. ''' def __init__(self, config: ViTHybridConfig, use_mask_token: bool=False) -> None: pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height:...
4
2
26
5
17
4
2
0.28
1
6
2
0
3
7
3
13
87
19
53
31
44
15
42
26
38
3
1
1
7
2,039
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridEncoder
from typing import Optional, Union import torch from torch import nn from .configuration_vit_hybrid import ViTHybridConfig from ....modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput class ViTHybridEncoder(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: ...
class ViTHybridEncoder(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=True) -> Union[tuple, BaseModelOutput]...
3
0
24
4
20
0
6
0
1
9
3
0
2
3
2
12
49
8
41
18
31
0
24
11
21
10
1
2
11
2,040
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridForImageClassification
from torch import nn from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, torch_int from ....modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput import torch from .configuration_vit_hybrid import ViTHybridConfig fr...
@add_start_docstrings('\n ViT Hybrid Model transformer with an image classification head on top (a linear layer on top of the final hidden\n state of the [CLS] token) e.g. for ImageNet.\n ', VIT_START_DOCSTRING) class ViTHybridForImageClassification(ViTHybridPreTrainedModel): def __init__(self, config: Vi...
6
1
39
5
29
5
7
0.14
1
8
3
0
2
3
2
132
86
11
66
22
47
9
33
12
30
12
3
3
14
2,041
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridIntermediate
import torch from torch import nn from .configuration_vit_hybrid import ViTHybridConfig from ....activations import ACT2FN class ViTHybridIntermediate(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_...
class ViTHybridIntermediate(nn.Module): def __init__(self, config: ViTHybridConfig) -> 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
2,042
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridLayer
import torch from typing import Optional, Union from torch import nn from .configuration_vit_hybrid import ViTHybridConfig from ....modeling_layers import GradientCheckpointingLayer class ViTHybridLayer(GradientCheckpointingLayer): """This corresponds to the Block class in the timm implementation.""" def __in...
class ViTHybridLayer(GradientCheckpointingLayer): '''This corresponds to the Block class in the timm implementation.''' def __init__(self, config: ViTHybridConfig) -> None: pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -...
3
1
19
3
14
3
1
0.24
1
6
3
0
2
7
2
12
41
7
29
19
21
7
20
14
17
1
1
0
2
2,043
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridModel
from torch import nn from ....utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, torch_int from typing import Optional, Union import torch from .configuration_vit_hybrid import ViTHybridConfig from ....modeling_outputs import BaseModelOutput, BaseModelOutputWi...
@add_start_docstrings('The bare ViT Hybrid Model transformer outputting raw hidden-states without any specific head on top.', VIT_START_DOCSTRING) class ViTHybridModel(ViTHybridPreTrainedModel): def __init__(self, config: ViTHybridConfig, add_pooling_layer: bool=True, use_mask_token: bool=False): pass ...
8
2
20
3
14
4
4
0.23
1
11
6
0
4
5
4
134
93
13
65
27
43
15
33
17
28
9
3
1
14
2,044
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridOutput
from torch import nn from .configuration_vit_hybrid import ViTHybridConfig import torch class ViTHybridOutput(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.dropout = nn.Dropout(c...
class ViTHybridOutput(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
6
1
5
0
1
0
1
3
1
0
2
2
2
12
13
3
10
5
7
0
10
5
7
1
1
0
2
2,045
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridPatchEmbeddings
import torch from torch import nn import collections.abc from ....utils.backbone_utils import load_backbone class ViTHybridPatchEmbeddings(nn.Module): """ This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial `hidden_states` (patch embeddings) of shape `(batc...
class ViTHybridPatchEmbeddings(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, confi...
3
1
24
4
20
0
5
0.12
1
5
0
0
2
7
2
12
56
10
41
17
38
5
33
17
30
6
1
2
10
2,046
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridPooler
from torch import nn from .configuration_vit_hybrid import ViTHybridConfig class ViTHybridPooler(nn.Module): def __init__(self, config: ViTHybridConfig): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hid...
class ViTHybridPooler(nn.Module): def __init__(self, config: ViTHybridConfig): pass def forward(self, hidden_states): pass
3
0
6
0
5
1
1
0.2
1
2
1
0
2
2
2
12
13
1
10
7
7
2
10
7
7
1
1
0
2
2,047
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridPreTrainedModel
from ....modeling_utils import PreTrainedModel import torch from torch import nn from typing import Optional, Union from .configuration_vit_hybrid import ViTHybridConfig class ViTHybridPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloadin...
class ViTHybridPreTrainedModel(PreTrainedModel): ''' An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. ''' def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None: '''Initialize the weights'''...
2
2
25
1
21
3
5
0.25
1
1
1
2
1
0
1
130
38
3
28
8
26
7
16
8
14
5
2
2
5
2,048
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridSdpaAttention
from .configuration_vit_hybrid import ViTHybridConfig class ViTHybridSdpaAttention(ViTHybridAttention): def __init__(self, config: ViTHybridConfig) -> None: super().__init__(config) self.attention = ViTHybridSdpaSelfAttention(config)
class ViTHybridSdpaAttention(ViTHybridAttention): def __init__(self, config: ViTHybridConfig) -> None: pass
2
0
3
0
3
0
1
0
1
3
2
0
1
1
1
14
4
0
4
3
2
0
4
3
2
1
2
0
1
2,049
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridSdpaSelfAttention
from typing import Optional, Union from .configuration_vit_hybrid import ViTHybridConfig import torch class ViTHybridSdpaSelfAttention(ViTHybridSelfAttention): def __init__(self, config: ViTHybridConfig) -> None: super().__init__(config) self.attention_probs_dropout_prob = config.attention_probs_d...
class ViTHybridSdpaSelfAttention(ViTHybridSelfAttention): def __init__(self, config: ViTHybridConfig) -> None: pass def forward(self, hidden_states, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> Union[tuple[torch.Tensor, torch.Tensor], tuple[torch.Tensor]]: pass
3
0
14
2
12
0
2
0
1
4
1
0
2
1
2
15
29
5
24
12
19
0
14
10
11
2
2
0
3
2,050
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridSelfAttention
from torch import nn import torch import math from typing import Optional, Union from .configuration_vit_hybrid import ViTHybridConfig class ViTHybridSelfAttention(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: super().__init__() if config.hidden_size % config.num_attention_heads...
class ViTHybridSelfAttention(nn.Module): def __init__(self, config: ViTHybridConfig) -> None: pass def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor: pass def forward(self, hidden_states, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> Union[tuple[...
4
0
18
4
12
2
2
0.13
1
6
1
1
3
7
3
13
58
15
38
23
32
5
33
21
29
3
1
1
6
2,051
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/vit_hybrid/modeling_vit_hybrid.py
transformers.models.deprecated.vit_hybrid.modeling_vit_hybrid.ViTHybridSelfOutput
import torch from .configuration_vit_hybrid import ViTHybridConfig from torch import nn class ViTHybridSelfOutput(nn.Module): """ The residual connection is defined in ViTHybridLayer instead of here (as is the case with other models), due to the layernorm applied before each block. """ def __init_...
class ViTHybridSelfOutput(nn.Module): ''' The residual connection is defined in ViTHybridLayer instead of here (as is the case with other models), due to the layernorm applied before each block. ''' def __init__(self, config: ViTHybridConfig) -> None: pass def forward(self, hidden_sta...
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
2,052
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/configuration_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.configuration_xlm_prophetnet.XLMProphetNetConfig
from typing import Callable, Optional, Union from ....configuration_utils import PretrainedConfig class XLMProphetNetConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`XLMProphetNetModel`]. It is used to instantiate a XLMProphetNet model according to the specifi...
class XLMProphetNetConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`XLMProphetNetModel`]. It is used to instantiate a XLMProphetNet model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults...
6
1
24
1
22
1
1
0.95
1
6
0
0
3
20
3
35
153
10
74
58
39
70
30
27
26
1
2
0
3
2,053
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetAttention
from torch import Tensor, nn import torch from ....cache_utils import Cache from typing import Optional, Union from .configuration_xlm_prophetnet import XLMProphetNetConfig from ....utils.deprecation import deprecate_kwarg class XLMProphetNetAttention(nn.Module): """Multi-headed attention from 'Attention Is All Yo...
class XLMProphetNetAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: XLMProphetNetConfig, num_attn_heads: int): pass def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): pass @deprecate_kwarg('past_key_value...
5
1
41
6
31
5
4
0.16
1
7
1
0
3
8
3
13
127
20
93
37
77
15
62
25
58
11
1
1
13
2,054
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetDecoder
from torch import Tensor, nn import torch from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from torch.nn import LayerNorm from .configuration_xlm_prophetnet import XLMPr...
@add_start_docstrings('The standalone decoder part of the XLMProphetNetModel.', XLM_PROPHETNET_START_DOCSTRING) class XLMProphetNetDecoder(XLMProphetNetPreTrainedModel): ''' word_embeddings (`torch.nn.Embeddings` of shape `(config.vocab_size, config.hidden_size)`, *optional*): The word embedding parame...
11
2
50
7
36
7
7
0.2
1
12
4
0
7
11
7
138
362
54
257
67
233
51
120
52
112
39
3
3
48
2,055
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetDecoderLMOutput
import torch from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from dataclasses import dataclass @dataclass class XLMProphetNetDecoderLMOutput(ModelOutput): """ ...
@dataclass class XLMProphetNetDecoderLMOutput(ModelOutput): ''' Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding). Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling lo...
2
1
0
0
0
0
0
4.1
1
0
0
0
0
0
0
0
59
8
10
10
9
41
10
10
9
0
1
0
0
2,056
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetDecoderLayer
from torch.nn import LayerNorm from .configuration_xlm_prophetnet import XLMProphetNetConfig from ....modeling_layers import GradientCheckpointingLayer from ....utils.deprecation import deprecate_kwarg class XLMProphetNetDecoderLayer(GradientCheckpointingLayer): """ Decoder block for XLMProphetnet """ ...
class XLMProphetNetDecoderLayer(GradientCheckpointingLayer): ''' Decoder block for XLMProphetnet ''' def __init__(self, config: XLMProphetNetConfig): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, attention_mask=None...
4
1
38
5
29
5
4
0.2
1
6
4
0
2
6
2
12
82
11
59
31
41
12
28
16
25
6
1
1
8
2,057
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetDecoderModelOutput
import torch from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from dataclasses import dataclass @dataclass class XLMProphetNetDecoderModelOutput(ModelOutput): """ ...
@dataclass class XLMProphetNetDecoderModelOutput(ModelOutput): ''' Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding). Args: last_hidden_state (`torch.FloatTensor` of shape `(batch_size, decoder_sequence_length, hidden_size)`): Sequen...
2
1
0
0
0
0
0
4.33
1
0
0
0
0
0
0
0
57
9
9
8
8
39
9
8
8
0
1
0
0
2,058
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetDecoderWrapper
from torch import Tensor, nn from .configuration_xlm_prophetnet import XLMProphetNetConfig class XLMProphetNetDecoderWrapper(XLMProphetNetPreTrainedModel): """ This is a wrapper class, so that [`XLMProphetNetForCausalLM`] can correctly be loaded from pretrained XLMProphetNet classes. """ def __ini...
class XLMProphetNetDecoderWrapper(XLMProphetNetPreTrainedModel): ''' This is a wrapper class, so that [`XLMProphetNetForCausalLM`] can correctly be loaded from pretrained XLMProphetNet classes. ''' def __init__(self, config: XLMProphetNetConfig): pass def _tie_weights(self): ...
4
1
4
1
3
0
1
0.5
1
3
2
0
3
2
3
134
20
5
10
6
6
5
10
6
6
1
3
0
3
2,059
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetEncoder
from ....modeling_outputs import BaseModelOutput from torch import Tensor, nn import torch from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from torch.nn import LayerNorm from .configuration_xlm_prophetn...
@add_start_docstrings('The standalone encoder part of the XLMProphetNetModel.', XLM_PROPHETNET_START_DOCSTRING) class XLMProphetNetEncoder(XLMProphetNetPreTrainedModel): ''' word_embeddings (`torch.nn.Embeddings` of shape `(config.vocab_size, config.hidden_size)`, *optional*): The word embedding parame...
8
2
29
5
21
4
6
0.24
1
11
4
0
4
5
4
135
128
23
85
27
69
20
47
17
42
19
3
2
23
2,060
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetEncoderLayer
from torch.nn import LayerNorm from .configuration_xlm_prophetnet import XLMProphetNetConfig from ....modeling_layers import GradientCheckpointingLayer class XLMProphetNetEncoderLayer(GradientCheckpointingLayer): """ Encoder block for XLMProphetnet """ def __init__(self, config: XLMProphetNetConfig): ...
class XLMProphetNetEncoderLayer(GradientCheckpointingLayer): ''' Encoder block for XLMProphetnet ''' def __init__(self, config: XLMProphetNetConfig): pass def forward(self, hidden_states, attention_mask, layer_head_mask, output_attentions: bool=False): pass
3
1
18
3
13
2
2
0.26
1
5
3
0
2
4
2
12
41
7
27
16
18
7
16
10
13
2
1
1
3
2,061
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetFeedForward
from .configuration_xlm_prophetnet import XLMProphetNetConfig from torch import Tensor, nn from ....activations import ACT2FN class XLMProphetNetFeedForward(nn.Module): """ This is the residual two feed-forward layer block based on the original Transformer implementation. """ def __init__(self, config...
class XLMProphetNetFeedForward(nn.Module): ''' This is the residual two feed-forward layer block based on the original Transformer implementation. ''' def __init__(self, config: XLMProphetNetConfig, ffn_dim: int): pass def forward(self, hidden_states): pass
3
1
8
1
7
0
1
0.2
1
3
1
0
2
5
2
12
21
3
15
8
12
3
15
8
12
1
1
0
2
2,062
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetForCausalLM
from torch import Tensor, nn import torch import copy from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from .configuration_xlm_prophetnet import XLMProphetNetConfig @ad...
@add_start_docstrings('The standalone decoder part of the XLMProphetNetModel with a lm head on top. The model can be used for causal language modeling.', XLM_PROPHETNET_START_DOCSTRING) class XLMProphetNetForCausalLM(XLMProphetNetPreTrainedModel): def __init__(self, config: XLMProphetNetConfig): pass ...
15
1
18
3
11
5
2
0.46
1
8
3
0
11
4
12
143
239
42
136
60
97
62
70
35
57
7
3
2
25
2,063
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetForConditionalGeneration
from torch import Tensor, nn import torch from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from .configuration_xlm_prophetnet import XLMProphetNetConfig @add_start_docs...
@add_start_docstrings('The XLMProphetNet Model with a language modeling head. Can be used for sequence generation tasks.', XLM_PROPHETNET_START_DOCSTRING) class XLMProphetNetForConditionalGeneration(XLMProphetNetPreTrainedModel): def __init__(self, config: XLMProphetNetConfig): pass def _tie_weights(s...
15
1
16
2
12
2
2
0.17
1
8
3
0
11
4
12
143
209
34
151
66
106
25
70
35
57
9
3
2
26
2,064
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetModel
from torch import Tensor, nn import torch import copy from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from .configuration_xlm_prophetnet import XLMProphetNetConfig @ad...
@add_start_docstrings('The bare XLMProphetNet Model outputting raw hidden-states without any specific head on top.', XLM_PROPHETNET_START_DOCSTRING) class XLMProphetNetModel(XLMProphetNetPreTrainedModel): def __init__(self, config: XLMProphetNetConfig): pass def get_input_embeddings(self): pas...
10
1
17
2
13
2
2
0.18
1
7
4
0
7
3
7
138
128
18
93
33
66
17
39
15
31
7
3
1
14
2,065
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetNgramSelfAttention
from torch import Tensor, nn import torch from ....cache_utils import Cache from typing import Optional, Union from .configuration_xlm_prophetnet import XLMProphetNetConfig from ....utils.deprecation import deprecate_kwarg class XLMProphetNetNgramSelfAttention(nn.Module): def __init__(self, config: XLMProphetNetC...
class XLMProphetNetNgramSelfAttention(nn.Module): def __init__(self, config: XLMProphetNetConfig): pass def _shape(self, tensor, seq_len, batch_size): pass def prepare_for_onnx_export_(self): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') ...
8
0
52
8
34
10
2
0.3
1
4
1
0
6
14
6
16
317
51
205
74
184
61
126
60
119
6
1
1
13
2,066
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetPositionalEmbeddings
from torch import Tensor, nn from .configuration_xlm_prophetnet import XLMProphetNetConfig import torch class XLMProphetNetPositionalEmbeddings(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting based on padding_idx or by set...
class XLMProphetNetPositionalEmbeddings(nn.Embedding): ''' This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting based on padding_idx or by setting padding_idx to None and ensuring that the appropriate position ids are passed to the forward fu...
4
1
11
1
8
1
2
0.36
1
3
1
0
3
1
3
3
41
7
25
7
21
9
18
7
14
4
1
3
6
2,067
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetPreTrainedModel
from torch import Tensor, nn from ....modeling_utils import PreTrainedModel from .configuration_xlm_prophetnet import XLMProphetNetConfig import torch class XLMProphetNetPreTrainedModel(PreTrainedModel): config: XLMProphetNetConfig base_model_prefix = 'prophetnet' supports_gradient_checkpointing = True ...
class XLMProphetNetPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass def _shift_right(self, input_ids): pass
3
0
15
3
12
1
3
0.07
1
0
0
6
2
0
2
131
36
7
27
9
24
2
23
9
20
5
2
2
6
2,068
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetSeq2SeqLMOutput
import torch from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from dataclasses import dataclass import warnings @dataclass class XLMProphetNetSeq2SeqLMOutput(ModelOutpu...
@dataclass class XLMProphetNetSeq2SeqLMOutput(ModelOutput): ''' Base class for sequence-to-sequence language models outputs. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss. logits (`torch.FloatTensor` of sh...
4
1
7
0
7
0
1
2.43
1
1
0
0
1
0
1
1
82
10
21
15
18
51
16
14
14
1
1
0
1
2,069
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/modeling_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.modeling_xlm_prophetnet.XLMProphetNetSeq2SeqModelOutput
import torch from ....cache_utils import Cache from typing import Optional, Union from ....utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings from dataclasses import dataclass import warnings @dataclass class XLMProphetNetSeq2SeqModelOutput(ModelOu...
@dataclass class XLMProphetNetSeq2SeqModelOutput(ModelOutput): ''' Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential decoding. Args: last_hidden_state (`torch.FloatTensor` of shape `(batch_size, decoder_sequence_length, hidden_siz...
4
1
7
0
7
0
1
2.55
1
1
0
0
1
0
1
1
83
12
20
13
17
51
15
12
13
1
1
0
1
2,070
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/xlm_prophetnet/tokenization_xlm_prophetnet.py
transformers.models.deprecated.xlm_prophetnet.tokenization_xlm_prophetnet.XLMProphetNetTokenizer
from shutil import copyfile from typing import Any, Optional from ....tokenization_utils import PreTrainedTokenizer import os class XLMProphetNetTokenizer(PreTrainedTokenizer): """ Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). ...
class XLMProphetNetTokenizer(PreTrainedTokenizer): ''' Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to thi...
15
7
14
2
9
4
2
0.81
1
7
0
0
14
7
14
103
281
55
125
57
88
101
84
36
67
5
3
2
31
2,071
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/configuration_depth_anything.py
transformers.models.depth_anything.configuration_depth_anything.DepthAnythingConfig
from ...utils.backbone_utils import verify_backbone_config_arguments from ...configuration_utils import PretrainedConfig import copy from ..auto.configuration_auto import CONFIG_MAPPING class DepthAnythingConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`DepthAnyth...
class DepthAnythingConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`DepthAnythingModel`]. It is used to instantiate a DepthAnything model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults...
5
2
36
2
32
2
4
0.88
1
3
0
0
2
15
2
2
138
14
66
40
45
58
34
22
31
5
1
1
7
2,072
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingDepthEstimationHead
import torch from torch import nn class DepthAnythingDepthEstimationHead(nn.Module): """ Output head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples the predictions to the input resolution after the first convolutional layer (details can be found in the DPT...
class DepthAnythingDepthEstimationHead(nn.Module): ''' Output head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples the predictions to the input resolution after the first convolutional layer (details can be found in the DPT paper's supplementary materia...
3
1
18
2
16
1
2
0.22
1
4
0
0
2
8
2
12
44
6
32
13
29
7
25
13
22
3
1
1
4
2,073
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingFeatureFusionLayer
from torch import nn class DepthAnythingFeatureFusionLayer(nn.Module): """Feature fusion layer, merges feature maps from different stages. Args: config (`[DepthAnythingConfig]`): Model configuration class defining the model architecture. """ def __init__(self, config): sup...
class DepthAnythingFeatureFusionLayer(nn.Module): '''Feature fusion layer, merges feature maps from different stages. Args: config (`[DepthAnythingConfig]`): Model configuration class defining the model architecture. ''' def __init__(self, config): pass def...
3
1
14
3
11
0
3
0.22
1
2
1
0
2
3
2
12
37
9
23
7
20
5
16
7
13
4
1
2
5
2,074
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingFeatureFusionStage
from .configuration_depth_anything import DepthAnythingConfig from torch import nn class DepthAnythingFeatureFusionStage(nn.Module): def __init__(self, config: DepthAnythingConfig): super().__init__() self.layers = nn.ModuleList() for _ in range(len(config.neck_hidden_sizes)): ...
class DepthAnythingFeatureFusionStage(nn.Module): def __init__(self, config: DepthAnythingConfig): pass def forward(self, hidden_states, size=None): pass
3
0
12
3
9
1
3
0.17
1
5
1
0
2
1
2
12
27
6
18
8
15
3
17
8
14
4
1
2
6
2,075
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingForDepthEstimation
from ...modeling_outputs import DepthEstimatorOutput from typing import Optional, Union from ...utils import auto_docstring, logging import torch from ...utils.backbone_utils import load_backbone @auto_docstring(custom_intro='\n Depth Anything Model with a depth estimation head on top (consisting of 3 convolutional...
@auto_docstring(custom_intro='\n Depth Anything Model with a depth estimation head on top (consisting of 3 convolutional layers) e.g. for KITTI, NYUv2.\n ') class DepthAnythingForDepthEstimation(DepthAnythingPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, ...
5
1
46
9
22
16
5
0.65
1
7
3
0
2
3
2
3
98
19
48
24
36
31
29
16
26
9
2
2
10
2,076
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingNeck
import torch from torch import nn class DepthAnythingNeck(nn.Module): """ DepthAnythingNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as input and produces another list of tensors as output. For DepthAnything, it includes 2 stages: * DepthA...
class DepthAnythingNeck(nn.Module): ''' DepthAnythingNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as input and produces another list of tensors as output. For DepthAnything, it includes 2 stages: * DepthAnythingReassembleStage * DepthA...
3
2
17
4
9
4
3
0.89
1
9
2
0
2
4
2
12
46
12
18
10
15
16
18
10
15
3
1
1
5
2,077
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingPreActResidualLayer
from torch import nn import torch class DepthAnythingPreActResidualLayer(nn.Module): """ ResidualConvUnit, pre-activate residual unit. Args: config (`[DepthAnythingConfig]`): Model configuration class defining the model architecture. """ def __init__(self, config): sup...
class DepthAnythingPreActResidualLayer(nn.Module): ''' ResidualConvUnit, pre-activate residual unit. Args: config (`[DepthAnythingConfig]`): Model configuration class defining the model architecture. ''' def __init__(self, config): pass def forward(self...
3
1
15
2
14
0
1
0.21
1
2
0
0
2
4
2
12
40
6
28
8
25
6
14
8
11
1
1
0
2
2,078
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingPreTrainedModel
from ...modeling_utils import PreTrainedModel from torch import nn from .configuration_depth_anything import DepthAnythingConfig from ...utils import auto_docstring, logging @auto_docstring class DepthAnythingPreTrainedModel(PreTrainedModel): config: DepthAnythingConfig base_model_prefix = 'depth_anything' ...
@auto_docstring class DepthAnythingPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
11
0
8
3
4
0.54
1
0
0
1
1
0
1
1
22
2
13
6
11
7
12
6
10
4
1
2
4
2,079
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingReassembleLayer
from torch import nn class DepthAnythingReassembleLayer(nn.Module): def __init__(self, config, channels, factor): super().__init__() self.projection = nn.Conv2d(in_channels=config.reassemble_hidden_size, out_channels=channels, kernel_size=1) if factor > 1: self.resize = nn.Conv...
class DepthAnythingReassembleLayer(nn.Module): def __init__(self, config, channels, factor): pass def forward(self, hidden_state): pass
3
0
9
1
7
1
3
0.21
1
2
0
0
2
2
2
12
20
3
14
5
11
3
12
5
9
4
1
1
5
2,080
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/depth_anything/modeling_depth_anything.py
transformers.models.depth_anything.modeling_depth_anything.DepthAnythingReassembleStage
from torch import nn import torch class DepthAnythingReassembleStage(nn.Module): """ This class reassembles the hidden states of the backbone into image-like feature representations at various resolutions. This happens in 3 stages: 1. Take the patch embeddings and reshape them to image-like featur...
class DepthAnythingReassembleStage(nn.Module): ''' This class reassembles the hidden states of the backbone into image-like feature representations at various resolutions. This happens in 3 stages: 1. Take the patch embeddings and reshape them to image-like feature representations. 2. Project t...
3
2
13
2
8
3
2
1
1
5
1
0
2
2
2
12
41
7
17
9
14
17
17
9
14
2
1
1
4
2,081
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/configuration_detr.py
transformers.models.detr.configuration_detr.DetrConfig
from ...configuration_utils import PretrainedConfig from ..auto import CONFIG_MAPPING from ...utils.backbone_utils import verify_backbone_config_arguments class DetrConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`DetrModel`]. It is used to instantiate a DETR ...
class DetrConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`DetrModel`]. It is used to instantiate a DETR model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar confi...
10
2
30
1
26
3
2
0.96
1
3
0
0
3
34
4
4
234
15
112
84
67
107
61
44
56
6
1
2
9
2,082
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/configuration_detr.py
transformers.models.detr.configuration_detr.DetrOnnxConfig
from packaging import version from ...onnx import OnnxConfig from collections.abc import Mapping from collections import OrderedDict class DetrOnnxConfig(OnnxConfig): torch_onnx_minimum_version = version.parse('1.11') @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return OrderedDic...
class DetrOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def atol_for_validation(self) -> float: pass @property def default_onnx_opset(self) -> int: pass
7
0
4
0
4
0
1
0
1
4
0
0
3
0
3
3
19
3
16
8
9
0
8
5
4
1
1
0
3
2,083
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/feature_extraction_detr.py
transformers.models.detr.feature_extraction_detr.DetrFeatureExtractor
from .image_processing_detr import DetrImageProcessor from ...utils.import_utils import requires import warnings @requires(backends=('vision',)) class DetrFeatureExtractor(DetrImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class DetrFeatureExtractor is deprecated and will...
@requires(backends=('vision',)) class DetrFeatureExtractor(DetrImageProcessor): def __init__(self, *args, **kwargs) -> None: pass
3
0
7
0
7
0
1
0
1
2
0
0
1
0
1
40
8
0
8
2
6
0
4
2
2
1
4
0
1
2,084
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/image_processing_detr.py
transformers.models.detr.image_processing_detr.DetrImageProcessor
from typing import Any, Optional, Union from ...image_transforms import PaddingMode, center_to_corners_format, corners_to_center_format, id_to_rgb, pad, rescale, resize, rgb_to_id, to_channel_dimension_format from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, AnnotationFormat, AnnotationType, Chann...
@requires(backends=('vision',)) class DetrImageProcessor(BaseImageProcessor): ''' Constructs a Detr image processor. Args: format (`str`, *optional*, defaults to `"coco_detection"`): Data format of the annotations. One of "coco_detection" or "coco_panoptic". do_resize (`bool`, *o...
25
19
55
5
34
17
6
0.6
1
21
4
1
18
13
19
39
1,258
126
714
270
580
428
389
157
366
32
3
4
125
2,085
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/image_processing_detr_fast.py
transformers.models.detr.image_processing_detr_fast.DetrImageProcessorFast
from ...processing_utils import Unpack from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, AnnotationFormat, AnnotationType, ChannelDimension, ImageInput, PILImageResampling, get_image_size, validate_annotations from ...utils.import_utils import requires from ...image_processing_utils_fast import Ba...
@auto_docstring @requires(backends=('torchvision', 'torch')) class DetrImageProcessorFast(BaseImageProcessorFast): def __init__(self, **kwargs: Unpack[DetrFastImageProcessorKwargs]) -> None: pass @classmethod def from_dict(cls, image_processor_dict: dict[str, Any], **kwargs): ''' Ov...
26
15
46
5
29
12
6
0.41
1
23
6
0
17
1
18
52
994
115
632
274
500
257
386
162
364
22
4
4
119
2,086
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrAttention
import torch from typing import Optional, Union from torch import Tensor, nn class DetrAttention(nn.Module): """ Multi-headed attention from 'Attention Is All You Need' paper. Here, we add position embeddings to the queries and keys (as explained in the DETR paper). """ def __init__(self, embed_d...
class DetrAttention(nn.Module): ''' Multi-headed attention from 'Attention Is All You Need' paper. Here, we add position embeddings to the queries and keys (as explained in the DETR paper). ''' def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, bias: bool=True): pass ...
5
2
29
4
22
3
4
0.19
1
6
0
0
4
9
4
14
127
22
88
41
69
17
60
27
55
9
1
2
14
2,087
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrConvEncoder
from torch import Tensor, nn from ...utils.backbone_utils import load_backbone from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends import torch class DetrConvEncoder(nn.Module): """ Convolutional backbone, using either the AutoBackbone API or one from the timm librar...
class DetrConvEncoder(nn.Module): ''' Convolutional backbone, using either the AutoBackbone API or one from the timm library. nn.BatchNorm2d layers are replaced by DetrFrozenBatchNorm2d as defined above. ''' def __init__(self, config): pass def forward(self, pixel_values: torch.Tensor...
3
1
31
3
25
3
8
0.2
1
4
0
0
2
3
2
12
70
10
50
16
47
10
37
16
34
12
1
4
15
2,088
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrConvModel
from torch import Tensor, nn class DetrConvModel(nn.Module): """ This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder. """ def __init__(self, conv_encoder, position_embedding): super().__init__() self.conv_encoder = conv_encoder ...
class DetrConvModel(nn.Module): ''' This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder. ''' def __init__(self, conv_encoder, position_embedding): pass def forward(self, pixel_values, pixel_mask): pass
3
1
7
1
5
1
2
0.45
1
1
0
0
2
2
2
12
19
3
11
8
8
5
11
8
8
2
1
1
3
2,089
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrDecoder
from .configuration_detr import DetrConfig import torch from torch import Tensor, nn from ...modeling_attn_mask_utils import _prepare_4d_attention_mask class DetrDecoder(DetrPreTrainedModel): """ Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`DetrDecoderLayer`]. The de...
class DetrDecoder(DetrPreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`DetrDecoderLayer`]. The decoder updates the query embeddings through multiple self-attention and cross-attention layers. Some small tweaks for DETR: - object_queries and q...
3
2
79
12
47
21
12
0.53
1
7
3
0
2
5
2
3
174
30
94
29
80
50
51
18
48
22
2
3
23
2,090
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrDecoderLayer
from torch import Tensor, nn import torch from ...modeling_layers import GradientCheckpointingLayer from typing import Optional, Union from ...activations import ACT2FN from .configuration_detr import DetrConfig class DetrDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: DetrConfig): su...
class DetrDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: DetrConfig): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, object_queries: Optional[torch.Tensor]=None, query_position_embeddings: Optional[torch.Tensor]=None, encoder_hid...
3
1
51
6
33
12
2
0.36
1
5
2
0
2
11
2
12
103
12
67
27
55
24
38
18
35
3
1
1
4
2,091
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrDecoderOutput
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput import torch from typing import Optional, Union from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends from dataclasses import dataclass @dataclass @auto_docstring(custom_int...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of the DETR decoder. This class adds one attribute to BaseModelOutputWithCrossAttentions,\n namely an optional stack of intermediate decoder activations, i.e. the output of each decoder layer, each of them\n gone through a layernorm. This is us...
3
1
0
0
0
0
0
11.5
1
0
0
0
0
0
0
0
27
2
2
2
1
23
2
2
1
0
2
0
0
2,092
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrEncoder
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask from .configuration_detr import DetrConfig from torch import Tensor, nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput import torch class DetrEncoder(DetrPreTrainedModel): """ Transformer...
class DetrEncoder(DetrPreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`DetrEncoderLayer`]. The encoder updates the flattened feature map through multiple self-attention layers. Small tweak for DETR: - object_queries are add...
3
2
48
9
27
14
8
0.67
1
7
3
0
2
3
2
3
112
23
54
21
43
36
36
13
33
15
2
3
16
2,093
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrEncoderLayer
from torch import Tensor, nn import torch from typing import Optional, Union from ...activations import ACT2FN from .configuration_detr import DetrConfig class DetrEncoderLayer(nn.Module): def __init__(self, config: DetrConfig): super().__init__() self.embed_dim = config.d_model self.self_...
class DetrEncoderLayer(nn.Module): def __init__(self, config: DetrConfig): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, object_queries: Optional[torch.Tensor]=None, output_attentions: bool=False): ''' Args: hidden_states (`torch.FloatTe...
3
1
34
4
24
6
3
0.25
1
5
2
0
2
9
2
12
69
9
48
22
39
12
33
16
30
4
1
2
5
2,094
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrForObjectDetection
from torch import Tensor, nn import torch from typing import Optional, Union from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends from .configuration_detr import DetrConfig @auto_docstring(custom_intro='\n DETR Model (consisting of a backbone and encoder-decoder Transforme...
null
5
1
63
9
34
21
5
0.59
1
7
4
0
2
3
2
3
130
18
71
27
54
42
27
14
24
8
2
2
9
2,095
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrForSegmentation
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput import torch from typing import Optional, Union from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends from .configuration_detr import DetrConfig @auto_docstring(custom_intro...
null
5
1
95
17
53
26
7
0.47
1
9
6
0
2
3
2
3
194
34
109
43
92
51
50
30
47
13
2
2
14
2,096
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrFrozenBatchNorm2d
import torch from torch import Tensor, nn class DetrFrozenBatchNorm2d(nn.Module): """ BatchNorm2d where the batch statistics and the affine parameters are fixed. Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than torchvision.models.resnet[18,34,50,101...
class DetrFrozenBatchNorm2d(nn.Module): ''' BatchNorm2d where the batch statistics and the affine parameters are fixed. Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than torchvision.models.resnet[18,34,50,101] produce nans. ''' def __init__(s...
4
1
9
0
8
1
1
0.28
1
1
0
0
3
0
3
13
37
5
25
13
19
7
21
11
17
2
1
1
4
2,097
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrLearnedPositionEmbedding
import torch from torch import Tensor, nn class DetrLearnedPositionEmbedding(nn.Module): """ This module learns positional embeddings up to a fixed maximum size. """ def __init__(self, embedding_dim=256): super().__init__() self.row_embeddings = nn.Embedding(50, embedding_dim) ...
class DetrLearnedPositionEmbedding(nn.Module): ''' This module learns positional embeddings up to a fixed maximum size. ''' def __init__(self, embedding_dim=256): pass def forward(self, pixel_values, pixel_mask=None): pass
3
1
8
0
8
0
1
0.19
1
1
0
0
2
2
2
12
21
2
16
11
13
3
16
11
13
1
1
0
2
2,098
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrMHAttentionMap
from typing import Optional, Union from torch import Tensor, nn import torch class DetrMHAttentionMap(nn.Module): """This is a 2D attention module, which only returns the attention softmax (no multiplication by value)""" def __init__(self, query_dim, hidden_dim, num_heads, dropout=0.0, bias=True, std=None): ...
class DetrMHAttentionMap(nn.Module): '''This is a 2D attention module, which only returns the attention softmax (no multiplication by value)''' def __init__(self, query_dim, hidden_dim, num_heads, dropout=0.0, bias=True, std=None): pass def forward(self, q, k, mask: Optional[Tensor]=None): ...
3
1
11
2
10
0
2
0.05
1
3
0
0
2
6
2
12
26
5
20
12
17
1
20
12
17
2
1
1
3
2,099
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py
transformers.models.detr.modeling_detr.DetrMLPPredictionHead
from torch import Tensor, nn class DetrMLPPredictionHead(nn.Module): """ Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates, height and width of a bounding box w.r.t. an image. Copied from https://github.com/facebookresearch/detr/blob/master/mo...
class DetrMLPPredictionHead(nn.Module): ''' Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates, height and width of a bounding box w.r.t. an image. Copied from https://github.com/facebookresearch/detr/blob/master/models/detr.py ''' def ...
3
1
5
0
5
0
2
0.5
1
3
0
0
2
2
2
12
19
4
10
7
7
5
10
7
7
3
1
1
4