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,800 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/upernet/modeling_upernet.py | transformers.models.upernet.modeling_upernet.UperNetPreTrainedModel | from ...utils import auto_docstring
from ...modeling_utils import PreTrainedModel
from .configuration_upernet import UperNetConfig
from torch import nn
@auto_docstring
class UperNetPreTrainedModel(PreTrainedModel):
config: UperNetConfig
main_input_name = 'pixel_values'
_no_split_modules = []
def _init... | @auto_docstring
class UperNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 6 | 0 | 6 | 1 | 3 | 0.33 | 1 | 0 | 0 | 1 | 2 | 0 | 2 | 2 | 23 | 3 | 15 | 6 | 12 | 5 | 15 | 6 | 12 | 3 | 1 | 2 | 5 |
5,801 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/upernet/modeling_upernet.py | transformers.models.upernet.modeling_upernet.UperNetPyramidPoolingBlock | import torch
from torch import nn
class UperNetPyramidPoolingBlock(nn.Module):
def __init__(self, pool_scale: int, in_channels: int, channels: int) -> None:
super().__init__()
self.layers = [nn.AdaptiveAvgPool2d(pool_scale), UperNetConvModule(in_channels, channels, kernel_size=1)]
for i, l... |
class UperNetPyramidPoolingBlock(nn.Module):
def __init__(self, pool_scale: int, in_channels: int, channels: int) -> None:
pass
def forward(self, input: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 6 | 1 | 0 | 2 | 1 | 2 | 12 | 15 | 1 | 14 | 7 | 11 | 0 | 11 | 7 | 8 | 2 | 1 | 1 | 4 |
5,802 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/upernet/modeling_upernet.py | transformers.models.upernet.modeling_upernet.UperNetPyramidPoolingModule | import torch
from torch import nn
class UperNetPyramidPoolingModule(nn.Module):
"""
Pyramid Pooling Module (PPM) used in PSPNet.
Args:
pool_scales (`tuple[int]`):
Pooling scales used in Pooling Pyramid Module.
in_channels (`int`):
Input channels.
channels (`... |
class UperNetPyramidPoolingModule(nn.Module):
'''
Pyramid Pooling Module (PPM) used in PSPNet.
Args:
pool_scales (`tuple[int]`):
Pooling scales used in Pooling Pyramid Module.
in_channels (`int`):
Input channels.
channels (`int`):
Channels after m... | 3 | 1 | 10 | 0 | 10 | 0 | 2 | 0.57 | 1 | 7 | 1 | 0 | 2 | 5 | 2 | 12 | 36 | 3 | 21 | 14 | 18 | 12 | 19 | 14 | 16 | 2 | 1 | 1 | 4 |
5,803 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/video_llava/configuration_video_llava.py | transformers.models.video_llava.configuration_video_llava.VideoLlavaConfig | from ...configuration_utils import PretrainedConfig
from ..auto import CONFIG_MAPPING, AutoConfig
class VideoLlavaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VideoLlavaForConditionalGeneration`]. It is used to instantiate an
VideoLlava model according to ... |
class VideoLlavaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VideoLlavaForConditionalGeneration`]. It is used to instantiate an
VideoLlava model according to the specified arguments, defining the model architecture. Instantiating a configuration
with t... | 2 | 1 | 54 | 4 | 50 | 0 | 7 | 0.91 | 1 | 2 | 0 | 0 | 1 | 11 | 1 | 1 | 117 | 16 | 53 | 29 | 37 | 48 | 28 | 15 | 26 | 7 | 1 | 2 | 7 |
5,804 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/video_llava/image_processing_video_llava.py | transformers.models.video_llava.image_processing_video_llava.VideoLlavaImageProcessor | import numpy as np
from ...utils import TensorType, filter_out_non_signature_kwargs, logging
from typing import Optional, Union
from ...image_transforms import convert_to_rgb, get_resize_output_image_size, resize, to_channel_dimension_format
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension... |
class VideoLlavaImageProcessor(BaseImageProcessor):
'''
Constructs a CLIP 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 `pre... | 6 | 3 | 73 | 5 | 50 | 18 | 8 | 0.53 | 1 | 8 | 2 | 0 | 4 | 11 | 4 | 24 | 336 | 26 | 203 | 80 | 141 | 107 | 76 | 23 | 71 | 17 | 3 | 1 | 33 |
5,805 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/video_llava/modeling_video_llava.py | transformers.models.video_llava.modeling_video_llava.VideoLlavaCausalLMOutputWithPast | from ...cache_utils import Cache
from dataclasses import dataclass
import torch
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from ...modeling_outputs import ModelOutput
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Base class for VideoLlava caus... | @dataclass
@auto_docstring(custom_intro='\n Base class for VideoLlava causal language model (or autoregressive) outputs.\n ')
class VideoLlavaCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 41 | 5 | 8 | 8 | 7 | 28 | 8 | 8 | 7 | 0 | 1 | 0 | 0 |
5,806 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/video_llava/modeling_video_llava.py | transformers.models.video_llava.modeling_video_llava.VideoLlavaForConditionalGeneration | from typing import Optional, Union
from ...cache_utils import Cache
import torch
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from ...processing_utils import Unpack
from torch import nn
from .configuration_video_llava import VideoLlavaConfig
from ...generation import GenerationMixi... | @auto_docstring(custom_intro='\n The VideoLlava model which consists of a vision backbone and a language model.\n ')
class VideoLlavaForConditionalGeneration(VideoLlavaPreTrainedModel, GenerationMixin):
def __init__(self, config: VideoLlavaConfig):
pass
def get_input_embeddings(self):
pa... | 23 | 2 | 36 | 4 | 21 | 10 | 4 | 0.47 | 2 | 11 | 5 | 0 | 12 | 7 | 12 | 13 | 442 | 59 | 261 | 107 | 204 | 123 | 144 | 65 | 131 | 19 | 2 | 2 | 44 |
5,807 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/video_llava/modeling_video_llava.py | transformers.models.video_llava.modeling_video_llava.VideoLlavaMultiModalProjector | from .configuration_video_llava import VideoLlavaConfig
from torch import nn
from ...activations import ACT2FN
class VideoLlavaMultiModalProjector(nn.Module):
def __init__(self, config: VideoLlavaConfig):
super().__init__()
num_feature_layers = 1 if isinstance(config.vision_feature_layer, int) els... |
class VideoLlavaMultiModalProjector(nn.Module):
def __init__(self, config: VideoLlavaConfig):
pass
def forward(self, image_features):
pass | 3 | 0 | 9 | 0 | 9 | 1 | 2 | 0.06 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 20 | 1 | 18 | 8 | 15 | 1 | 12 | 8 | 9 | 2 | 1 | 0 | 3 |
5,808 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/video_llava/modeling_video_llava.py | transformers.models.video_llava.modeling_video_llava.VideoLlavaPreTrainedModel | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from torch import nn
from ...modeling_utils import PreTrainedModel
from .configuration_video_llava import VideoLlavaConfig
@auto_docstring
class VideoLlavaPreTrainedModel(PreTrainedModel):
config: VideoLlavaConfig
base_model_pre... | @auto_docstring
class VideoLlavaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 18 | 2 | 16 | 0 | 7 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 28 | 3 | 25 | 11 | 23 | 0 | 20 | 11 | 18 | 7 | 1 | 2 | 7 |
5,809 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/video_llava/processing_video_llava.py | transformers.models.video_llava.processing_video_llava.VideoLlavaProcessor | from typing import Optional, Union
from ...feature_extraction_utils import BatchFeature
from ...utils import TensorType, logging
from ...image_utils import ImageInput, get_image_size, to_numpy_array
from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...processi... |
class VideoLlavaProcessor(ProcessorMixin):
'''
Constructs a VideoLlava processor which wraps a VideoLlava image processor and a Llava tokenizer into a single processor.
[`VideoLlavaProcessor`] offers all the functionalities of [`VideoLlavaImageProcessor`] and [`LlamaTokenizerFast`]. See the
[`~VideoLla... | 3 | 2 | 30 | 3 | 16 | 11 | 3 | 0.88 | 1 | 9 | 2 | 0 | 5 | 5 | 5 | 22 | 196 | 21 | 94 | 48 | 67 | 83 | 54 | 27 | 48 | 10 | 2 | 3 | 16 |
5,810 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/configuration_videomae.py | transformers.models.videomae.configuration_videomae.VideoMAEConfig | from ...configuration_utils import PretrainedConfig
class VideoMAEConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VideoMAEModel`]. It is used to instantiate a
VideoMAE model according to the specified arguments, defining the model architecture. Instantiating ... |
class VideoMAEConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VideoMAEModel`]. It is used to instantiate a
VideoMAE model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a s... | 2 | 1 | 50 | 3 | 47 | 0 | 1 | 1.24 | 1 | 1 | 0 | 0 | 1 | 21 | 1 | 1 | 122 | 12 | 49 | 48 | 23 | 61 | 25 | 24 | 23 | 1 | 1 | 0 | 1 |
5,811 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/feature_extraction_videomae.py | transformers.models.videomae.feature_extraction_videomae.VideoMAEFeatureExtractor | import warnings
from .image_processing_videomae import VideoMAEImageProcessor
from ...utils.import_utils import requires
@requires(backends=('vision',))
class VideoMAEFeatureExtractor(VideoMAEImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class VideoMAEFeatureExtractor is... | @requires(backends=('vision',))
class VideoMAEFeatureExtractor(VideoMAEImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 25 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
5,812 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/image_processing_videomae.py | transformers.models.videomae.image_processing_videomae.VideoMAEImageProcessor | from ...image_transforms import get_resize_output_image_size, resize, to_channel_dimension_format
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
import numpy as np
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResam... | @requires(backends=('vision',))
class VideoMAEImageProcessor(BaseImageProcessor):
'''
Constructs a VideoMAE 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 th... | 7 | 4 | 60 | 4 | 40 | 16 | 7 | 0.61 | 1 | 8 | 2 | 1 | 4 | 10 | 4 | 24 | 283 | 22 | 162 | 71 | 104 | 99 | 61 | 18 | 56 | 12 | 3 | 1 | 27 |
5,813 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEAttention | from .configuration_videomae import VideoMAEConfig
from torch import nn
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from typing import Callable, Optional
import torch
class VideoMAEAttention(nn.Module):
def __init__(self, config: VideoMAEConfig):
super().__init__()
... |
class VideoMAEAttention(nn.Module):
def __init__(self, config: VideoMAEConfig):
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,814 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEDecoder | from .configuration_videomae import VideoMAEConfig
from torch import nn
from copy import deepcopy
import torch
class VideoMAEDecoder(nn.Module):
def __init__(self, config: VideoMAEConfig):
super().__init__()
decoder_num_labels = config.num_channels * config.tubelet_size * config.patch_size ** 2
... |
class VideoMAEDecoder(nn.Module):
def __init__(self, config: VideoMAEConfig):
pass
def forward(self, hidden_states: torch.Tensor, return_token_num: int):
pass | 3 | 0 | 32 | 6 | 26 | 1 | 6 | 0.04 | 1 | 6 | 2 | 0 | 2 | 5 | 2 | 12 | 66 | 12 | 52 | 23 | 42 | 2 | 35 | 15 | 32 | 10 | 1 | 2 | 12 |
5,815 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEDecoderOutput | import torch
from typing import Callable, Optional
from dataclasses import dataclass
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro="\n Class for VideoMAEDecoder's outputs, with potential hidden states and attentions.\n ")
class VideoMAEDecod... | @dataclass
@auto_docstring(custom_intro="\n Class for VideoMAEDecoder's outputs, with potential hidden states and attentions.\n ")
class VideoMAEDecoderOutput(ModelOutput):
'''
logits (`torch.FloatTensor` of shape `(batch_size, patch_size ** 2 * num_channels)`):
Pixel reconstruction logits.
''... | 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,816 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEEmbeddings | from torch import nn
class VideoMAEEmbeddings(nn.Module):
"""
Construct the patch and position embeddings.
"""
def __init__(self, config):
super().__init__()
self.patch_embeddings = VideoMAEPatchEmbeddings(config)
self.num_patches = self.patch_embeddings.num_patches
se... |
class VideoMAEEmbeddings(nn.Module):
'''
Construct the patch and position embeddings.
'''
def __init__(self, config):
pass
def forward(self, pixel_values, bool_masked_pos):
pass | 3 | 1 | 11 | 2 | 7 | 3 | 2 | 0.53 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 29 | 6 | 15 | 9 | 12 | 8 | 15 | 9 | 12 | 2 | 1 | 1 | 3 |
5,817 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEEncoder | import torch
from .configuration_videomae import VideoMAEConfig
from typing import Callable, Optional
from torch import nn
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
class VideoMAEEncoder(nn.Module):
def __init__(self, config: VideoMAEConfig):
super().__init__()
self.co... |
class VideoMAEEncoder(nn.Module):
def __init__(self, config: VideoMAEConfig):
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,818 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEForPreTraining | from typing import Callable, Optional
import torch
from torch.nn import MSELoss
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
from ...utils.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from torch impor... | @auto_docstring(custom_intro='\n The VideoMAE Model transformer with the decoder on top for self-supervised pre-training.\n ')
class VideoMAEForPreTraining(VideoMAEPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: torch.Fl... | 6 | 1 | 87 | 11 | 58 | 20 | 5 | 0.33 | 1 | 8 | 3 | 0 | 2 | 6 | 2 | 3 | 178 | 23 | 118 | 41 | 105 | 39 | 55 | 32 | 52 | 8 | 2 | 3 | 9 |
5,819 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEForPreTrainingOutput | import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
from typing import Callable, Optional
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro="\n Class for VideoMAEForPreTraining's outputs, with potential hidden states and attentions.\n ")
class VideoM... | @dataclass
@auto_docstring(custom_intro="\n Class for VideoMAEForPreTraining's outputs, with potential hidden states and attentions.\n ")
class VideoMAEForPreTrainingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`):
Pixel reconstruction loss.
logits (`torch.FloatTensor` of s... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 23 | 2 | 5 | 5 | 4 | 16 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
5,820 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEForVideoClassification | import torch
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from typing import Callable, Optional
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
from ...processing_utils import Unpack
from ...utils.generic import can_return_tuple, check_model_inputs
from torch impo... | @auto_docstring(custom_intro='\n VideoMAE Model transformer with a video classification head on top (a linear layer on top of the average pooled hidden\n states of all tokens) e.g. for ImageNet.\n ')
class VideoMAEForVideoClassification(VideoMAEPreTrainedModel):
def __init__(self, config):
pass
... | 6 | 1 | 79 | 14 | 30 | 35 | 8 | 1.11 | 1 | 6 | 2 | 0 | 2 | 4 | 2 | 3 | 161 | 28 | 63 | 22 | 50 | 70 | 36 | 13 | 33 | 13 | 2 | 3 | 16 |
5,821 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEIntermediate | from .configuration_videomae import VideoMAEConfig
from torch import nn
from ...activations import ACT2FN
import torch
class VideoMAEIntermediate(nn.Module):
def __init__(self, config: VideoMAEConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
... |
class VideoMAEIntermediate(nn.Module):
def __init__(self, config: VideoMAEConfig):
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,822 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAELayer | from typing import Callable, Optional
from .configuration_videomae import VideoMAEConfig
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
import torch
class VideoMAELayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""
def __init... |
class VideoMAELayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: VideoMAEConfig):
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,823 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEModel | from torch import nn
from typing import Callable, Optional
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
import torch
from ...processing_utils import Unpack
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, lo... | @auto_docstring
class VideoMAEModel(VideoMAEPreTrainedModel):
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 lay... | 8 | 2 | 37 | 6 | 12 | 19 | 3 | 1.49 | 1 | 6 | 3 | 0 | 4 | 4 | 4 | 5 | 153 | 26 | 51 | 22 | 36 | 76 | 28 | 13 | 23 | 6 | 2 | 1 | 11 |
5,824 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEOutput | from torch import nn
import torch
from .configuration_videomae import VideoMAEConfig
class VideoMAEOutput(nn.Module):
def __init__(self, config: VideoMAEConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_... |
class VideoMAEOutput(nn.Module):
def __init__(self, config: VideoMAEConfig):
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,825 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEPatchEmbeddings | import collections.abc
from torch import nn
class VideoMAEPatchEmbeddings(nn.Module):
"""
Video to Patch Embedding. This module turns a batch of videos of shape (batch_size, num_frames, num_channels,
height, width) into a tensor of shape (batch_size, seq_len, hidden_size) to be consumed by a Transformer en... |
class VideoMAEPatchEmbeddings(nn.Module):
'''
Video to Patch Embedding. This module turns a batch of videos of shape (batch_size, num_frames, num_channels,
height, width) into a tensor of shape (batch_size, seq_len, hidden_size) to be consumed by a Transformer encoder.
The seq_len (the number of patche... | 3 | 1 | 20 | 1 | 19 | 1 | 3 | 0.18 | 1 | 4 | 0 | 0 | 2 | 6 | 2 | 12 | 51 | 6 | 38 | 18 | 35 | 7 | 27 | 18 | 24 | 3 | 1 | 1 | 6 |
5,826 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAEPreTrainedModel | from .configuration_videomae import VideoMAEConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
from torch import nn
@auto_docstring
class VideoMAEPreTrainedModel(PreTrainedModel):
config: VideoMAEConfig
bas... | @auto_docstring
class VideoMAEPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.5 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 23 | 2 | 14 | 7 | 12 | 7 | 13 | 7 | 11 | 4 | 1 | 2 | 4 |
5,827 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAESelfAttention | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional
from torch import nn
from .configuration_videomae import VideoMAEConfig
import torch
class VideoMAESelfAttention(nn.Module):
def __init__(self, config: VideoMAEConfig) -> None:
super().__init__()
... |
class VideoMAESelfAttention(nn.Module):
def __init__(self, config: VideoMAEConfig) -> None:
pass
def forward(self, hidden_states, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 0 | 22 | 5 | 15 | 2 | 3 | 0.11 | 1 | 6 | 1 | 1 | 3 | 9 | 3 | 13 | 68 | 16 | 47 | 28 | 41 | 5 | 41 | 26 | 37 | 4 | 1 | 1 | 8 |
5,828 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/videomae/modeling_videomae.py | transformers.models.videomae.modeling_videomae.VideoMAESelfOutput | import torch
from torch import nn
from .configuration_videomae import VideoMAEConfig
class VideoMAESelfOutput(nn.Module):
"""
The residual connection is defined in VideoMAELayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(sel... |
class VideoMAESelfOutput(nn.Module):
'''
The residual connection is defined in VideoMAELayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: VideoMAEConfig):
pass
def forward(self, hidden_states: torch.... | 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,829 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/configuration_vilt.py | transformers.models.vilt.configuration_vilt.ViltConfig | from ...configuration_utils import PretrainedConfig
class ViltConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ViLTModel`]. It is used to instantiate an ViLT
model according to the specified arguments, defining the model architecture. Instantiating a configura... |
class ViltConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ViLTModel`]. It is used to instantiate an ViLT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar conf... | 2 | 1 | 47 | 3 | 44 | 0 | 1 | 1.37 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 121 | 12 | 46 | 45 | 21 | 63 | 23 | 22 | 21 | 1 | 1 | 0 | 1 |
5,830 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/feature_extraction_vilt.py | transformers.models.vilt.feature_extraction_vilt.ViltFeatureExtractor | from .image_processing_vilt import ViltImageProcessor
import warnings
from ...utils.import_utils import requires
@requires(backends=('vision',))
class ViltFeatureExtractor(ViltImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class ViltFeatureExtractor is deprecated and will... | @requires(backends=('vision',))
class ViltFeatureExtractor(ViltImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 27 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
5,831 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/image_processing_vilt.py | transformers.models.vilt.image_processing_vilt.ViltImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from collections.abc import Iterable
from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput... | @requires(backends=('vision',))
class ViltImageProcessor(BaseImageProcessor):
'''
Constructs a ViLT image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
... | 10 | 6 | 53 | 4 | 32 | 17 | 5 | 0.7 | 1 | 10 | 3 | 1 | 5 | 10 | 6 | 26 | 366 | 31 | 197 | 87 | 135 | 138 | 79 | 32 | 72 | 18 | 3 | 1 | 30 |
5,832 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.TextEmbeddings | import torch
from torch import nn
class TextEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_toke... |
class TextEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None):
pass | 3 | 1 | 26 | 3 | 20 | 3 | 4 | 0.17 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 55 | 8 | 40 | 16 | 37 | 7 | 34 | 16 | 31 | 7 | 1 | 2 | 8 |
5,833 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltAttention | from torch import nn
from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
class ViltAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.attention = ViltSelfAttention(config)
self.output = ViltSelfOutput(config)
self.prune... |
class ViltAttention(nn.Module):
def __init__(self, config):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False):
pass | 4 | 0 | 10 | 1 | 8 | 1 | 1 | 0.13 | 1 | 4 | 2 | 0 | 3 | 3 | 3 | 13 | 32 | 6 | 24 | 11 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
5,834 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltEmbeddings | from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
import torch
from torch import nn
class ViltEmbeddings(nn.Module):
"""
Construct the text and patch embeddings.
Text embeddings are equivalent to BERT embeddings.
Patch embeddings are equivalent to ViT embeddi... |
class ViltEmbeddings(nn.Module):
'''
Construct the text and patch embeddings.
Text embeddings are equivalent to BERT embeddings.
Patch embeddings are equivalent to ViT embeddings.
'''
def __init__(self, config):
pass
def visual_embed(self, pixel_values, pixel_mask, max_image_lengt... | 4 | 1 | 47 | 5 | 37 | 5 | 3 | 0.17 | 1 | 6 | 2 | 0 | 3 | 7 | 3 | 13 | 152 | 21 | 112 | 50 | 98 | 19 | 73 | 40 | 69 | 4 | 1 | 2 | 8 |
5,835 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltEncoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
class ViltEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.layer = nn.M... |
class ViltEncoder(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 |
5,836 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltForImageAndTextRetrieval | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, logging
import torch
from typing import Optional, Union
from torch import nn
@auto_docstring(custom_intro='\n Vilt Model tran... | @auto_docstring(custom_intro='\n Vilt Model transformer with a classifier head on top (a linear layer on top of the final hidden state of the [CLS]\n token) for image-to-text or text-to-image retrieval, e.g. MSCOCO and F30K.\n ')
class ViltForImageAndTextRetrieval(ViltPreTrainedModel):
def __init__(self, ... | 5 | 1 | 44 | 8 | 24 | 12 | 4 | 0.47 | 1 | 5 | 2 | 0 | 2 | 2 | 2 | 3 | 91 | 16 | 51 | 25 | 32 | 24 | 18 | 10 | 15 | 6 | 2 | 1 | 7 |
5,837 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltForImagesAndTextClassification | from torch.nn import CrossEntropyLoss
import torch
from ...utils import auto_docstring, logging
from torch import nn
from typing import Optional, Union
@auto_docstring(custom_intro='\n Vilt Model transformer with a classifier head on top for natural language visual reasoning, e.g. NLVR2.\n ')
class ViltForImages... | @auto_docstring(custom_intro='\n Vilt Model transformer with a classifier head on top for natural language visual reasoning, e.g. NLVR2.\n ')
class ViltForImagesAndTextClassification(ViltPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[t... | 5 | 1 | 65 | 9 | 42 | 15 | 12 | 0.34 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 3 | 133 | 18 | 86 | 34 | 67 | 29 | 43 | 19 | 40 | 22 | 2 | 2 | 23 |
5,838 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltForImagesAndTextClassificationOutput | from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, logging
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intr... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`ViltForImagesAndTextClassification`].\n ')
class ViltForImagesAndTextClassificationOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression i... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 23 | 2 | 5 | 5 | 4 | 16 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
5,839 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltForMaskedLM | from ...utils import auto_docstring, logging
import torch
from torch.nn import CrossEntropyLoss
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
@auto_docstring(custom_intro='\n ... | @auto_docstring(custom_intro='\n ViLT Model with a language modeling head on top as done during pretraining.\n ')
class ViltForMaskedLM(ViltPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
... | 7 | 1 | 31 | 5 | 14 | 13 | 2 | 0.82 | 1 | 5 | 3 | 0 | 4 | 2 | 4 | 5 | 132 | 22 | 61 | 31 | 40 | 50 | 28 | 16 | 23 | 6 | 2 | 1 | 9 |
5,840 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltForQuestionAnswering | import torch
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
from typing import Optional, Union
@auto_docstring(custom_intro='\n Vilt Model tran... | @auto_docstring(custom_intro='\n Vilt Model transformer with a classifier head on top (a linear layer on top of the final hidden state of the [CLS]\n token) for visual question answering, e.g. for VQAv2.\n ')
class ViltForQuestionAnswering(ViltPreTrainedModel):
def __init__(self, config):
pass
... | 5 | 1 | 50 | 8 | 28 | 15 | 4 | 0.5 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 104 | 17 | 58 | 26 | 39 | 29 | 20 | 11 | 17 | 6 | 2 | 1 | 7 |
5,841 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltForTokenClassification | from torch.nn import CrossEntropyLoss
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
import torch
from ...utils import auto_docstring, logging
@auto_docstri... | @auto_docstring
class ViltForTokenClassification(ViltPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, pixel_values: Opti... | 5 | 1 | 37 | 6 | 27 | 4 | 4 | 0.12 | 1 | 4 | 2 | 0 | 2 | 4 | 2 | 3 | 77 | 13 | 57 | 29 | 38 | 7 | 24 | 14 | 21 | 6 | 2 | 1 | 7 |
5,842 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltIntermediate | from ...activations import ACT2FN
from .configuration_vilt import ViltConfig
import torch
from torch import nn
class ViltIntermediate(nn.Module):
def __init__(self, config: ViltConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(co... |
class ViltIntermediate(nn.Module):
def __init__(self, config: ViltConfig):
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,843 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltLayer | from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class ViltLayer(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_feed... |
class ViltLayer(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 |
5,844 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltMLMHead | from torch import nn
import torch
class ViltMLMHead(nn.Module):
def __init__(self, config, weight=None):
super().__init__()
self.config = config
self.transform = ViltPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
... |
class ViltMLMHead(nn.Module):
def __init__(self, config, weight=None):
pass
def _tie_weights(self):
pass
def forward(self, x):
pass | 4 | 0 | 6 | 0 | 5 | 0 | 1 | 0.06 | 1 | 2 | 1 | 0 | 3 | 4 | 3 | 13 | 20 | 3 | 16 | 8 | 12 | 1 | 16 | 8 | 12 | 2 | 1 | 1 | 4 |
5,845 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltModel | from typing import Optional, Union
from torch import nn
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
@auto_docstring
class ViltModel(ViltPreTrainedModel... | @auto_docstring
class ViltModel(ViltPreTrainedModel):
def __init__(self, config, add_pooling_layer=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(self):
pass
def set_... | 8 | 3 | 27 | 4 | 18 | 6 | 4 | 0.32 | 1 | 9 | 4 | 0 | 5 | 5 | 5 | 6 | 143 | 23 | 91 | 36 | 69 | 29 | 48 | 21 | 42 | 16 | 2 | 1 | 22 |
5,846 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltOutput | from torch import nn
from .configuration_vilt import ViltConfig
import torch
class ViltOutput(nn.Module):
def __init__(self, config: ViltConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
... |
class ViltOutput(nn.Module):
def __init__(self, config: ViltConfig):
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,847 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltPatchEmbeddings | from torch import nn
import collections.abc
class ViltPatchEmbeddings(nn.Module):
"""
Image to Patch Embedding.
"""
def __init__(self, config):
super().__init__()
image_size, patch_size = (config.image_size, config.patch_size)
num_channels, hidden_size = (config.num_channels, c... |
class ViltPatchEmbeddings(nn.Module):
'''
Image to Patch Embedding.
'''
def __init__(self, config):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 12 | 1 | 11 | 0 | 3 | 0.14 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 29 | 4 | 22 | 14 | 19 | 3 | 20 | 14 | 17 | 3 | 1 | 1 | 5 |
5,848 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltPooler | from torch import nn
class ViltPooler(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 ViltPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
5,849 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltPreTrainedModel | from ...modeling_utils import PreTrainedModel
from torch import nn
from .configuration_vilt import ViltConfig
from ...utils import auto_docstring, logging
@auto_docstring
class ViltPreTrainedModel(PreTrainedModel):
config: ViltConfig
base_model_prefix = 'vilt'
supports_gradient_checkpointing = True
_no... | @auto_docstring
class ViltPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.41 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 26 | 2 | 17 | 6 | 15 | 7 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
5,850 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltPredictionHeadTransform | from torch import nn
from ...activations import ACT2FN
class ViltPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
if isinstance(config.hidden_act, str):
self.transform_act_fn = ACT2... |
class ViltPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
5,851 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltSelfAttention | from torch import nn
import torch
import math
class ViltSelfAttention(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 ViltSelfAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False):
pass | 3 | 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 |
5,852 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/modeling_vilt.py | transformers.models.vilt.modeling_vilt.ViltSelfOutput | import torch
from .configuration_vilt import ViltConfig
from torch import nn
class ViltSelfOutput(nn.Module):
"""
The residual connection is defined in ViltLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, config: ViltC... |
class ViltSelfOutput(nn.Module):
'''
The residual connection is defined in ViltLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: ViltConfig):
pass
def forward(self, hidden_states: torch.Tensor, inpu... | 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,853 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vilt/processing_vilt.py | transformers.models.vilt.processing_vilt.ViltProcessor | import warnings
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin
class ViltProcessor(ProcessorMixin):
"""
Constructs a ViLT processor which wraps a BERT tokenizer and ViLT image processor into a single processor.
[`ViltProcessor`] offers all the functionalities of [`ViltImage... |
class ViltProcessor(ProcessorMixin):
'''
Constructs a ViLT processor which wraps a BERT tokenizer and ViLT image processor into a single processor.
[`ViltProcessor`] offers all the functionalities of [`ViltImageProcessor`] and [`BertTokenizerFast`]. See the
docstring of [`~ViltProcessor.__call__`] and ... | 6 | 1 | 14 | 1 | 11 | 2 | 2 | 0.29 | 1 | 10 | 2 | 0 | 7 | 1 | 7 | 24 | 122 | 14 | 84 | 39 | 54 | 24 | 35 | 17 | 27 | 5 | 2 | 1 | 11 |
5,854 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vipllava/configuration_vipllava.py | transformers.models.vipllava.configuration_vipllava.VipLlavaConfig | from ..auto import CONFIG_MAPPING, AutoConfig
from ...configuration_utils import PretrainedConfig
class VipLlavaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VipLlavaForConditionalGeneration`]. It is used to instantiate an
VipLlava model according to the sp... |
class VipLlavaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`VipLlavaForConditionalGeneration`]. It is used to instantiate an
VipLlava model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the def... | 2 | 1 | 46 | 4 | 42 | 0 | 7 | 0.84 | 1 | 2 | 0 | 0 | 1 | 8 | 1 | 1 | 99 | 16 | 45 | 23 | 32 | 38 | 21 | 12 | 19 | 7 | 1 | 1 | 7 |
5,855 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vipllava/modeling_vipllava.py | transformers.models.vipllava.modeling_vipllava.VipLlavaCausalLMOutputWithPast | from ...utils import auto_docstring, can_return_tuple
from typing import Optional, Union
import torch
from ...cache_utils import Cache
from dataclasses import dataclass
from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput
@dataclass
@auto_docstring(custom_intro='\n Base class for VipLlava causal lan... | @dataclass
@auto_docstring(custom_intro='\n Base class for VipLlava causal language model (or autoregressive) outputs.\n ')
class VipLlavaCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (for... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.57 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 37 | 5 | 7 | 7 | 6 | 25 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
5,856 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vipllava/modeling_vipllava.py | transformers.models.vipllava.modeling_vipllava.VipLlavaForConditionalGeneration | from torch import nn
from ...cache_utils import Cache
from ...utils import auto_docstring, can_return_tuple
from typing import Optional, Union
from .configuration_vipllava import VipLlavaConfig
from ...generation import GenerationMixin
import torch
@auto_docstring(custom_intro='\n The VIPLLAVA model which consists ... | @auto_docstring(custom_intro='\n The VIPLLAVA model which consists of a vision backbone and a language model.\n ')
class VipLlavaForConditionalGeneration(VipLlavaPreTrainedModel, GenerationMixin):
def __init__(self, config: VipLlavaConfig):
pass
def get_input_embeddings(self):
pass
... | 19 | 1 | 27 | 4 | 18 | 6 | 3 | 0.34 | 2 | 10 | 5 | 0 | 11 | 6 | 11 | 12 | 318 | 49 | 202 | 81 | 160 | 68 | 115 | 53 | 103 | 15 | 2 | 2 | 35 |
5,857 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vipllava/modeling_vipllava.py | transformers.models.vipllava.modeling_vipllava.VipLlavaMultiModalProjector | from torch import nn
from .configuration_vipllava import VipLlavaConfig
from ...activations import ACT2FN
class VipLlavaMultiModalProjector(nn.Module):
def __init__(self, config: VipLlavaConfig):
super().__init__()
num_feature_layers = 1 if isinstance(config.vision_feature_layers, int) else len(co... |
class VipLlavaMultiModalProjector(nn.Module):
def __init__(self, config: VipLlavaConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 1 | 10 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 22 | 2 | 20 | 8 | 17 | 0 | 14 | 8 | 11 | 2 | 1 | 0 | 3 |
5,858 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vipllava/modeling_vipllava.py | transformers.models.vipllava.modeling_vipllava.VipLlavaPreTrainedModel | from .configuration_vipllava import VipLlavaConfig
from ...utils import auto_docstring, can_return_tuple
from ...modeling_utils import PreTrainedModel
@auto_docstring
class VipLlavaPreTrainedModel(PreTrainedModel):
config: VipLlavaConfig
base_model_prefix = ''
supports_gradient_checkpointing = True
_sk... | @auto_docstring
class VipLlavaPreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 21 | 2 | 16 | 3 | 7 | 0.12 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 31 | 3 | 25 | 11 | 23 | 3 | 20 | 11 | 18 | 7 | 1 | 2 | 7 |
5,859 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py | transformers.models.vision_encoder_decoder.configuration_vision_encoder_decoder.VisionEncoderDecoderConfig | from ...configuration_utils import PretrainedConfig
from ..auto.configuration_auto import AutoConfig
class VisionEncoderDecoderConfig(PretrainedConfig):
"""
[`VisionEncoderDecoderConfig`] is the configuration class to store the configuration of a
[`VisionEncoderDecoderModel`]. It is used to instantiate a V... |
class VisionEncoderDecoderConfig(PretrainedConfig):
'''
[`VisionEncoderDecoderConfig`] is the configuration class to store the configuration of a
[`VisionEncoderDecoderModel`]. It is used to instantiate a Vision-Encoder-Text-Decoder model according to the
specified arguments, defining the encoder and d... | 4 | 2 | 16 | 2 | 11 | 3 | 2 | 1.54 | 1 | 3 | 1 | 0 | 1 | 3 | 2 | 2 | 84 | 18 | 26 | 16 | 20 | 40 | 20 | 13 | 17 | 2 | 1 | 1 | 3 |
5,860 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py | transformers.models.vision_encoder_decoder.configuration_vision_encoder_decoder.VisionEncoderDecoderDecoderOnnxConfig | from collections import OrderedDict
from ...onnx import OnnxConfig
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any
class VisionEncoderDecoderDecoderOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
common_inputs = OrderedDict()
com... |
class VisionEncoderDecoderDecoderOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
def generate_dummy_inputs(self, tokenizer: 'PreTrainedTokenizerBase', batch_size: int=-1, seq_length: int=-1, is_pair: bool=False) -> Mapping[str, Any]:
pass | 4 | 0 | 15 | 3 | 13 | 0 | 1 | 0 | 1 | 5 | 0 | 0 | 2 | 0 | 2 | 2 | 33 | 6 | 27 | 17 | 15 | 0 | 17 | 9 | 13 | 1 | 1 | 0 | 2 |
5,861 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py | transformers.models.vision_encoder_decoder.configuration_vision_encoder_decoder.VisionEncoderDecoderEncoderOnnxConfig | from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
from packaging import version
class VisionEncoderDecoderEncoderOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
... |
class VisionEncoderDecoderEncoderOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 7 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 3 | 0 | 3 | 3 | 18 | 3 | 15 | 8 | 8 | 0 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
5,862 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py | transformers.models.vision_encoder_decoder.configuration_vision_encoder_decoder.VisionEncoderDecoderOnnxConfig | from ...onnx import OnnxConfig
from ...configuration_utils import PretrainedConfig
class VisionEncoderDecoderOnnxConfig(OnnxConfig):
@property
def inputs(self) -> None:
pass
def get_encoder_config(self, encoder_config: PretrainedConfig) -> OnnxConfig:
"""
Returns ONNX encoder conf... |
class VisionEncoderDecoderOnnxConfig(OnnxConfig):
@property
def inputs(self) -> None:
pass
def get_encoder_config(self, encoder_config: PretrainedConfig) -> OnnxConfig:
'''
Returns ONNX encoder config for `VisionEncoderDecoder` model.
Args:
encoder_config (`Pre... | 5 | 2 | 11 | 1 | 3 | 7 | 1 | 1.82 | 1 | 3 | 2 | 0 | 3 | 0 | 3 | 3 | 37 | 6 | 11 | 7 | 4 | 20 | 8 | 4 | 4 | 1 | 1 | 0 | 3 |
5,863 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py | transformers.models.vision_encoder_decoder.modeling_vision_encoder_decoder.VisionEncoderDecoderModel | import torch
from ...modeling_utils import PreTrainedModel
from torch import nn
from ...utils import auto_docstring, logging
from ..auto.configuration_auto import AutoConfig
from .configuration_vision_encoder_decoder import VisionEncoderDecoderConfig
from ..auto.modeling_auto import AutoModel, AutoModelForCausalLM
from... | @auto_docstring
class VisionEncoderDecoderModel(PreTrainedModel, GenerationMixin):
'''
[`VisionEncoderDecoderModel`] is a generic model class that will be instantiated as a transformer architecture with
one of the base vision model classes of the library as encoder and another one as decoder when created wi... | 12 | 4 | 44 | 7 | 26 | 11 | 5 | 0.44 | 2 | 14 | 6 | 0 | 9 | 3 | 11 | 11 | 517 | 92 | 296 | 87 | 254 | 129 | 170 | 58 | 157 | 13 | 1 | 3 | 55 |
5,864 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py | transformers.models.vision_text_dual_encoder.configuration_vision_text_dual_encoder.VisionTextDualEncoderConfig | from ..auto.configuration_auto import AutoConfig
from ...configuration_utils import PretrainedConfig
class VisionTextDualEncoderConfig(PretrainedConfig):
"""
[`VisionTextDualEncoderConfig`] is the configuration class to store the configuration of a
[`VisionTextDualEncoderModel`]. It is used to instantiate ... |
class VisionTextDualEncoderConfig(PretrainedConfig):
'''
[`VisionTextDualEncoderConfig`] is the configuration class to store the configuration of a
[`VisionTextDualEncoderModel`]. It is used to instantiate [`VisionTextDualEncoderModel`] model according to the
specified arguments, defining the text mode... | 4 | 2 | 19 | 5 | 11 | 3 | 3 | 1.37 | 1 | 3 | 1 | 0 | 1 | 4 | 2 | 2 | 86 | 22 | 27 | 16 | 23 | 37 | 25 | 15 | 22 | 5 | 1 | 2 | 6 |
5,865 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_text_dual_encoder/modeling_vision_text_dual_encoder.py | transformers.models.vision_text_dual_encoder.modeling_vision_text_dual_encoder.VisionTextDualEncoderModel | import torch
from typing import Optional, Union
from ...utils import auto_docstring, filter_out_non_signature_kwargs, logging
from ..clip.modeling_clip import CLIPOutput, CLIPVisionConfig, CLIPVisionModel
from ..auto.configuration_auto import AutoConfig
from torch import nn
from ...modeling_outputs import BaseModelOutp... | @auto_docstring
class VisionTextDualEncoderModel(PreTrainedModel):
def __init__(self, config: Optional[VisionTextDualEncoderConfig]=None, vision_model: Optional[PreTrainedModel]=None, text_model: Optional[PreTrainedModel]=None):
'''
vision_model (`PreTrainedModel`):
The vision model to ... | 13 | 5 | 60 | 10 | 29 | 21 | 4 | 0.69 | 1 | 11 | 6 | 0 | 4 | 8 | 6 | 6 | 376 | 65 | 186 | 85 | 136 | 128 | 94 | 43 | 87 | 10 | 1 | 2 | 25 |
5,866 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vision_text_dual_encoder/processing_vision_text_dual_encoder.py | transformers.models.vision_text_dual_encoder.processing_vision_text_dual_encoder.VisionTextDualEncoderProcessor | import warnings
from ...processing_utils import ProcessingKwargs, ProcessorMixin
class VisionTextDualEncoderProcessor(ProcessorMixin):
"""
Constructs a VisionTextDualEncoder processor which wraps an image processor and a tokenizer into a single
processor.
[`VisionTextDualEncoderProcessor`] offers all ... |
class VisionTextDualEncoderProcessor(ProcessorMixin):
'''
Constructs a VisionTextDualEncoder processor which wraps an image processor and a tokenizer into a single
processor.
[`VisionTextDualEncoderProcessor`] offers all the functionalities of [`AutoImageProcessor`] and [`AutoTokenizer`].
See the [... | 6 | 1 | 14 | 2 | 7 | 5 | 2 | 0.84 | 1 | 6 | 1 | 0 | 7 | 1 | 7 | 24 | 126 | 21 | 57 | 20 | 46 | 48 | 42 | 17 | 34 | 6 | 2 | 1 | 16 |
5,867 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/configuration_visual_bert.py | transformers.models.visual_bert.configuration_visual_bert.VisualBertConfig | from ...configuration_utils import PretrainedConfig
class VisualBertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`VisualBertModel`]. It is used to instantiate an
VisualBERT model according to the specified arguments, defining the model architecture. Instant... | null | 2 | 1 | 39 | 1 | 38 | 0 | 1 | 1.43 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 109 | 12 | 40 | 39 | 17 | 57 | 19 | 18 | 17 | 1 | 1 | 0 | 1 |
5,868 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertAttention | from torch import nn
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class VisualBertAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = VisualBertSelfAttention(config)
self.output = VisualBertSelfOut... |
class VisualBertAttention(nn.Module):
def __init__(self, config):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False):
pass | 4 | 0 | 13 | 1 | 11 | 1 | 1 | 0.09 | 1 | 4 | 2 | 0 | 3 | 3 | 3 | 13 | 41 | 4 | 35 | 17 | 25 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
5,869 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertEmbeddings | import torch
from torch import nn
class VisualBertEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings and visual embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size,... |
class VisualBertEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings and visual embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None, visual_embeds=None, visual_toke... | 3 | 1 | 64 | 13 | 45 | 7 | 7 | 0.15 | 1 | 2 | 0 | 0 | 2 | 8 | 2 | 12 | 132 | 28 | 91 | 31 | 79 | 14 | 60 | 22 | 57 | 11 | 1 | 4 | 13 |
5,870 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertEncoder | from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MultipleChoiceModelOutput, SequenceClassifierOutput
class VisualBertEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.layer = nn.ModuleList([VisualBe... |
class VisualBertEncoder(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 | 27 | 3 | 24 | 0 | 6 | 0 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 56 | 7 | 49 | 19 | 38 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
5,871 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertForMultipleChoice | from torch import nn
import torch
from torch.nn import CrossEntropyLoss, KLDivLoss, LogSoftmax
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MultipleChoiceModelOutput, SequenceClassifierOutput
@a... | @auto_docstring
class VisualBertForMultipleChoice(VisualBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids... | 5 | 1 | 69 | 10 | 41 | 19 | 8 | 0.44 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 144 | 20 | 86 | 33 | 63 | 38 | 31 | 14 | 28 | 14 | 2 | 1 | 15 |
5,872 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertForPreTraining | import torch
from torch.nn import CrossEntropyLoss, KLDivLoss, LogSoftmax
from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
@auto_docstring(custom_intro='\n VisualBert Model with two heads on top as done during the pretraining: a `masked language modeling` head and a\n ... | @auto_docstring(custom_intro='\n VisualBert Model with two heads on top as done during the pretraining: a `masked language modeling` head and a\n `sentence-image prediction (classification)` head.\n ')
class VisualBertForPreTraining(VisualBertPreTrainedModel):
def __init__(self, config):
pass
... | 7 | 1 | 32 | 5 | 18 | 10 | 3 | 0.51 | 1 | 7 | 3 | 0 | 4 | 2 | 4 | 5 | 137 | 22 | 76 | 35 | 52 | 39 | 33 | 17 | 28 | 8 | 2 | 2 | 11 |
5,873 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertForPreTrainingOutput | from dataclasses import dataclass
import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n Output type of [`VisualBertForPreTraining`].\n ')
class VisualBertForPreTrainingOutput(ModelOutput):
"""
loss (*optional*... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`VisualBertForPreTraining`].\n ')
class VisualBertForPreTrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
Total loss as the sum of the masked language modeling los... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 31 | 4 | 6 | 6 | 5 | 21 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,874 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertForQuestionAnswering | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MultipleChoiceModelOutput, SequenceClassifierOutput
import torch
from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
from torch import nn
@auto_docstring(custom_intro='\n VisualBert Model with a cla... | @auto_docstring(custom_intro='\n VisualBert Model with a classification/regression head on top (a dropout and a linear layer on top of the pooled\n output) for VQA.\n ')
class VisualBertForQuestionAnswering(VisualBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def fo... | 5 | 1 | 57 | 9 | 32 | 17 | 3 | 0.49 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 117 | 18 | 67 | 34 | 46 | 33 | 28 | 17 | 25 | 5 | 2 | 1 | 6 |
5,875 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertForRegionToPhraseAlignment | from torch import nn
import torch
from ...utils import ModelOutput, auto_docstring, logging
from torch.nn import CrossEntropyLoss, KLDivLoss, LogSoftmax
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MultipleChoiceModelOutput, SequenceClassifierOutput
from typing import Optional, Union
@a... | @auto_docstring(custom_intro='\n VisualBert Model with a Masked Language Modeling head and an attention layer on top for Region-to-Phrase Alignment\n e.g. for Flickr30 Entities task.\n ')
class VisualBertForRegionToPhraseAlignment(VisualBertPreTrainedModel):
def __init__(self, config):
pass
@a... | 5 | 1 | 70 | 12 | 37 | 22 | 4 | 0.56 | 1 | 8 | 4 | 0 | 2 | 4 | 2 | 3 | 146 | 26 | 77 | 38 | 55 | 43 | 34 | 20 | 31 | 7 | 2 | 1 | 8 |
5,876 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertForVisualReasoning | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MultipleChoiceModelOutput, SequenceClassifierOutput
from torch.nn import CrossEntropyLoss, KLDivLoss, LogSoftmax
import torch
from torch import nn
from ...utils import ModelOutput, auto_docstring, logging
@a... | @auto_docstring(custom_intro='\n VisualBert Model with a sequence classification head on top (a dropout and a linear layer on top of the pooled\n output) for Visual Reasoning e.g. for NLVR task.\n ')
class VisualBertForVisualReasoning(VisualBertPreTrainedModel):
def __init__(self, config):
pass
... | 5 | 1 | 52 | 8 | 29 | 16 | 3 | 0.53 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 107 | 16 | 60 | 31 | 39 | 32 | 23 | 14 | 20 | 5 | 2 | 1 | 6 |
5,877 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertIntermediate | from torch import nn
from ...activations import ACT2FN
import torch
class VisualBertIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.intermedi... |
class VisualBertIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
5,878 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertLMPredictionHead | from torch import nn
import torch
class VisualBertLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = VisualBertPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.bias = nn.Parame... |
class VisualBertLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def _tie_weights(self):
pass
def forward(self, hidden_states):
pass | 4 | 0 | 6 | 1 | 4 | 1 | 1 | 0.23 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 21 | 5 | 13 | 7 | 9 | 3 | 13 | 7 | 9 | 1 | 1 | 0 | 3 |
5,879 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class VisualBertLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.chunk_size_feed_forward = co... |
class VisualBertLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False):
pass
def feed_forward_chunk(self, attention_output):
pass | 4 | 0 | 11 | 1 | 10 | 0 | 1 | 0.03 | 1 | 4 | 3 | 0 | 3 | 5 | 3 | 13 | 37 | 5 | 32 | 21 | 22 | 1 | 19 | 15 | 15 | 1 | 1 | 0 | 3 |
5,880 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertModel | import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MultipleChoiceModelOutput, SequenceClassifierOutput
@auto_docstring(custom_intro='\n The model can behave as an encoder (with only se... | @auto_docstring(custom_intro='\n The model can behave as an encoder (with only self-attention) following the architecture described in [Attention is\n all you need](https://huggingface.co/papers/1706.03762) by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,\n Llion Jones, Aidan N. Gomez, Lukasz Kai... | 8 | 3 | 35 | 6 | 22 | 7 | 5 | 0.36 | 1 | 9 | 5 | 0 | 5 | 6 | 5 | 6 | 188 | 36 | 112 | 45 | 89 | 40 | 58 | 29 | 52 | 16 | 2 | 1 | 23 |
5,881 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertOutput | from torch import nn
import torch
class VisualBertOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dr... |
class VisualBertOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
5,882 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertPooler | import torch
from torch import nn
class VisualBertPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
first_... |
class VisualBertPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
5,883 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertPreTrainedModel | from ...utils import ModelOutput, auto_docstring, logging
from .configuration_visual_bert import VisualBertConfig
from ...modeling_utils import PreTrainedModel
from torch import nn
@auto_docstring
class VisualBertPreTrainedModel(PreTrainedModel):
config: VisualBertConfig
base_model_prefix = 'visual_bert'
s... | @auto_docstring
class VisualBertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 12 | 1 | 8 | 3 | 4 | 0.58 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 22 | 3 | 12 | 5 | 10 | 7 | 11 | 5 | 9 | 4 | 1 | 1 | 4 |
5,884 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertPreTrainingHeads | from torch import nn
class VisualBertPreTrainingHeads(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = VisualBertLMPredictionHead(config)
self.seq_relationship = nn.Linear(config.hidden_size, 2)
def forward(self, sequence_output, pooled_output):
pr... |
class VisualBertPreTrainingHeads(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output, pooled_output):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 2 | 2 | 12 | 10 | 1 | 9 | 7 | 6 | 0 | 9 | 7 | 6 | 1 | 1 | 0 | 2 |
5,885 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertPredictionHeadTransform | from ...activations import ACT2FN
from torch import nn
import torch
class VisualBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
if isinstance(config.hidden_act, str):
self.tran... |
class VisualBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
5,886 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertRegionToPhraseAttention | from torch import nn
import math
import torch
class VisualBertRegionToPhraseAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(f'The hidden size ({config.hidden_size}) is not a multiple of the n... |
class VisualBertRegionToPhraseAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, query, key, attention_mask):
pass | 3 | 0 | 13 | 3 | 10 | 0 | 1 | 0.03 | 1 | 3 | 0 | 0 | 3 | 7 | 3 | 13 | 42 | 10 | 32 | 17 | 28 | 1 | 29 | 17 | 25 | 2 | 1 | 1 | 4 |
5,887 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertSelfAttention | import torch
import math
from torch import nn
class VisualBertSelfAttention(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... |
class VisualBertSelfAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False):
pass | 3 | 0 | 21 | 5 | 14 | 2 | 2 | 0.14 | 1 | 3 | 0 | 0 | 3 | 7 | 3 | 13 | 66 | 16 | 44 | 27 | 34 | 6 | 35 | 21 | 31 | 4 | 1 | 1 | 7 |
5,888 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/visual_bert/modeling_visual_bert.py | transformers.models.visual_bert.modeling_visual_bert.VisualBertSelfOutput | from torch import nn
import torch
class VisualBertSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Drop... |
class VisualBertSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
5,889 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/configuration_vit.py | transformers.models.vit.configuration_vit.ViTConfig | from ...configuration_utils import PretrainedConfig
class ViTConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ViTModel`]. It is used to instantiate an ViT
model according to the specified arguments, defining the model architecture. Instantiating a configuratio... |
class ViTConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ViTModel`]. It is used to instantiate an ViT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configu... | 2 | 1 | 34 | 1 | 33 | 0 | 1 | 1.34 | 1 | 1 | 0 | 0 | 1 | 14 | 1 | 1 | 93 | 11 | 35 | 34 | 16 | 47 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
5,890 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/configuration_vit.py | transformers.models.vit.configuration_vit.ViTOnnxConfig | from packaging import version
from collections.abc import Mapping
from ...onnx import OnnxConfig
from collections import OrderedDict
class ViTOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict... |
class ViTOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass | 5 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 0 | 2 | 2 | 14 | 2 | 12 | 6 | 7 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
5,891 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/feature_extraction_vit.py | transformers.models.vit.feature_extraction_vit.ViTFeatureExtractor | import warnings
from .image_processing_vit import ViTImageProcessor
from ...utils.import_utils import requires
@requires(backends=('vision',))
class ViTFeatureExtractor(ViTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class ViTFeatureExtractor is deprecated and will be r... | @requires(backends=('vision',))
class ViTFeatureExtractor(ViTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
5,892 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/image_processing_vit.py | transformers.models.vit.image_processing_vit.ViTImageProcessor | from typing import Optional, Union
from ...utils import TensorType, filter_out_non_signature_kwargs, logging
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import convert_to_rgb, resize, to_channel_dimension_format
from ...utils.import_utils import require... | @requires(backends=('vision',))
class ViTImageProcessor(BaseImageProcessor):
'''
Constructs a ViT image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `(size["height"],
size["width... | 6 | 3 | 68 | 5 | 39 | 24 | 8 | 0.83 | 1 | 8 | 2 | 1 | 3 | 9 | 3 | 23 | 242 | 20 | 121 | 53 | 81 | 101 | 52 | 17 | 48 | 17 | 3 | 1 | 23 |
5,893 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/image_processing_vit_fast.py | transformers.models.vit.image_processing_vit_fast.ViTImageProcessorFast | from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, PILImageResampling
from ...image_processing_utils_fast import BaseImageProcessorFast
from ...utils import auto_docstring
@auto_docstring
class ViTImageProcessorFast(BaseImageProcessorFast):
resample = PILImageResampling.BILINEAR
image_me... | @auto_docstring
class ViTImageProcessorFast(BaseImageProcessorFast):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 8 | 0 | 8 | 8 | 7 | 0 | 8 | 8 | 7 | 0 | 4 | 0 | 0 |
5,894 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTAttention | from torch import nn
import torch
from .configuration_vit import ViTConfig
from typing import Callable, Optional, Union
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
class ViTAttention(nn.Module):
def __init__(self, config: ViTConfig):
super().__init__()
self.at... |
class ViTAttention(nn.Module):
def __init__(self, config: ViTConfig):
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,895 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTEmbeddings | from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from torch import nn
from .configuration_vit import ViTConfig
import torch
from typing import Callable, Optional, Union
class ViTEmbeddings(nn.Module):
"""
Construct the CLS token, position and patch embeddings. Optionally, also the ma... |
class ViTEmbeddings(nn.Module):
'''
Construct the CLS token, position and patch embeddings. Optionally, also the mask token.
'''
def __init__(self, config: ViTConfig, use_mask_token: bool=False):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) ->... | 4 | 2 | 26 | 5 | 17 | 4 | 2 | 0.26 | 1 | 6 | 2 | 1 | 3 | 7 | 3 | 13 | 86 | 19 | 53 | 31 | 44 | 14 | 42 | 26 | 38 | 3 | 1 | 1 | 7 |
5,896 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTEncoder | from .configuration_vit import ViTConfig
from torch import nn
from typing import Callable, Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
class ViTEncoder(nn.Module):
def __init__(self, config: ViTConfig):
... |
class ViTEncoder(nn.Module):
def __init__(self, config: ViTConfig):
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,897 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTForImageClassification | from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
from ...processing_utils import Unpack
from .configuration_vit import ViTConfig
from torch import nn
from ...utils.gen... | @auto_docstring(custom_intro="\n ViT Model transformer with an image classification head on top (a linear layer on top of the final hidden state of\n the [CLS] token) e.g. for ImageNet.\n\n <Tip>\n\n Note that it's possible to fine-tune ViT on higher resolution images than the ones it has been trained o... | 6 | 1 | 39 | 5 | 29 | 5 | 7 | 0.14 | 1 | 8 | 3 | 1 | 2 | 3 | 2 | 3 | 86 | 11 | 66 | 22 | 47 | 9 | 33 | 12 | 30 | 12 | 2 | 3 | 14 |
5,898 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTForMaskedImageModeling | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
import torch
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from torch import nn
... | @auto_docstring(custom_intro='\n ViT Model with a decoder on top for masked image modeling, as proposed in [SimMIM](https://huggingface.co/papers/2111.09886).\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/trans... | 6 | 1 | 54 | 9 | 33 | 13 | 4 | 0.38 | 1 | 8 | 3 | 0 | 2 | 2 | 2 | 3 | 112 | 18 | 68 | 25 | 54 | 26 | 28 | 15 | 25 | 6 | 2 | 1 | 7 |
5,899 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/vit/modeling_vit.py | transformers.models.vit.modeling_vit.ViTIntermediate | from torch import nn
from .configuration_vit import ViTConfig
import torch
from ...activations import ACT2FN
class ViTIntermediate(nn.Module):
def __init__(self, config: ViTConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config... |
class ViTIntermediate(nn.Module):
def __init__(self, config: ViTConfig):
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.