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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,900 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTLayer | from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optional, Union
import torch
from torch import nn
from .configuration_vit import ViTConfig
class ViTLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""
def __init__(self,... |
class ViTLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: ViTConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 1 | 18 | 3 | 14 | 3 | 1 | 0.21 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 40 | 7 | 29 | 19 | 21 | 6 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
5,901 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTModel | from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from ...utils.generic import can_return_tuple, check_model_inputs
from .configuration_vit import ViTConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
imp... | @auto_docstring
class ViTModel(ViTPreTrainedModel):
def __init__(self, config: ViTConfig, add_pooling_layer: bool=True, use_mask_token: bool=False):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
use_mask_token (`bool`, *optional*, d... | 8 | 3 | 20 | 3 | 14 | 4 | 4 | 0.23 | 1 | 11 | 6 | 1 | 4 | 5 | 4 | 5 | 93 | 13 | 65 | 27 | 43 | 15 | 33 | 17 | 28 | 9 | 2 | 1 | 14 |
5,902 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTOutput | from .configuration_vit import ViTConfig
import torch
from torch import nn
class ViTOutput(nn.Module):
def __init__(self, config: ViTConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
d... |
class ViTOutput(nn.Module):
def __init__(self, config: ViTConfig):
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 |
5,903 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTPatchEmbeddings | from .configuration_vit import ViTConfig
import torch
from torch import nn
import collections.abc
class ViTPatchEmbeddings(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_leng... |
class ViTPatchEmbeddings(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: ViT... | 3 | 1 | 15 | 1 | 14 | 0 | 4 | 0.18 | 1 | 5 | 0 | 0 | 2 | 5 | 2 | 12 | 37 | 4 | 28 | 13 | 25 | 5 | 22 | 13 | 19 | 4 | 1 | 2 | 7 |
5,904 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTPooler | import torch
from torch import nn
from ...activations import ACT2FN
from .configuration_vit import ViTConfig
class ViTPooler(nn.Module):
def __init__(self, config: ViTConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.pooler_output_size)
self.activation = ACT2FN[... |
class ViTPooler(nn.Module):
def __init__(self, config: ViTConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
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 |
5,905 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTPreTrainedModel | from typing import Callable, Optional, Union
from torch import nn
from .configuration_vit import ViTConfig
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class ViTPreTrainedModel(PreTrainedM... | @auto_docstring
class ViTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]):
'''Initialize the weights'''
pass | 3 | 1 | 25 | 1 | 21 | 3 | 5 | 0.25 | 1 | 1 | 1 | 3 | 1 | 0 | 1 | 1 | 38 | 3 | 28 | 8 | 26 | 7 | 16 | 8 | 14 | 5 | 1 | 2 | 5 |
5,906 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTSelfAttention | from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_vit import ViTConfig
from typing import Callable, Optional, Union
import torch
class ViTSelfAttention(nn.Module):
def __init__(self, config: ViTConfig):
super().__init__()
if config.hidd... |
class ViTSelfAttention(nn.Module):
def __init__(self, config: ViTConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 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 |
5,907 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTSelfOutput | import torch
from .configuration_vit import ViTConfig
from torch import nn
class ViTSelfOutput(nn.Module):
"""
The residual connection is defined in ViTLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, config: ViTConfig... |
class ViTSelfOutput(nn.Module):
'''
The residual connection is defined in ViTLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: ViTConfig):
pass
def forward(self, hidden_states: torch.Tensor, input_t... | 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 |
5,908 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/configuration_vit_mae.py | transformers.models.vit_mae.configuration_vit_mae.ViTMAEConfig | from ...configuration_utils import PretrainedConfig
class ViTMAEConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ViTMAEModel`]. It is used to instantiate an ViT
MAE model according to the specified arguments, defining the model architecture. Instantiating a co... |
class ViTMAEConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ViTMAEModel`]. It is used to instantiate an ViT
MAE model according to the specified arguments, defining the model architecture. Instantiating a configuration with
the defaults will yield a simil... | 2 | 1 | 44 | 1 | 43 | 0 | 1 | 1.29 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 114 | 11 | 45 | 44 | 21 | 58 | 23 | 22 | 21 | 1 | 1 | 0 | 1 |
5,909 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEAttention | from torch import nn
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
import torch
from .configuration_vit_mae import ViTMAEConfig
from typing import Callable, Optional
class ViTMAEAttention(nn.Module):
def __init__(self, config: ViTMAEConfig):
super().__init__()
s... |
class ViTMAEAttention(nn.Module):
def __init__(self, config: ViTMAEConfig):
pass
def prune_heads(self, heads: set[int]):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 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 |
5,910 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEDecoder | from .configuration_vit_mae import ViTMAEConfig
from copy import deepcopy
import torch
from torch import nn
class ViTMAEDecoder(nn.Module):
def __init__(self, config: ViTMAEConfig, num_patches: int):
super().__init__()
self.decoder_embed = nn.Linear(config.hidden_size, config.decoder_hidden_size, ... |
class ViTMAEDecoder(nn.Module):
def __init__(self, config: ViTMAEConfig, num_patches: int):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor) -> torch.Tensor:
'''
This method is a modified version of the interpolation function for ViT-mae model at the decoder, that
... | 5 | 1 | 34 | 5 | 23 | 7 | 3 | 0.32 | 1 | 9 | 2 | 0 | 4 | 8 | 4 | 14 | 141 | 24 | 92 | 37 | 79 | 29 | 60 | 28 | 55 | 10 | 1 | 2 | 13 |
5,911 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEDecoderOutput | import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from dataclasses import dataclass
from typing import Callable, Optional
@dataclass
@auto_docstring(custom_intro="\n Class for ViTMAEDecoder's outputs, with potential hidden states and attentions.\n ")
class ViTM... | @dataclass
@auto_docstring(custom_intro="\n Class for ViTMAEDecoder's outputs, with potential hidden states and attentions.\n ")
class ViTMAEDecoderOutput(ModelOutput):
'''
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, patch_size ** 2 * num_channels)`):
Pixel reconstruction l... | 3 | 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 |
5,912 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEEmbeddings | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
import torch
from torch import nn
class ViTMAEEmbeddings(nn.Module):
"""
Construct the CLS token, position and patch embeddings.
"""
def __init__(self, config):
super().__init__()
self.cls_token =... |
class ViTMAEEmbeddings(nn.Module):
'''
Construct the CLS token, position and patch embeddings.
'''
def __init__(self, config):
pass
def initialize_weights(self):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
... | 6 | 3 | 23 | 5 | 13 | 6 | 2 | 0.49 | 1 | 5 | 1 | 0 | 5 | 6 | 5 | 15 | 127 | 29 | 67 | 35 | 61 | 33 | 57 | 35 | 51 | 2 | 1 | 1 | 8 |
5,913 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEEncoder | from typing import Callable, Optional
from ...modeling_outputs import BaseModelOutput
from torch import nn
from .configuration_vit_mae import ViTMAEConfig
import torch
class ViTMAEEncoder(nn.Module):
def __init__(self, config: ViTMAEConfig):
super().__init__()
self.config = config
self.lay... |
class ViTMAEEncoder(nn.Module):
def __init__(self, config: ViTMAEConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> BaseModelOutput:
pass | 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 |
5,914 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEForPreTraining | import torch
from ...utils.generic import can_return_tuple, check_model_inputs
from .configuration_vit_mae import ViTMAEConfig
from typing import Callable, Optional
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from ...processing_utils import Unpack
@auto_docstring(custom_int... | @auto_docstring(custom_intro='\n The ViTMAE Model transformer with the decoder on top for self-supervised pre-training.\n\n <Tip>\n\n Note that we provide a script to pre-train this model on custom data in our [examples\n directory](https://github.com/huggingface/transformers/tree/main/examples/pytorch/imag... | 11 | 5 | 27 | 3 | 16 | 9 | 2 | 0.55 | 1 | 7 | 3 | 0 | 7 | 3 | 7 | 8 | 197 | 25 | 113 | 45 | 94 | 62 | 61 | 35 | 53 | 4 | 2 | 1 | 16 |
5,915 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEForPreTrainingOutput | from typing import Callable, Optional
from dataclasses import dataclass
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
@dataclass
@auto_docstring(custom_intro="\n Class for ViTMAEForPreTraining's outputs, with potential hidden states and attentions.\n ")
cla... | @dataclass
@auto_docstring(custom_intro="\n Class for ViTMAEForPreTraining's outputs, with potential hidden states and attentions.\n ")
class ViTMAEForPreTrainingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`):
Pixel reconstruction loss.
logits (`torch.FloatTensor` of shape... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.86 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 29 | 2 | 7 | 7 | 6 | 20 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
5,916 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEIntermediate | from torch import nn
from .configuration_vit_mae import ViTMAEConfig
import torch
from ...activations import ACT2FN
class ViTMAEIntermediate(nn.Module):
def __init__(self, config: ViTMAEConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isin... |
class ViTMAEIntermediate(nn.Module):
def __init__(self, config: ViTMAEConfig):
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 |
5,917 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAELayer | from torch import nn
from typing import Callable, Optional
from .configuration_vit_mae import ViTMAEConfig
import torch
from ...modeling_layers import GradientCheckpointingLayer
class ViTMAELayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""
def __init__(se... |
class ViTMAELayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: ViTMAEConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 1 | 18 | 3 | 14 | 3 | 1 | 0.21 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 40 | 7 | 29 | 19 | 21 | 6 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
5,918 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEModel | import torch
from typing import Callable, Optional
from ...utils.generic import can_return_tuple, check_model_inputs
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutput
@auto... | @auto_docstring
class ViTMAEModel(ViTMAEPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
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} ... | 8 | 2 | 23 | 4 | 13 | 6 | 3 | 0.46 | 1 | 6 | 3 | 0 | 4 | 4 | 4 | 5 | 96 | 17 | 54 | 23 | 38 | 25 | 27 | 13 | 22 | 6 | 2 | 1 | 10 |
5,919 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEModelOutput | import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from typing import Callable, Optional
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro="\n Class for ViTMAEModel's outputs, with potential hidden states and attentions.\n ")
class ViTMAE... | @dataclass
@auto_docstring(custom_intro="\n Class for ViTMAEModel's outputs, with potential hidden states and attentions.\n ")
class ViTMAEModelOutput(ModelOutput):
'''
mask (`torch.FloatTensor` of shape `(batch_size, sequence_length)`):
Tensor indicating which patches are masked (1) and which are... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 2 | 6 | 6 | 5 | 18 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,920 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEOutput | import torch
from torch import nn
from .configuration_vit_mae import ViTMAEConfig
class ViTMAEOutput(nn.Module):
def __init__(self, config: ViTMAEConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout... |
class ViTMAEOutput(nn.Module):
def __init__(self, config: ViTMAEConfig):
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 |
5,921 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEPatchEmbeddings | from torch import nn
import collections.abc
class ViTMAEPatchEmbeddings(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
Transform... |
class ViTMAEPatchEmbeddings(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 | 4 | 0 | 0 | 2 | 5 | 2 | 12 | 34 | 4 | 25 | 13 | 22 | 5 | 21 | 13 | 18 | 3 | 1 | 1 | 6 |
5,922 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAEPreTrainedModel | from torch import nn
from .configuration_vit_mae import ViTMAEConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class ViTMAEPreTrainedModel(PreTrainedModel):
config: ViTMAEConfig
... | @auto_docstring
class ViTMAEPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.5 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 23 | 2 | 14 | 7 | 12 | 7 | 13 | 7 | 11 | 4 | 1 | 2 | 4 |
5,923 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAESelfAttention | from torch import nn
import torch
from .configuration_vit_mae import ViTMAEConfig
from typing import Callable, Optional
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
class ViTMAESelfAttention(nn.Module):
def __init__(self, config: ViTMAEConfig):
super().__init__()
if confi... |
class ViTMAESelfAttention(nn.Module):
def __init__(self, config: ViTMAEConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 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 |
5,924 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_mae/modeling_vit_mae.py | transformers.models.vit_mae.modeling_vit_mae.ViTMAESelfOutput | from .configuration_vit_mae import ViTMAEConfig
from torch import nn
import torch
class ViTMAESelfOutput(nn.Module):
"""
The residual connection is defined in ViTMAELayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, conf... |
class ViTMAESelfOutput(nn.Module):
'''
The residual connection is defined in ViTMAELayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: ViTMAEConfig):
pass
def forward(self, hidden_states: torch.Tensor... | 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 |
5,925 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/configuration_vit_msn.py | transformers.models.vit_msn.configuration_vit_msn.ViTMSNConfig | from ...configuration_utils import PretrainedConfig
class ViTMSNConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ViTMSNModel`]. It is used to instantiate an ViT
MSN model according to the specified arguments, defining the model architecture. Instantiating a co... |
class ViTMSNConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ViTMSNModel`]. It is used to instantiate an ViT
MSN model according to the specified arguments, defining the model architecture. Instantiating a configuration with
the defaults will yield a simil... | 2 | 1 | 32 | 1 | 31 | 0 | 1 | 1.36 | 1 | 1 | 0 | 0 | 1 | 13 | 1 | 1 | 89 | 11 | 33 | 32 | 15 | 45 | 17 | 16 | 15 | 1 | 1 | 0 | 1 |
5,926 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNAttention | from torch import nn
import torch
from .configuration_vit_msn import ViTMSNConfig
from typing import Callable, Optional, Union
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
class ViTMSNAttention(nn.Module):
def __init__(self, config: ViTMSNConfig):
super().__init__()
... |
class ViTMSNAttention(nn.Module):
def __init__(self, config: ViTMSNConfig):
pass
def prune_heads(self, heads: set[int]):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 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 |
5,927 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNEmbeddings | import torch
from torch import nn
from .configuration_vit_msn import ViTMSNConfig
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from typing import Callable, Optional, Union
class ViTMSNEmbeddings(nn.Module):
"""
Construct the CLS token, position and patch embeddings. Optionally, a... |
class ViTMSNEmbeddings(nn.Module):
'''
Construct the CLS token, position and patch embeddings. Optionally, also the mask token.
'''
def __init__(self, config: ViTMSNConfig, use_mask_token: bool=False) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, ... | 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 |
5,928 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNEncoder | import torch
from torch import nn
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from .configuration_vit_msn import ViTMSNConfig
class ViTMSNEncoder(nn.Module):
def __init__(self, config: ViTMSNConfig):
super().__init__()
self.co... |
class ViTMSNEncoder(nn.Module):
def __init__(self, config: ViTMSNConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> BaseModelOutput:
pass | 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 |
5,929 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNForImageClassification | from ...processing_utils import Unpack
import torch
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from .configuration_vit_msn import ViTMSNConfig
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from ...utils.generic import... | @auto_docstring
class ViTMSNForImageClassification(ViTMSNPreTrainedModel):
def __init__(self, config: ViTMSNConfig) -> None:
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, labels: Optional[torch.Tensor]... | 6 | 1 | 48 | 8 | 29 | 12 | 7 | 0.38 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 100 | 17 | 60 | 22 | 46 | 23 | 32 | 12 | 29 | 12 | 2 | 3 | 14 |
5,930 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNIntermediate | from ...activations import ACT2FN
from .configuration_vit_msn import ViTMSNConfig
from torch import nn
import torch
class ViTMSNIntermediate(nn.Module):
def __init__(self, config: ViTMSNConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isin... |
class ViTMSNIntermediate(nn.Module):
def __init__(self, config: ViTMSNConfig):
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 |
5,931 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNLayer | from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_vit_msn import ViTMSNConfig
import torch
from torch import nn
class ViTMSNLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""
def __in... |
class ViTMSNLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: ViTMSNConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 1 | 18 | 3 | 14 | 3 | 1 | 0.21 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 40 | 7 | 29 | 19 | 21 | 6 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
5,932 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNModel | from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from .configuration_vit_msn import ViTMSNConfig
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
import torch
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from ...utils.generic import... | @auto_docstring
class ViTMSNModel(ViTMSNPreTrainedModel):
def __init__(self, config: ViTMSNConfig, use_mask_token: bool=False):
'''
use_mask_token (`bool`, *optional*, defaults to `False`):
Whether to use a mask token for masked image modeling.
'''
pass
def get_inpu... | 8 | 3 | 23 | 4 | 13 | 7 | 3 | 0.55 | 1 | 11 | 5 | 0 | 4 | 4 | 4 | 5 | 99 | 17 | 53 | 24 | 37 | 29 | 28 | 14 | 23 | 6 | 2 | 1 | 10 |
5,933 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNOutput | from .configuration_vit_msn import ViTMSNConfig
from torch import nn
import torch
class ViTMSNOutput(nn.Module):
def __init__(self, config: ViTMSNConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout... |
class ViTMSNOutput(nn.Module):
def __init__(self, config: ViTMSNConfig):
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 |
5,934 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNPatchEmbeddings | from torch import nn
import torch
from .configuration_vit_msn import ViTMSNConfig
import collections.abc
class ViTMSNPatchEmbeddings(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... |
class ViTMSNPatchEmbeddings(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 | 15 | 1 | 14 | 0 | 4 | 0.18 | 1 | 5 | 0 | 0 | 2 | 5 | 2 | 12 | 37 | 4 | 28 | 13 | 25 | 5 | 22 | 13 | 19 | 4 | 1 | 2 | 7 |
5,935 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNPreTrainedModel | from typing import Callable, Optional, Union
from .configuration_vit_msn import ViTMSNConfig
from torch import nn
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class ViTMSNPreTrainedModel(PreTrainedMode... | @auto_docstring
class ViTMSNPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.6 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 26 | 2 | 15 | 8 | 13 | 9 | 14 | 8 | 12 | 4 | 1 | 2 | 4 |
5,936 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNSelfAttention | from typing import Callable, Optional, Union
from .configuration_vit_msn import ViTMSNConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
import torch
class ViTMSNSelfAttention(nn.Module):
def __init__(self, config: ViTMSNConfig):
super().__init__()
i... |
class ViTMSNSelfAttention(nn.Module):
def __init__(self, config: ViTMSNConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 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 |
5,937 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit_msn/modeling_vit_msn.py | transformers.models.vit_msn.modeling_vit_msn.ViTMSNSelfOutput | from .configuration_vit_msn import ViTMSNConfig
from torch import nn
import torch
class ViTMSNSelfOutput(nn.Module):
"""
The residual connection is defined in ViTMSNLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, conf... |
class ViTMSNSelfOutput(nn.Module):
'''
The residual connection is defined in ViTMSNLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: ViTMSNConfig):
pass
def forward(self, hidden_states: torch.Tensor... | 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 |
5,938 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/configuration_vitdet.py | transformers.models.vitdet.configuration_vitdet.VitDetConfig | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from ...configuration_utils import PretrainedConfig
class VitDetConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VitDetModel`]. It is used to i... |
class VitDetConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VitDetModel`]. It is used to instantiate an
VitDet model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the default... | 2 | 1 | 51 | 2 | 49 | 0 | 1 | 1.31 | 2 | 2 | 0 | 0 | 1 | 22 | 1 | 6 | 129 | 11 | 51 | 48 | 25 | 67 | 25 | 24 | 23 | 1 | 1 | 0 | 1 |
5,939 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetAttention | from torch import nn
import torch
class VitDetAttention(nn.Module):
"""Multi-head Attention block with relative position embeddings."""
def __init__(self, config, input_size=None):
"""
Args:
config (`VitDetConfig`):
Model configuration.
input_size (`tupl... |
class VitDetAttention(nn.Module):
'''Multi-head Attention block with relative position embeddings.'''
def __init__(self, config, input_size=None):
'''
Args:
config (`VitDetConfig`):
Model configuration.
input_size (`tuple[int]`, *optional*):
... | 3 | 2 | 28 | 5 | 18 | 5 | 3 | 0.3 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 60 | 12 | 37 | 19 | 34 | 11 | 32 | 19 | 29 | 3 | 1 | 1 | 5 |
5,940 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetBackbone | from ...modeling_outputs import BackboneOutput, BaseModelOutput
import torch
from typing import Optional, Union
from ...utils.backbone_utils import BackboneMixin
from ...utils import auto_docstring, logging
@auto_docstring(custom_intro='\n ViTDet backbone, to be used with frameworks like Mask R-CNN.\n ')
class V... | @auto_docstring(custom_intro='\n ViTDet backbone, to be used with frameworks like Mask R-CNN.\n ')
class VitDetBackbone(VitDetPreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
def get_input_embeddings(self) -> VitDetEmbeddings:
pass
@auto_docstring
def forward(sel... | 6 | 1 | 25 | 5 | 15 | 5 | 4 | 0.34 | 2 | 8 | 3 | 0 | 3 | 3 | 3 | 16 | 79 | 16 | 47 | 20 | 35 | 16 | 27 | 13 | 23 | 10 | 2 | 2 | 12 |
5,941 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetDropPath | import torch
from typing import Optional, Union
from torch import nn
class VitDetDropPath(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 = ... |
class VitDetDropPath(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 |
5,942 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetEmbeddings | import torch
import collections.abc
import math
from torch import nn
class VitDetEmbeddings(nn.Module):
"""
This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial
`hidden_states` (patch embeddings) to be consumed by a Transformer.
"""
def __init__(sel... |
class VitDetEmbeddings(nn.Module):
'''
This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial
`hidden_states` (patch embeddings) to be consumed by a Transformer.
'''
def __init__(self, config):
pass
def get_absolute_positions(self, abs_po... | 4 | 2 | 26 | 3 | 16 | 7 | 4 | 0.5 | 1 | 5 | 0 | 0 | 3 | 6 | 3 | 13 | 86 | 12 | 50 | 19 | 46 | 25 | 38 | 19 | 34 | 4 | 1 | 1 | 11 |
5,943 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetEncoder | import torch
from typing import Optional, Union
from .configuration_vitdet import VitDetConfig
from ...modeling_outputs import BackboneOutput, BaseModelOutput
from torch import nn
class VitDetEncoder(nn.Module):
def __init__(self, config: VitDetConfig) -> None:
super().__init__()
self.config = con... |
class VitDetEncoder(nn.Module):
def __init__(self, config: VitDetConfig) -> 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 | 32 | 5 | 26 | 1 | 7 | 0.02 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 65 | 11 | 53 | 22 | 43 | 1 | 29 | 15 | 26 | 10 | 1 | 2 | 13 |
5,944 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetLayer | import torch
from .configuration_vitdet import VitDetConfig
from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
from torch import nn
class VitDetLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the original implementation."""
def __init__(se... |
class VitDetLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the original implementation.'''
def __init__(self, config: VitDetConfig, drop_path_rate: float=0, window_size: int=0, use_residual_block: bool=False) -> None:
pass
def forward(self, hidden_states: torch.Tenso... | 3 | 1 | 35 | 8 | 25 | 3 | 4 | 0.12 | 1 | 10 | 5 | 0 | 2 | 8 | 2 | 12 | 73 | 18 | 50 | 25 | 40 | 6 | 33 | 18 | 30 | 4 | 1 | 1 | 8 |
5,945 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetLayerNorm | from torch import nn
import torch
class VitDetLayerNorm(nn.Module):
"""
A LayerNorm variant, popularized by Transformers, that performs point-wise mean and variance normalization over the
channel dimension for inputs that have shape (batch_size, channels, height, width).
https://github.com/facebookrese... |
class VitDetLayerNorm(nn.Module):
'''
A LayerNorm variant, popularized by Transformers, that performs point-wise mean and variance normalization over the
channel dimension for inputs that have shape (batch_size, channels, height, width).
https://github.com/facebookresearch/ConvNeXt/blob/d1fa8f6fef0a165... | 3 | 1 | 6 | 0 | 6 | 0 | 1 | 0.38 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 20 | 2 | 13 | 9 | 10 | 5 | 13 | 9 | 10 | 1 | 1 | 0 | 2 |
5,946 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetMlp | from torch import nn
import torch
from ...activations import ACT2FN
class VitDetMlp(nn.Module):
def __init__(self, config, in_features: int, hidden_features: int) -> None:
super().__init__()
self.fc1 = nn.Linear(in_features, hidden_features)
self.act = ACT2FN[config.hidden_act]
sel... |
class VitDetMlp(nn.Module):
def __init__(self, config, in_features: int, hidden_features: int) -> None:
pass
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 1 | 7 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 4 | 2 | 12 | 16 | 2 | 14 | 7 | 11 | 0 | 14 | 7 | 11 | 1 | 1 | 0 | 2 |
5,947 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetModel | from .configuration_vitdet import VitDetConfig
from typing import Optional, Union
from ...modeling_outputs import BackboneOutput, BaseModelOutput
import torch
from ...utils import auto_docstring, logging
@auto_docstring
class VitDetModel(VitDetPreTrainedModel):
def __init__(self, config: VitDetConfig):
su... | @auto_docstring
class VitDetModel(VitDetPreTrainedModel):
def __init__(self, config: VitDetConfig):
pass
def get_input_embeddings(self) -> VitDetEmbeddings:
pass
def _prune_heads(self, heads_to_prune: dict[int, list[int]]) -> None:
'''
Prunes heads of the model. heads_to_p... | 7 | 2 | 21 | 4 | 11 | 6 | 3 | 0.54 | 1 | 9 | 4 | 0 | 4 | 3 | 4 | 5 | 88 | 17 | 46 | 20 | 32 | 25 | 25 | 12 | 20 | 6 | 2 | 1 | 10 |
5,948 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetPreTrainedModel | from ...utils import auto_docstring, logging
from .configuration_vitdet import VitDetConfig
import torch
from ...modeling_utils import PreTrainedModel
from torch import nn
from typing import Optional, Union
@auto_docstring
class VitDetPreTrainedModel(PreTrainedModel):
config: VitDetConfig
base_model_prefix = '... | @auto_docstring
class VitDetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 42 | 3 | 35 | 4 | 9 | 0.2 | 1 | 3 | 3 | 2 | 1 | 0 | 1 | 1 | 54 | 5 | 41 | 8 | 39 | 8 | 23 | 8 | 21 | 9 | 1 | 2 | 9 |
5,949 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitdet/modeling_vitdet.py | transformers.models.vitdet.modeling_vitdet.VitDetResBottleneckBlock | from ...activations import ACT2FN
from torch import nn
class VitDetResBottleneckBlock(nn.Module):
"""
The standard bottleneck residual block without the last activation layer. It contains 3 conv layers with kernels
1x1, 3x3, 1x1.
"""
def __init__(self, config, in_channels, out_channels, bottleneck... |
class VitDetResBottleneckBlock(nn.Module):
'''
The standard bottleneck residual block without the last activation layer. It contains 3 conv layers with kernels
1x1, 3x3, 1x1.
'''
def __init__(self, config, in_channels, out_channels, bottleneck_channels):
'''
Args:
confi... | 3 | 2 | 15 | 2 | 8 | 6 | 2 | 0.88 | 1 | 2 | 1 | 0 | 2 | 8 | 2 | 12 | 37 | 5 | 17 | 13 | 14 | 15 | 17 | 13 | 14 | 2 | 1 | 1 | 3 |
5,950 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/configuration_vitmatte.py | transformers.models.vitmatte.configuration_vitmatte.VitMatteConfig | from ..auto.configuration_auto import CONFIG_MAPPING
from ...configuration_utils import PretrainedConfig
from ...utils.backbone_utils import verify_backbone_config_arguments
import copy
class VitMatteConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of [`VitMatteForImageM... |
class VitMatteConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of [`VitMatteForImageMatting`]. It is used to
instantiate a ViTMatte model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will y... | 5 | 2 | 26 | 2 | 22 | 2 | 2 | 1 | 1 | 4 | 0 | 0 | 2 | 10 | 2 | 2 | 105 | 13 | 46 | 30 | 30 | 46 | 26 | 17 | 23 | 3 | 1 | 1 | 4 |
5,951 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/image_processing_vitmatte.py | transformers.models.vitmatte.image_processing_vitmatte.VitMatteImageProcessor | from ...utils import TensorType, filter_out_non_signature_kwargs, logging
from typing import Optional, Union
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, get_image_size, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, ... |
class VitMatteImageProcessor(BaseImageProcessor):
'''
Constructs a ViTMatte image processor.
Args:
do_rescale (`bool`, *optional*, defaults to `True`):
Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the `do_rescale`
parameter in th... | 10 | 3 | 65 | 6 | 39 | 21 | 8 | 0.72 | 1 | 9 | 2 | 0 | 3 | 7 | 3 | 23 | 228 | 22 | 120 | 48 | 85 | 86 | 55 | 17 | 51 | 15 | 3 | 1 | 24 |
5,952 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.ImageMattingOutput | from typing import Optional
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring
import torch
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of image matting models.\n ')
class ImageMattingOutput(ModelOutput):
"""
loss (`torch.FloatTensor` of shape `(1,)`, *op... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of image matting models.\n ')
class ImageMattingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Loss.
alphas (`torch.FloatTensor` of shape `(batch_size, num_channe... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 3 | 5 | 5 | 4 | 17 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
5,953 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.VitMatteBasicConv3x3 | from torch import nn
class VitMatteBasicConv3x3(nn.Module):
"""
Basic convolution layers including: Conv3x3, BatchNorm2d, ReLU layers.
"""
def __init__(self, config, in_channels, out_channels, stride=2, padding=1):
super().__init__()
self.conv = nn.Conv2d(in_channels=in_channels, out_c... |
class VitMatteBasicConv3x3(nn.Module):
'''
Basic convolution layers including: Conv3x3, BatchNorm2d, ReLU layers.
'''
def __init__(self, config, in_channels, out_channels, stride=2, padding=1):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 9 | 1 | 9 | 0 | 1 | 0.17 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 24 | 3 | 18 | 6 | 15 | 3 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
5,954 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.VitMatteConvStream | from torch import nn
class VitMatteConvStream(nn.Module):
"""
Simple ConvStream containing a series of basic conv3x3 layers to extract detail features.
"""
def __init__(self, config):
super().__init__()
in_channels = 4
if config.backbone_config is not None:
in_chann... |
class VitMatteConvStream(nn.Module):
'''
Simple ConvStream containing a series of basic conv3x3 layers to extract detail features.
'''
def __init__(self, config):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 14 | 3 | 10 | 1 | 3 | 0.24 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 33 | 7 | 21 | 14 | 18 | 5 | 21 | 14 | 18 | 3 | 1 | 1 | 5 |
5,955 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.VitMatteDetailCaptureModule | import torch
from torch import nn
class VitMatteDetailCaptureModule(nn.Module):
"""
Simple and lightweight Detail Capture Module for ViT Matting.
"""
def __init__(self, config):
super().__init__()
if len(config.fusion_hidden_sizes) != len(config.convstream_hidden_sizes) + 1:
... |
class VitMatteDetailCaptureModule(nn.Module):
'''
Simple and lightweight Detail Capture Module for ViT Matting.
'''
def __init__(self, config):
pass
def forward(self, features, pixel_values):
pass | 3 | 1 | 17 | 3 | 14 | 0 | 3 | 0.11 | 1 | 7 | 3 | 0 | 2 | 6 | 2 | 12 | 39 | 8 | 28 | 14 | 25 | 3 | 20 | 14 | 17 | 3 | 1 | 1 | 5 |
5,956 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.VitMatteForImageMatting | from ...utils import ModelOutput, auto_docstring
from ...utils.backbone_utils import load_backbone
import torch
from typing import Optional
@auto_docstring(custom_intro='\n ViTMatte framework leveraging any vision backbone e.g. for ADE20k, CityScapes.\n ')
class VitMatteForImageMatting(VitMattePreTrainedModel):
... | @auto_docstring(custom_intro='\n ViTMatte framework leveraging any vision backbone e.g. for ADE20k, CityScapes.\n ')
class VitMatteForImageMatting(VitMattePreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.Tensor]=None, output_att... | 5 | 1 | 39 | 7 | 18 | 14 | 4 | 0.72 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 3 | 82 | 15 | 39 | 19 | 27 | 28 | 21 | 11 | 18 | 7 | 2 | 1 | 8 |
5,957 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.VitMatteFusionBlock | from torch import nn
import torch
class VitMatteFusionBlock(nn.Module):
"""
Simple fusion block to fuse features from ConvStream and Plain Vision Transformer.
"""
def __init__(self, config, in_channels, out_channels):
super().__init__()
self.conv = VitMatteBasicConv3x3(config, in_chann... |
class VitMatteFusionBlock(nn.Module):
'''
Simple fusion block to fuse features from ConvStream and Plain Vision Transformer.
'''
def __init__(self, config, in_channels, out_channels):
pass
def forward(self, features, detailed_feature_map):
pass | 3 | 1 | 5 | 1 | 4 | 0 | 1 | 0.33 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 12 | 15 | 3 | 9 | 6 | 6 | 3 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
5,958 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.VitMatteHead | from torch import nn
class VitMatteHead(nn.Module):
"""
Simple Matting Head, containing only conv3x3 and conv1x1 layers.
"""
def __init__(self, config):
super().__init__()
in_channels = config.fusion_hidden_sizes[-1]
mid_channels = 16
self.matting_convs = nn.Sequential(... |
class VitMatteHead(nn.Module):
'''
Simple Matting Head, containing only conv3x3 and conv1x1 layers.
'''
def __init__(self, config):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 8 | 2 | 7 | 0 | 1 | 0.21 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 22 | 5 | 14 | 6 | 11 | 3 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
5,959 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitmatte/modeling_vitmatte.py | transformers.models.vitmatte.modeling_vitmatte.VitMattePreTrainedModel | from ...utils import ModelOutput, auto_docstring
from .configuration_vitmatte import VitMatteConfig
from torch import nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class VitMattePreTrainedModel(PreTrainedModel):
config: VitMatteConfig
main_input_name = 'pixel_values'
supports_gradient_ch... | @auto_docstring
class VitMattePreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 3 | 0.4 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 16 | 2 | 10 | 6 | 8 | 4 | 10 | 6 | 8 | 3 | 1 | 2 | 3 |
5,960 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose/configuration_vitpose.py | transformers.models.vitpose.configuration_vitpose.VitPoseConfig | from ..auto.configuration_auto import CONFIG_MAPPING
from ...configuration_utils import PretrainedConfig
from typing import Optional
from ...utils.backbone_utils import verify_backbone_config_arguments
class VitPoseConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`... |
class VitPoseConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VitPoseForPoseEstimation`]. It is used to instantiate a
VitPose model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will ... | 4 | 1 | 46 | 5 | 41 | 0 | 5 | 0.88 | 1 | 7 | 0 | 0 | 1 | 8 | 1 | 1 | 96 | 15 | 43 | 24 | 30 | 38 | 23 | 13 | 21 | 5 | 1 | 1 | 5 |
5,961 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose/image_processing_vitpose.py | transformers.models.vitpose.image_processing_vitpose.VitPoseImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature
import itertools
from typing import TYPE_CHECKING, Optional, Union
import numpy as np
from ...utils import TensorType, is_scipy_available, is_torch_available, is_vision_available, logging
from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DE... |
class VitPoseImageProcessor(BaseImageProcessor):
'''
Constructs a VitPose image processor.
Args:
do_affine_transform (`bool`, *optional*, defaults to `True`):
Whether to apply an affine transformation to the input images.
size (`dict[str, int]` *optional*, defaults to `{"height"... | 6 | 5 | 65 | 9 | 36 | 21 | 7 | 0.68 | 1 | 13 | 2 | 0 | 5 | 8 | 5 | 25 | 354 | 51 | 180 | 96 | 128 | 123 | 107 | 50 | 101 | 19 | 3 | 3 | 36 |
5,962 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose/modeling_vitpose.py | transformers.models.vitpose.modeling_vitpose.VitPoseClassicDecoder | from torch import nn
import torch
from typing import Optional, Union
from .configuration_vitpose import VitPoseConfig
class VitPoseClassicDecoder(nn.Module):
"""
Classic decoding head consisting of a 2 deconvolutional blocks, followed by a 1x1 convolution layer,
turning the feature maps into heatmaps.
... |
class VitPoseClassicDecoder(nn.Module):
'''
Classic decoding head consisting of a 2 deconvolutional blocks, followed by a 1x1 convolution layer,
turning the feature maps into heatmaps.
'''
def __init__(self, config: VitPoseConfig):
pass
def forward(self, hidden_state: torch.Tensor, fl... | 3 | 1 | 15 | 4 | 11 | 0 | 2 | 0.17 | 1 | 3 | 1 | 0 | 2 | 7 | 2 | 12 | 36 | 9 | 23 | 11 | 20 | 4 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
5,963 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose/modeling_vitpose.py | transformers.models.vitpose.modeling_vitpose.VitPoseEstimatorOutput | import torch
from typing import Optional, Union
from dataclasses import dataclass
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of pose estimation models.\n ')
class VitPoseEstimatorOutput(ModelOutput):
"""
loss... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of pose estimation models.\n ')
class VitPoseEstimatorOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Loss is not supported at this moment. See https://github.com/ViTA... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 3 | 5 | 5 | 4 | 17 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
5,964 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose/modeling_vitpose.py | transformers.models.vitpose.modeling_vitpose.VitPoseForPoseEstimation | from ...utils.backbone_utils import load_backbone
from ...modeling_outputs import BackboneOutput
from ...processing_utils import Unpack
from typing import Optional, Union
from ...utils.generic import can_return_tuple
import torch
from .configuration_vitpose import VitPoseConfig
from ...utils import ModelOutput, Transfo... | @auto_docstring(custom_intro='\n The VitPose model with a pose estimation head on top.\n ')
class VitPoseForPoseEstimation(VitPosePreTrainedModel):
def __init__(self, config: VitPoseConfig):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: torch.Tensor, dataset_index... | 6 | 1 | 47 | 8 | 28 | 11 | 7 | 0.36 | 1 | 10 | 4 | 0 | 2 | 2 | 2 | 3 | 97 | 17 | 59 | 23 | 45 | 21 | 32 | 13 | 29 | 9 | 2 | 2 | 14 |
5,965 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose/modeling_vitpose.py | transformers.models.vitpose.modeling_vitpose.VitPosePreTrainedModel | from torch import nn
from typing import Optional, Union
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
from ...modeling_utils import PreTrainedModel
from .configuration_vitpose import VitPoseConfig
@auto_docstring
class VitPosePreTrainedModel(PreTrainedModel):
config: Vi... | @auto_docstring
class VitPosePreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]):
'''Initialize the weights'''
pass | 3 | 1 | 13 | 0 | 10 | 3 | 4 | 0.47 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 24 | 2 | 15 | 6 | 13 | 7 | 12 | 6 | 10 | 4 | 1 | 2 | 4 |
5,966 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose/modeling_vitpose.py | transformers.models.vitpose.modeling_vitpose.VitPoseSimpleDecoder | import torch
from .configuration_vitpose import VitPoseConfig
from torch import nn
from typing import Optional, Union
class VitPoseSimpleDecoder(nn.Module):
"""
Simple decoding head consisting of a ReLU activation, 4x upsampling and a 3x3 convolution, turning the
feature maps into heatmaps.
"""
de... |
class VitPoseSimpleDecoder(nn.Module):
'''
Simple decoding head consisting of a ReLU activation, 4x upsampling and a 3x3 convolution, turning the
feature maps into heatmaps.
'''
def __init__(self, config: VitPoseConfig):
pass
def forward(self, hidden_state: torch.Tensor, flip_pairs: O... | 3 | 1 | 9 | 2 | 7 | 1 | 2 | 0.33 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 25 | 5 | 15 | 7 | 12 | 5 | 13 | 7 | 10 | 2 | 1 | 1 | 3 |
5,967 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/configuration_vitpose_backbone.py | transformers.models.vitpose_backbone.configuration_vitpose_backbone.VitPoseBackboneConfig | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from ...configuration_utils import PretrainedConfig
class VitPoseBackboneConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VitPoseBackbone`]. It... |
class VitPoseBackboneConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VitPoseBackbone`]. It is used to instantiate a
VitPose model according to the specified arguments, defining the model architecture. Instantiating a configuration
wit... | 2 | 1 | 42 | 1 | 41 | 0 | 1 | 1.37 | 2 | 2 | 0 | 0 | 1 | 18 | 1 | 6 | 112 | 10 | 43 | 40 | 21 | 59 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
5,968 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackbone | from typing import Callable, Optional, Union
from .configuration_vitpose_backbone import VitPoseBackboneConfig
from ...utils.backbone_utils import BackboneMixin
from ...utils.generic import check_model_inputs
from ...utils import auto_docstring, logging
from ...modeling_outputs import BackboneOutput, BaseModelOutput
fr... | @auto_docstring(custom_intro='\n The VitPose backbone useful for downstream tasks.\n ')
class VitPoseBackbone(VitPoseBackbonePreTrainedModel, BackboneMixin):
def __init__(self, config: VitPoseBackboneConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, pixel_values: torch.T... | 6 | 1 | 40 | 7 | 25 | 9 | 6 | 0.35 | 2 | 9 | 4 | 0 | 2 | 4 | 2 | 15 | 84 | 14 | 52 | 22 | 39 | 18 | 28 | 13 | 25 | 10 | 2 | 2 | 11 |
5,969 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneAttention | import torch
from .configuration_vitpose_backbone import VitPoseBackboneConfig
from typing import Callable, Optional, Union
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
class VitPoseBackboneAttention(nn.Module):
def __init__(self, config: VitPoseBackboneCo... |
class VitPoseBackboneAttention(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
pass
def prune_heads(self, heads: set[int]):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 4 | 0 | 11 | 1 | 9 | 1 | 1 | 0.1 | 1 | 8 | 3 | 0 | 3 | 3 | 3 | 13 | 37 | 6 | 29 | 16 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
5,970 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneEmbeddings | import torch
from .configuration_vitpose_backbone import VitPoseBackboneConfig
from torch import nn
class VitPoseBackboneEmbeddings(nn.Module):
"""
Construct the position and patch embeddings.
"""
def __init__(self, config: VitPoseBackboneConfig):
super().__init__()
self.patch_embeddin... |
class VitPoseBackboneEmbeddings(nn.Module):
'''
Construct the position and patch embeddings.
'''
def __init__(self, config: VitPoseBackboneConfig):
pass
def forward(self, pixel_values: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 8 | 2 | 6 | 1 | 1 | 0.33 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 22 | 6 | 12 | 8 | 9 | 4 | 12 | 8 | 9 | 1 | 1 | 0 | 2 |
5,971 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneEncoder | from .configuration_vitpose_backbone import VitPoseBackboneConfig
from typing import Callable, Optional, Union
from ...modeling_outputs import BackboneOutput, BaseModelOutput
from torch import nn
import torch
class VitPoseBackboneEncoder(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
super... |
class VitPoseBackboneEncoder(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
pass
def forward(self, hidden_states: torch.Tensor, dataset_index: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_hidden_states: Optional[bool]=None) -> BaseModelOutput:
pa... | 3 | 0 | 25 | 4 | 21 | 0 | 6 | 0.02 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 52 | 8 | 43 | 19 | 32 | 1 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
5,972 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneLayer | from .configuration_vitpose_backbone import VitPoseBackboneConfig
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optional, Union
import torch
class VitPoseBackboneLayer(GradientCheckpointingLayer):
def __init__(self, config: VitPoseBackboneConfig):
... |
class VitPoseBackboneLayer(GradientCheckpointingLayer):
def __init__(self, config: VitPoseBackboneConfig):
pass
def forward(self, hidden_states: torch.Tensor, dataset_index: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 0 | 22 | 3 | 18 | 3 | 3 | 0.14 | 1 | 8 | 4 | 0 | 2 | 5 | 2 | 12 | 46 | 6 | 37 | 18 | 28 | 5 | 22 | 12 | 19 | 3 | 1 | 1 | 5 |
5,973 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneMLP | from torch import nn
import torch
from ...activations import ACT2FN
from .configuration_vitpose_backbone import VitPoseBackboneConfig
class VitPoseBackboneMLP(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
super().__init__()
in_features = out_features = config.hidden_size
h... |
class VitPoseBackboneMLP(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
pass
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 14 | 1 | 13 | 8 | 10 | 0 | 13 | 8 | 10 | 1 | 1 | 0 | 2 |
5,974 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneMoeMLP | import torch
from ...activations import ACT2FN
from .configuration_vitpose_backbone import VitPoseBackboneConfig
from torch import nn
class VitPoseBackboneMoeMLP(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
super().__init__()
in_features = out_features = config.hidden_size
... |
class VitPoseBackboneMoeMLP(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
pass
def forward(self, hidden_state: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 18 | 4 | 13 | 1 | 2 | 0.04 | 1 | 5 | 1 | 0 | 2 | 7 | 2 | 12 | 37 | 9 | 27 | 20 | 24 | 1 | 27 | 20 | 24 | 2 | 1 | 1 | 3 |
5,975 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackbonePatchEmbeddings | import collections.abc
import torch
from torch import nn
class VitPoseBackbonePatchEmbeddings(nn.Module):
"""Image to Patch Embedding."""
def __init__(self, config):
super().__init__()
image_size = config.image_size
patch_size = config.patch_size
num_channels = config.num_chann... |
class VitPoseBackbonePatchEmbeddings(nn.Module):
'''Image to Patch Embedding.'''
def __init__(self, config):
pass
def forward(self, pixel_values: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 13 | 2 | 11 | 0 | 3 | 0.04 | 1 | 4 | 0 | 0 | 2 | 4 | 2 | 12 | 30 | 6 | 23 | 14 | 20 | 1 | 21 | 14 | 18 | 3 | 1 | 1 | 5 |
5,976 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackbonePreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
from ...utils import auto_docstring, logging
import torch
from .configuration_vitpose_backbone import VitPoseBackboneConfig
from torch import nn
@auto_docstring
class VitPoseBackbonePreTrainedModel(PreTr... | @auto_docstring
class VitPoseBackbonePreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm, VitPoseBackboneEmbeddings]):
'''Initialize the weights'''
pass | 3 | 1 | 19 | 0 | 16 | 3 | 5 | 0.32 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 31 | 2 | 22 | 7 | 20 | 7 | 14 | 7 | 12 | 5 | 1 | 2 | 5 |
5,977 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneSelfAttention | from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from torch import nn
from .configuration_vitpose_backbone import VitPoseBackboneConfig
class VitPoseBackboneSelfAttention(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
... |
class VitPoseBackboneSelfAttention(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 0 | 18 | 4 | 12 | 2 | 2 | 0.13 | 1 | 6 | 1 | 0 | 3 | 7 | 3 | 13 | 58 | 15 | 38 | 23 | 32 | 5 | 33 | 21 | 29 | 3 | 1 | 1 | 6 |
5,978 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | transformers.models.vitpose_backbone.modeling_vitpose_backbone.VitPoseBackboneSelfOutput | from torch import nn
from .configuration_vitpose_backbone import VitPoseBackboneConfig
import torch
class VitPoseBackboneSelfOutput(nn.Module):
"""
The residual connection is defined in VitPoseBackboneLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
... |
class VitPoseBackboneSelfOutput(nn.Module):
'''
The residual connection is defined in VitPoseBackboneLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: VitPoseBackboneConfig):
pass
def forward(self, ... | 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 |
5,979 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/configuration_vits.py | transformers.models.vits.configuration_vits.VitsConfig | from ...configuration_utils import PretrainedConfig
class VitsConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VitsModel`]. It is used to instantiate a VITS
model according to the specified arguments, defining the model architecture. Instantiating a configurat... |
class VitsConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VitsModel`]. It is used to instantiate a VITS
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar confi... | 2 | 1 | 100 | 2 | 98 | 0 | 2 | 1.16 | 1 | 2 | 0 | 0 | 1 | 44 | 1 | 1 | 227 | 11 | 100 | 94 | 51 | 116 | 50 | 47 | 48 | 2 | 1 | 1 | 2 |
5,980 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.HifiGanResidualBlock | from torch import nn
class HifiGanResidualBlock(nn.Module):
def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_relu_slope=0.1):
super().__init__()
self.leaky_relu_slope = leaky_relu_slope
self.convs1 = nn.ModuleList([nn.Conv1d(channels, channels, kernel_size, stride=1, d... |
class HifiGanResidualBlock(nn.Module):
def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_relu_slope=0.1):
pass
def get_padding(self, kernel_size, dilation=1):
pass
def apply_weight_norm(self):
pass
def remove_weight_norm(self):
pass
def forwa... | 6 | 0 | 11 | 0 | 11 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 5 | 3 | 5 | 15 | 60 | 6 | 54 | 15 | 48 | 0 | 30 | 14 | 24 | 4 | 1 | 1 | 11 |
5,981 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsAttention | from typing import Any, Optional, Union
from .configuration_vits import VitsConfig
from torch import nn
import torch
class VitsAttention(nn.Module):
"""Multi-headed attention with relative positional representation."""
def __init__(self, config: VitsConfig):
super().__init__()
self.embed_dim =... |
class VitsAttention(nn.Module):
'''Multi-headed attention with relative positional representation.'''
def __init__(self, config: VitsConfig):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
pass
def forward(self, hidden_states: torch.Tensor, key_value_states: Opt... | 7 | 2 | 26 | 5 | 18 | 3 | 3 | 0.15 | 1 | 6 | 1 | 0 | 6 | 12 | 6 | 16 | 164 | 36 | 111 | 50 | 97 | 17 | 89 | 43 | 82 | 10 | 1 | 2 | 18 |
5,982 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsConvFlow | from .configuration_vits import VitsConfig
from torch import nn
import math
import torch
class VitsConvFlow(nn.Module):
def __init__(self, config: VitsConfig):
super().__init__()
self.filter_channels = config.hidden_size
self.half_channels = config.depth_separable_channels // 2
sel... |
class VitsConvFlow(nn.Module):
def __init__(self, config: VitsConfig):
pass
def forward(self, inputs, padding_mask, global_conditioning=None, reverse=False):
pass | 3 | 0 | 20 | 3 | 17 | 0 | 2 | 0 | 1 | 3 | 2 | 0 | 2 | 7 | 2 | 12 | 41 | 7 | 34 | 19 | 31 | 0 | 26 | 19 | 23 | 2 | 1 | 1 | 3 |
5,983 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsDilatedDepthSeparableConv | from torch import nn
from .configuration_vits import VitsConfig
class VitsDilatedDepthSeparableConv(nn.Module):
def __init__(self, config: VitsConfig, dropout_rate=0.0):
super().__init__()
kernel_size = config.duration_predictor_kernel_size
channels = config.hidden_size
self.num_la... |
class VitsDilatedDepthSeparableConv(nn.Module):
def __init__(self, config: VitsConfig, dropout_rate=0.0):
pass
def forward(self, inputs, padding_mask, global_conditioning=None):
pass | 3 | 0 | 21 | 2 | 20 | 0 | 3 | 0 | 1 | 3 | 1 | 0 | 2 | 6 | 2 | 12 | 44 | 4 | 40 | 16 | 37 | 0 | 31 | 16 | 28 | 3 | 1 | 1 | 5 |
5,984 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsDurationPredictor | from torch import nn
import torch
class VitsDurationPredictor(nn.Module):
def __init__(self, config):
super().__init__()
kernel_size = config.duration_predictor_kernel_size
filter_channels = config.duration_predictor_filter_channels
self.dropout = nn.Dropout(config.duration_predict... |
class VitsDurationPredictor(nn.Module):
def __init__(self, config):
pass
def forward(self, inputs, padding_mask, global_conditioning=None):
pass | 3 | 0 | 17 | 3 | 14 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 35 | 7 | 28 | 12 | 25 | 0 | 28 | 12 | 25 | 2 | 1 | 1 | 4 |
5,985 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsElementwiseAffine | from torch import nn
from .configuration_vits import VitsConfig
import torch
class VitsElementwiseAffine(nn.Module):
def __init__(self, config: VitsConfig):
super().__init__()
self.channels = config.depth_separable_channels
self.translate = nn.Parameter(torch.zeros(self.channels, 1))
... |
class VitsElementwiseAffine(nn.Module):
def __init__(self, config: VitsConfig):
pass
def forward(self, inputs, padding_mask, global_conditioning=None, reverse=False):
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 16 | 1 | 15 | 8 | 12 | 0 | 14 | 8 | 11 | 2 | 1 | 1 | 3 |
5,986 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsEncoder | from torch import nn
from .configuration_vits import VitsConfig
import torch
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
import numpy as np
from ...integrations.fsdp import is_fsdp_managed_module
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from typing import Any, Optional, Un... |
class VitsEncoder(nn.Module):
def __init__(self, config: VitsConfig):
pass
def forward(self, hidden_states: torch.FloatTensor, padding_mask: torch.FloatTensor, attention_mask: Optional[torch.Tensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, return_dict: ... | 3 | 0 | 37 | 6 | 29 | 2 | 7 | 0.07 | 1 | 8 | 3 | 0 | 2 | 4 | 2 | 12 | 75 | 13 | 58 | 22 | 47 | 4 | 34 | 14 | 31 | 12 | 1 | 3 | 13 |
5,987 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsEncoderLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_vits import VitsConfig
import torch
from typing import Any, Optional, Union
class VitsEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: VitsConfig):
super().__init__()
self.attenti... |
class VitsEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: VitsConfig):
pass
def forward(self, hidden_states: torch.Tensor, padding_mask: torch.FloatTensor, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False):
pass | 3 | 0 | 18 | 3 | 15 | 0 | 2 | 0 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 37 | 6 | 31 | 17 | 22 | 0 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
5,988 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsFeedForward | from torch import nn
from ...activations import ACT2FN
class VitsFeedForward(nn.Module):
def __init__(self, config):
super().__init__()
self.conv_1 = nn.Conv1d(config.hidden_size, config.ffn_dim, config.ffn_kernel_size)
self.conv_2 = nn.Conv1d(config.ffn_dim, config.hidden_size, config.ffn... |
class VitsFeedForward(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, padding_mask):
pass | 3 | 0 | 19 | 4 | 16 | 0 | 3 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 40 | 8 | 32 | 10 | 29 | 0 | 30 | 10 | 27 | 3 | 1 | 1 | 6 |
5,989 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsHifiGan | from typing import Any, Optional, Union
from .configuration_vits import VitsConfig
from torch import nn
import torch
class VitsHifiGan(nn.Module):
def __init__(self, config: VitsConfig):
super().__init__()
self.config = config
self.num_kernels = len(config.resblock_kernel_sizes)
se... |
class VitsHifiGan(nn.Module):
def __init__(self, config: VitsConfig):
pass
def apply_weight_norm(self):
pass
def remove_weight_norm(self):
pass
def forward(self, spectrogram: torch.FloatTensor, global_conditioning: Optional[torch.FloatTensor]=None) -> torch.FloatTensor:
... | 5 | 1 | 21 | 3 | 15 | 3 | 4 | 0.16 | 1 | 6 | 2 | 0 | 4 | 8 | 4 | 14 | 86 | 14 | 62 | 26 | 55 | 10 | 46 | 24 | 41 | 5 | 1 | 2 | 16 |
5,990 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsModel | from torch import nn
from .configuration_vits import VitsConfig
import torch
import numpy as np
from ...utils import auto_docstring, logging
from typing import Any, Optional, Union
@auto_docstring(custom_intro='\n The complete VITS model, for text-to-speech synthesis.\n ')
class VitsModel(VitsPreTrainedModel):
... | @auto_docstring(custom_intro='\n The complete VITS model, for text-to-speech synthesis.\n ')
class VitsModel(VitsPreTrainedModel):
def __init__(self, config: VitsConfig):
pass
def get_encoder(self):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, at... | 6 | 1 | 51 | 8 | 35 | 8 | 6 | 0.23 | 1 | 15 | 8 | 0 | 3 | 10 | 3 | 4 | 159 | 27 | 107 | 49 | 92 | 25 | 71 | 39 | 67 | 14 | 2 | 2 | 18 |
5,991 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsModelOutput | import torch
from ...utils import auto_docstring, logging
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, ModelOutput
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Describes the outputs for the VITS model, with potential hidden states and atte... | @dataclass
@auto_docstring(custom_intro='\n Describes the outputs for the VITS model, with potential hidden states and attentions.\n ')
class VitsModelOutput(ModelOutput):
'''
waveform (`torch.FloatTensor` of shape `(batch_size, sequence_length)`):
The final audio waveform predicted by the model.
... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 30 | 4 | 6 | 6 | 5 | 20 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,992 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsPosteriorEncoder | from torch import nn
from .configuration_vits import VitsConfig
import torch
class VitsPosteriorEncoder(nn.Module):
def __init__(self, config: VitsConfig):
super().__init__()
self.out_channels = config.flow_size
self.conv_pre = nn.Conv1d(config.spectrogram_bins, config.hidden_size, 1)
... |
class VitsPosteriorEncoder(nn.Module):
def __init__(self, config: VitsConfig):
pass
def forward(self, inputs, padding_mask, global_conditioning=None):
pass | 3 | 0 | 7 | 1 | 7 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 2 | 4 | 2 | 12 | 16 | 2 | 14 | 10 | 11 | 0 | 14 | 10 | 11 | 1 | 1 | 0 | 2 |
5,993 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsPreTrainedModel | from torch import nn
from .configuration_vits import VitsConfig
import math
from ...utils import auto_docstring, logging
from ...modeling_utils import PreTrainedModel
@auto_docstring
class VitsPreTrainedModel(PreTrainedModel):
config: VitsConfig
base_model_prefix = 'vits'
main_input_name = 'input_ids'
... | @auto_docstring
class VitsPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 18 | 0 | 17 | 1 | 8 | 0.23 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 29 | 2 | 22 | 7 | 20 | 5 | 19 | 7 | 17 | 8 | 1 | 2 | 8 |
5,994 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsResidualCouplingBlock | from torch import nn
from .configuration_vits import VitsConfig
import torch
class VitsResidualCouplingBlock(nn.Module):
def __init__(self, config: VitsConfig):
super().__init__()
self.flows = nn.ModuleList()
for _ in range(config.prior_encoder_num_flows):
self.flows.append(Vit... |
class VitsResidualCouplingBlock(nn.Module):
def __init__(self, config: VitsConfig):
pass
def forward(self, inputs, padding_mask, global_conditioning=None, reverse=False):
pass | 3 | 0 | 8 | 0 | 8 | 0 | 3 | 0 | 1 | 5 | 2 | 0 | 2 | 1 | 2 | 12 | 17 | 1 | 16 | 7 | 13 | 0 | 15 | 7 | 12 | 4 | 1 | 2 | 6 |
5,995 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsResidualCouplingLayer | from torch import nn
from .configuration_vits import VitsConfig
import torch
class VitsResidualCouplingLayer(nn.Module):
def __init__(self, config: VitsConfig):
super().__init__()
self.half_channels = config.flow_size // 2
self.conv_pre = nn.Conv1d(self.half_channels, config.hidden_size, 1... |
class VitsResidualCouplingLayer(nn.Module):
def __init__(self, config: VitsConfig):
pass
def forward(self, inputs, padding_mask, global_conditioning=None, reverse=False):
pass | 3 | 0 | 12 | 1 | 11 | 0 | 2 | 0 | 1 | 3 | 2 | 0 | 2 | 4 | 2 | 12 | 25 | 3 | 22 | 13 | 19 | 0 | 21 | 13 | 18 | 2 | 1 | 1 | 3 |
5,996 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsStochasticDurationPredictor | from torch import nn
import math
import torch
class VitsStochasticDurationPredictor(nn.Module):
def __init__(self, config):
super().__init__()
embed_dim = config.speaker_embedding_size
filter_channels = config.hidden_size
self.conv_pre = nn.Conv1d(filter_channels, filter_channels, ... |
class VitsStochasticDurationPredictor(nn.Module):
def __init__(self, config):
pass
def forward(self, inputs, padding_mask, global_conditioning=None, durations=None, reverse=False, noise_scale=1.0):
pass | 3 | 0 | 48 | 8 | 40 | 1 | 5 | 0.01 | 1 | 7 | 3 | 0 | 2 | 9 | 2 | 12 | 98 | 17 | 81 | 29 | 78 | 1 | 61 | 29 | 58 | 6 | 1 | 2 | 10 |
5,997 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsTextEncoder | from torch import nn
from .configuration_vits import VitsConfig
import math
import torch
from typing import Any, Optional, Union
class VitsTextEncoder(nn.Module):
"""
Transformer encoder that uses relative positional representation instead of absolute positional encoding.
"""
def __init__(self, config... |
class VitsTextEncoder(nn.Module):
'''
Transformer encoder that uses relative positional representation instead of absolute positional encoding.
'''
def __init__(self, config: VitsConfig):
pass
def forward(self, input_ids: torch.Tensor, padding_mask: torch.FloatTensor, attention_mask: Opti... | 3 | 1 | 12 | 1 | 10 | 0 | 2 | 0.07 | 1 | 6 | 3 | 0 | 4 | 4 | 4 | 14 | 54 | 9 | 42 | 23 | 29 | 3 | 21 | 15 | 16 | 3 | 1 | 1 | 6 |
5,998 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsTextEncoderOutput | import torch
from ...utils import auto_docstring, logging
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, ModelOutput
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Describes the outputs for the VITS text encoder model, with potential hidden st... | @dataclass
@auto_docstring(custom_intro='\n Describes the outputs for the VITS text encoder model, with potential hidden states and attentions.\n ')
class VitsTextEncoderOutput(ModelOutput):
'''
prior_means (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
The predicted ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 29 | 4 | 6 | 6 | 5 | 19 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,999 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vits/modeling_vits.py | transformers.models.vits.modeling_vits.VitsWaveNet | from torch import nn
from .configuration_vits import VitsConfig
import torch
class VitsWaveNet(torch.nn.Module):
def __init__(self, config: VitsConfig, num_layers: int):
super().__init__()
self.hidden_size = config.hidden_size
self.num_layers = num_layers
self.in_layers = torch.nn.... |
class VitsWaveNet(torch.nn.Module):
def __init__(self, config: VitsConfig, num_layers: int):
pass
def forward(self, inputs, padding_mask, global_conditioning=None):
pass
def remove_weight_norm(self):
pass | 4 | 0 | 25 | 4 | 21 | 0 | 5 | 0.02 | 1 | 4 | 1 | 0 | 3 | 6 | 3 | 13 | 78 | 14 | 63 | 28 | 59 | 1 | 53 | 28 | 49 | 5 | 1 | 2 | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.