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
3,100
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/idefics3/modeling_idefics3.py
transformers.models.idefics3.modeling_idefics3.Idefics3VisionEmbeddings
import torch from torch import nn from .configuration_idefics3 import Idefics3Config, Idefics3VisionConfig class Idefics3VisionEmbeddings(nn.Module): """ This is a modified version of `siglip.modelign_siglip.SiglipVisionEmbeddings` to enable images of variable resolution. The modifications are adapted...
class Idefics3VisionEmbeddings(nn.Module): ''' This is a modified version of `siglip.modelign_siglip.SiglipVisionEmbeddings` to enable images of variable resolution. The modifications are adapted from [Patch n' Pack: NaViT, a Vision Transformer for any Aspect Ratio and Resolution](https://huggingface.c...
3
1
22
5
18
0
2
0.22
1
4
1
0
2
8
2
12
56
12
36
25
33
8
30
25
27
2
1
1
3
3,101
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/idefics3/modeling_idefics3.py
transformers.models.idefics3.modeling_idefics3.Idefics3VisionMLP
from torch import nn import torch from ...activations import ACT2FN class Idefics3VisionMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.activation_fn = ACT2FN[config.hidden_act] self.fc1 = nn.Linear(config.hidden_size, config.intermediate_si...
class Idefics3VisionMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
1
0
1
2
0
0
2
4
2
12
13
1
12
7
9
0
12
7
9
1
1
0
2
3,102
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/idefics3/modeling_idefics3.py
transformers.models.idefics3.modeling_idefics3.Idefics3VisionTransformer
from .configuration_idefics3 import Idefics3Config, Idefics3VisionConfig from torch import nn from ...modeling_outputs import BaseModelOutput, ModelOutput from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...utils.generic import check_model_inputs from ...modeling_attn_mask_utils i...
@auto_docstring(custom_intro='\n The Idefics3 Vision Transformer Model outputting raw image embedding.\n ') class Idefics3VisionTransformer(Idefics3PreTrainedModel): def __init__(self, config: Idefics3VisionConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(...
7
0
17
2
15
1
3
0.08
1
6
4
0
4
5
4
5
78
12
61
25
49
5
35
18
30
8
2
1
11
3,103
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/idefics3/processing_idefics3.py
transformers.models.idefics3.processing_idefics3.Idefics3ImagesKwargs
from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack from typing import TYPE_CHECKING, Optional, Union class Idefics3ImagesKwargs(ImagesKwargs, total=False): return_row_col_info: Optional[bool] max_image_size: Optional[dict[str, int]]
class Idefics3ImagesKwargs(ImagesKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
3
0
3
1
2
0
3
1
2
0
2
0
0
3,104
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/idefics3/processing_idefics3.py
transformers.models.idefics3.processing_idefics3.Idefics3Processor
from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack from ...image_utils import ImageInput, is_valid_image, load_image from itertools import accumulate import re from typing import TYPE_CHECKING, Optional, Union from ...tokenization_utils_base import AddedToken, BatchEn...
class Idefics3Processor(ProcessorMixin): ''' Constructs a Idefics3 processor which wraps a LLama tokenizer and Idefics3 image processor into a single processor. [`Idefics3Processor`] offers all the functionalities of [`Idefics3ImageProcessor`] and [`Idefics3TokenizerFast`]. See the docstring of [`~Idef...
5
3
36
5
23
9
5
0.5
1
12
3
0
6
6
6
23
247
36
141
52
125
71
93
43
86
21
2
4
32
3,105
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/idefics3/processing_idefics3.py
transformers.models.idefics3.processing_idefics3.Idefics3ProcessorKwargs
from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack class Idefics3ProcessorKwargs(ProcessingKwargs, total=False): images_kwargs: Idefics3ImagesKwargs _defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': False, 'is_split_into_words': False, 'retu...
class Idefics3ProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
13
1
12
2
11
0
3
2
2
0
3
0
0
3,106
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/configuration_ijepa.py
transformers.models.ijepa.configuration_ijepa.IJepaConfig
from ...configuration_utils import PretrainedConfig class IJepaConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`IJepaModel`]. It is used to instantiate an IJEPA model according to the specified arguments, defining the model architecture. Instantiating a config...
class IJepaConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`IJepaModel`]. It is used to instantiate an IJEPA model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar c...
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
3,107
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaAttention
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer import torch.nn as nn import torch from .configuration_ijepa import IJepaConfig from typing import Callable, Optional, Union class IJepaAttention(nn.Module): def __init__(self, config: IJepaConfig): super().__init__() ...
class IJepaAttention(nn.Module): def __init__(self, config: IJepaConfig): 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
3,108
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaEmbeddings
import torch from ...utils import TransformersKwargs, auto_docstring, torch_int from .configuration_ijepa import IJepaConfig import torch.nn as nn from typing import Callable, Optional, Union class IJepaEmbeddings(nn.Module): """ Construct the CLS token, position and patch embeddings. Optionally, also the mask...
class IJepaEmbeddings(nn.Module): ''' Construct the CLS token, position and patch embeddings. Optionally, also the mask token. ''' def __init__(self, config: IJepaConfig, use_mask_token: bool=False) -> None: pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, wi...
4
2
24
5
16
3
2
0.27
1
6
2
0
3
6
3
13
79
17
49
28
40
13
38
23
34
3
1
1
7
3,109
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaEncoder
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput import torch.nn as nn import torch from typing import Callable, Optional, Union from .configuration_ijepa import IJepaConfig class IJepaEncoder(nn.Module): def __init__(self, config: IJepaConfig): super().__...
class IJepaEncoder(nn.Module): def __init__(self, config: IJepaConfig): 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
3,110
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaForImageClassification
from typing import Callable, Optional, Union from ...processing_utils import Unpack from ...utils import TransformersKwargs, auto_docstring, torch_int from ...utils.generic import can_return_tuple, check_model_inputs from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput impo...
@auto_docstring(custom_intro="\n IJepa Model transformer with an image classification head on top (a linear layer on top of the final hidden states)\n e.g. for ImageNet.\n\n <Tip>\n\n Note that it's possible to fine-tune IJepa on higher resolution images than the ones it has been trained on, by\n ...
6
1
39
5
29
5
7
0.14
1
8
3
0
2
3
2
3
86
11
66
22
47
9
33
12
30
12
2
3
14
3,111
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaIntermediate
import torch.nn as nn from .configuration_ijepa import IJepaConfig from ...activations import ACT2FN import torch class IJepaIntermediate(nn.Module): def __init__(self, config: IJepaConfig): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstan...
class IJepaIntermediate(nn.Module): def __init__(self, config: IJepaConfig): 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
3,112
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaLayer
from .configuration_ijepa import IJepaConfig import torch import torch.nn as nn from ...modeling_layers import GradientCheckpointingLayer from typing import Callable, Optional, Union class IJepaLayer(GradientCheckpointingLayer): """This corresponds to the Block class in the timm implementation.""" def __init_...
class IJepaLayer(GradientCheckpointingLayer): '''This corresponds to the Block class in the timm implementation.''' def __init__(self, config: IJepaConfig): 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
3,113
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaModel
from ...utils import TransformersKwargs, auto_docstring, torch_int from .configuration_ijepa import IJepaConfig import torch from ...processing_utils import Unpack from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput import torch...
@auto_docstring class IJepaModel(IJepaPreTrainedModel): def __init__(self, config: IJepaConfig, add_pooling_layer: bool=False, use_mask_token: bool=False): ''' add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer use_mask_token (`bool`, *optio...
8
3
20
2
14
4
4
0.23
1
11
6
0
4
5
4
5
92
12
65
27
43
15
33
17
28
9
2
1
14
3,114
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaOutput
import torch import torch.nn as nn from .configuration_ijepa import IJepaConfig class IJepaOutput(nn.Module): def __init__(self, config: IJepaConfig): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_pro...
class IJepaOutput(nn.Module): def __init__(self, config: IJepaConfig): 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
3,115
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaPatchEmbeddings
from .configuration_ijepa import IJepaConfig import torch import torch.nn as nn import collections.abc class IJepaPatchEmbeddings(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, s...
class IJepaPatchEmbeddings(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: I...
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
3,116
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaPooler
from .configuration_ijepa import IJepaConfig import torch.nn as nn import torch from ...activations import ACT2FN class IJepaPooler(nn.Module): def __init__(self, config: IJepaConfig): super().__init__() self.dense = nn.Linear(config.hidden_size, config.pooler_output_size) self.activation ...
class IJepaPooler(nn.Module): def __init__(self, config: IJepaConfig): 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
3,117
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaPreTrainedModel
from typing import Callable, Optional, Union from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_ijepa import IJepaConfig import torch import torch.nn as nn from ...utils import TransformersKwargs, auto_docstring, torch_int @auto_docstring class IJepaPreTrainedModel(PreTrainedMod...
@auto_docstring class IJepaPreTrainedModel(PreTrainedModel): def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None: '''Initialize the weights''' pass
3
1
19
0
16
3
5
0.3
1
1
1
2
1
0
1
1
32
2
23
8
21
7
15
8
13
5
1
2
5
3,118
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaSelfAttention
import torch.nn as nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_ijepa import IJepaConfig from typing import Callable, Optional, Union import torch class IJepaSelfAttention(nn.Module): def __init__(self, config: IJepaConfig): super().__init__() if co...
class IJepaSelfAttention(nn.Module): def __init__(self, config: IJepaConfig): 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
3,119
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modeling_ijepa.py
transformers.models.ijepa.modeling_ijepa.IJepaSelfOutput
import torch import torch.nn as nn from .configuration_ijepa import IJepaConfig class IJepaSelfOutput(nn.Module): """ The residual connection is defined in IJepaLayer instead of here (as is the case with other models), due to the layernorm applied before each block. """ def __init__(self, config: ...
class IJepaSelfOutput(nn.Module): ''' The residual connection is defined in IJepaLayer instead of here (as is the case with other models), due to the layernorm applied before each block. ''' def __init__(self, config: IJepaConfig): pass def forward(self, hidden_states: torch.Tensor, i...
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
3,120
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modular_ijepa.py
transformers.models.ijepa.modular_ijepa.IJepaEmbeddings
from transformers.models.ijepa.configuration_ijepa import IJepaConfig from ...utils import TransformersKwargs, auto_docstring, torch_int from typing import Optional, Union import torch.nn as nn import torch from ..vit.modeling_vit import ViTEmbeddings, ViTForImageClassification, ViTModel, ViTPreTrainedModel class IJep...
class IJepaEmbeddings(ViTEmbeddings): def __init__(self, config: IJepaConfig, use_mask_token: bool=False) -> None: pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor: ''' This method allows to interpolate the pre-trained position...
4
1
23
5
15
4
2
0.24
1
5
0
0
3
1
3
16
72
16
45
23
36
11
34
18
30
3
2
1
6
3,121
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modular_ijepa.py
transformers.models.ijepa.modular_ijepa.IJepaForImageClassification
from ...processing_utils import Unpack from transformers.models.ijepa.configuration_ijepa import IJepaConfig from ...modeling_outputs import BaseModelOutputWithPooling, ImageClassifierOutput from ...utils import TransformersKwargs, auto_docstring, torch_int import torch from ..vit.modeling_vit import ViTEmbeddings, ViT...
@auto_docstring(custom_intro="\n IJepa Model transformer with an image classification head on top (a linear layer on top of the final hidden states)\n e.g. for ImageNet.\n\n <Tip>\n\n Note that it's possible to fine-tune IJepa on higher resolution images than the ones it has been trained on, by\n ...
4
1
35
4
28
4
7
0.12
2
8
2
0
2
1
2
135
72
8
57
19
45
7
31
10
28
12
3
3
13
3,122
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modular_ijepa.py
transformers.models.ijepa.modular_ijepa.IJepaModel
from transformers.models.ijepa.configuration_ijepa import IJepaConfig from ..vit.modeling_vit import ViTEmbeddings, ViTForImageClassification, ViTModel, ViTPreTrainedModel class IJepaModel(IJepaPreTrainedModel, ViTModel): def __init__(self, config: IJepaConfig, add_pooling_layer: bool=False, use_mask_token: bool=...
class IJepaModel(IJepaPreTrainedModel, ViTModel): def __init__(self, config: IJepaConfig, add_pooling_layer: bool=False, use_mask_token: bool=False): ''' add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer use_mask_token (`bool`, *optional*,...
2
1
4
0
4
0
1
0
2
4
1
0
1
2
1
136
5
0
5
4
3
0
5
4
3
1
3
0
1
3,123
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/ijepa/modular_ijepa.py
transformers.models.ijepa.modular_ijepa.IJepaPreTrainedModel
from ..vit.modeling_vit import ViTEmbeddings, ViTForImageClassification, ViTModel, ViTPreTrainedModel from ...utils import TransformersKwargs, auto_docstring, torch_int from typing import Optional, Union import torch.nn as nn import torch @auto_docstring class IJepaPreTrainedModel(ViTPreTrainedModel): def _init_w...
@auto_docstring class IJepaPreTrainedModel(ViTPreTrainedModel): def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None: '''Initialize the weights''' pass
3
1
19
0
16
3
5
0.3
1
1
1
2
1
0
1
130
32
2
23
8
21
7
15
8
13
5
2
2
5
3,124
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/configuration_imagegpt.py
transformers.models.imagegpt.configuration_imagegpt.ImageGPTConfig
from ...configuration_utils import PretrainedConfig class ImageGPTConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ImageGPTModel`] or a [`TFImageGPTModel`]. It is used to instantiate a GPT-2 model according to the specified arguments, defining the model archit...
class ImageGPTConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ImageGPTModel`] or a [`TFImageGPTModel`]. It is used to instantiate a GPT-2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the d...
2
1
40
1
39
1
1
1.15
1
1
0
0
1
17
1
1
113
11
48
42
26
55
23
22
21
1
1
0
1
3,125
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/configuration_imagegpt.py
transformers.models.imagegpt.configuration_imagegpt.ImageGPTOnnxConfig
from collections import OrderedDict from ...onnx import OnnxConfig from typing import TYPE_CHECKING, Any from collections.abc import Mapping class ImageGPTOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return OrderedDict([('input_ids', {0: 'batch', 1: 'sequence'...
class ImageGPTOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass def generate_dummy_inputs(self, preprocessor: 'FeatureExtractionMixin', batch_size: int=1, seq_length: int=-1, is_pair: bool=False, num_channels: int=3, image_width: int=32, image_height: int...
4
1
24
2
10
12
1
1.09
1
6
0
0
2
0
2
2
51
5
22
16
8
24
7
5
4
1
1
0
2
3,126
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/feature_extraction_imagegpt.py
transformers.models.imagegpt.feature_extraction_imagegpt.ImageGPTFeatureExtractor
from .image_processing_imagegpt import ImageGPTImageProcessor from ...utils.import_utils import requires import warnings @requires(backends=('vision',)) class ImageGPTFeatureExtractor(ImageGPTImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class ImageGPTFeatureExtractor is...
@requires(backends=('vision',)) class ImageGPTFeatureExtractor(ImageGPTImageProcessor): 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
3,127
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/image_processing_imagegpt.py
transformers.models.imagegpt.image_processing_imagegpt.ImageGPTImageProcessor
import numpy as np from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging from ...utils.import_utils import requires from ...image_utils import ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_list_of_images, to_numpy_array, ...
@requires(backends=('vision',)) class ImageGPTImageProcessor(BaseImageProcessor): ''' Constructs a ImageGPT image processor. This image processor can be used to resize images to a smaller resolution (such as 32x32 or 64x64), normalize them and finally color quantize them to obtain sequences of "pixel values...
8
4
53
4
28
20
5
0.9
1
8
2
1
4
6
4
24
241
23
115
50
75
103
56
15
51
14
3
1
20
3,128
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTAttention
import torch from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from torch import nn from ...utils import auto_docstring, logging, torch_float from typing import Any, Optional, Union class ImageGPTAttention(nn.Mo...
class ImageGPTAttention(nn.Module): def __init__(self, config, is_cross_attention: Optional[bool]=False, layer_idx: Optional[int]=None): pass def prune_heads(self, heads): pass def _attn(self, query, key, value, attention_mask=None, head_mask=None): pass def _upcast_and_reor...
8
2
30
5
21
4
4
0.19
1
11
1
0
7
15
7
17
217
43
148
58
130
28
122
48
114
7
1
2
27
3,129
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTBlock
import torch from typing import Any, Optional, Union from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_layers import GradientCheckpointingLayer class ImageGPTBlock(GradientCheckpointingLayer): def __init__(self, config, layer_idx=None): super().__init__() hidden_...
class ImageGPTBlock(GradientCheckpointingLayer): def __init__(self, config, layer_idx=None): pass def forward(self, hidden_states: torch.Tensor, layer_past: Optional[Cache]=None, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, encoder_hidden_states: Optional[torch...
3
0
36
4
30
4
4
0.11
1
8
3
0
2
6
2
12
73
8
61
27
48
7
34
17
31
4
1
2
7
3,130
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTForCausalImageModeling
from torch.nn import CrossEntropyLoss from typing import Any, Optional, Union from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, SequenceClassifierOutputWithPast from ...utils import auto_docst...
@auto_docstring(custom_intro='\n The ImageGPT Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ') class ImageGPTForCausalImageModeling(ImageGPTPreTrainedModel, GenerationMixin): def __init__(self, config: ImageGPTConfig): pass ...
5
1
29
4
16
9
2
0.51
2
10
3
0
4
4
5
7
153
23
86
40
58
44
35
19
29
7
2
2
11
3,131
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTForImageClassification
from typing import Any, Optional, Union from ...utils import auto_docstring, logging, torch_float from torch import nn import torch from .configuration_imagegpt import ImageGPTConfig from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, SequenceClassifierOutputWit...
@auto_docstring(custom_intro='\n The ImageGPT Model transformer with an image classification head on top (linear layer).\n [`ImageGPTForImageClassification`] average-pools the hidden states in order to do the classification.\n ') class ImageGPTForImageClassification(ImageGPTPreTrainedModel): def __init__(...
5
1
59
8
40
11
8
0.27
1
10
3
0
2
3
2
4
121
16
83
29
63
22
38
13
35
14
2
3
15
3,132
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTLayerNorm
from torch import nn import torch class ImageGPTLayerNorm(nn.Module): def __init__(self, hidden_size: tuple[int], eps: float=1e-05): super().__init__() self.eps = eps self.weight = nn.Parameter(torch.Tensor(hidden_size)) def forward(self, tensor: torch.Tensor) -> torch.Tensor: ...
class ImageGPTLayerNorm(nn.Module): def __init__(self, hidden_size: tuple[int], eps: float=1e-05): pass def forward(self, tensor: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
5
1
1
0.09
1
5
0
0
2
2
2
12
13
1
11
5
8
1
7
5
4
1
1
0
2
3,133
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTMLP
from torch import nn from ...activations import ACT2FN from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer import torch class ImageGPTMLP(nn.Module): def __init__(self, intermediate_size, config): super().__init__() embed_dim = config.hidden_size self....
class ImageGPTMLP(nn.Module): def __init__(self, intermediate_size, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
7
0
7
0
1
0
1
3
1
0
2
4
2
12
15
1
14
8
11
0
14
8
11
1
1
0
2
3,134
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTModel
import torch from typing import Any, Optional, Union from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from .configuration_imagegpt import ImageGPTConfig from ...utils import auto_docstring, logging, torch_float from torch import nn from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttent...
@auto_docstring class ImageGPTModel(ImageGPTPreTrainedModel): def __init__(self, config: ImageGPTConfig): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings): pass def _prune_heads(self, heads_to_prune): ''' Prunes heads of...
8
2
51
7
34
9
10
0.27
1
15
4
0
5
9
5
7
261
40
175
50
151
47
113
33
107
43
2
4
48
3,135
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/imagegpt/modeling_imagegpt.py
transformers.models.imagegpt.modeling_imagegpt.ImageGPTPreTrainedModel
import math from .configuration_imagegpt import ImageGPTConfig from ...modeling_utils import PreTrainedModel from torch import nn from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer from ...utils import auto_docstring, logging, torch_float @auto_docstring class ImageGPTPreTrainedM...
@auto_docstring class ImageGPTPreTrainedModel(PreTrainedModel): def __init__(self, *inputs, **kwargs): pass def _init_weights(self, module): '''Initialize the weights.''' pass
4
1
14
1
8
5
5
0.61
1
3
2
3
2
0
2
2
41
4
23
10
20
14
21
10
18
8
1
2
9
3,136
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/configuration_informer.py
transformers.models.informer.configuration_informer.InformerConfig
from ...configuration_utils import PretrainedConfig from typing import Optional, Union class InformerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of an [`InformerModel`]. It is used to instantiate an Informer model according to the specified arguments, defining t...
class InformerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of an [`InformerModel`]. It is used to instantiate an Informer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a...
4
1
54
5
47
4
4
1.01
1
6
0
0
2
33
2
2
221
19
101
75
61
102
48
38
45
6
1
2
7
3,137
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerAttention
from .configuration_informer import InformerConfig from ...processing_utils import Unpack from ...utils.deprecation import deprecate_kwarg from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...modeling_flash_attention_utils import FlashAttentionKwargs f...
class InformerAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[InformerConfig]=None, layer_idx: Optional[int]=None): ...
4
2
50
7
35
8
5
0.24
1
7
1
0
3
12
3
13
156
23
107
44
86
26
68
27
64
12
1
2
15
3,138
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerConvLayer
from torch import nn from ...modeling_layers import GradientCheckpointingLayer class InformerConvLayer(GradientCheckpointingLayer): def __init__(self, c_in): super().__init__() self.downConv = nn.Conv1d(in_channels=c_in, out_channels=c_in, kernel_size=3, padding=1, padding_mode='circular') ...
class InformerConvLayer(GradientCheckpointingLayer): def __init__(self, c_in): pass def forward(self, x): pass
3
0
10
0
10
0
1
0
1
1
0
0
2
4
2
12
21
1
20
7
17
0
14
7
11
1
1
0
2
3,139
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerDecoder
from typing import Callable, Optional, Union from torch import nn import torch from .configuration_informer import InformerConfig from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, SampleTSPredictionOutput, Seq2SeqTSModelOutput, Seq2SeqTSPredictionOutput from ...cache_utils impo...
class InformerDecoder(InformerPreTrainedModel): ''' Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`InformerDecoderLayer`] Args: config: InformerConfig ''' def __init__(self, config: InformerConfig): pass def forward(self, attention_mask...
3
2
103
14
61
28
18
0.5
1
13
5
0
2
7
2
3
215
31
123
37
107
61
63
24
60
33
2
3
35
3,140
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerDecoderLayer
from .configuration_informer import InformerConfig from ...utils.deprecation import deprecate_kwarg from ...modeling_layers import GradientCheckpointingLayer from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from ...activations import ACT2FN from torch impo...
class InformerDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: InformerConfig, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tenso...
4
1
61
6
43
13
4
0.29
1
6
3
0
2
11
2
12
124
12
87
32
73
25
46
21
43
6
1
1
8
3,141
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerEncoder
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask, _prepare_4d_causal_attention_mask_for_sdpa from .configuration_informer import InformerConfig from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttent...
class InformerEncoder(InformerPreTrainedModel): ''' Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`InformerEncoderLayer`]. Args: config: InformerConfig ''' def __init__(self, config: InformerConfig): pass def forward(self...
3
2
70
10
46
15
13
0.39
1
14
6
0
2
8
2
3
149
22
92
28
81
36
59
20
56
22
2
4
25
3,142
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerEncoderLayer
from typing import Callable, Optional, Union from ...activations import ACT2FN from torch import nn import torch from .configuration_informer import InformerConfig from ...modeling_layers import GradientCheckpointingLayer class InformerEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: InformerC...
class InformerEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: InformerConfig): pass def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, layer_head_mask: torch.FloatTensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor, Opti...
3
1
36
3
28
6
3
0.19
1
5
3
0
2
9
2
12
74
6
57
22
48
11
34
16
31
3
1
1
5
3,143
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerFeatureEmbedder
from torch import nn import torch class InformerFeatureEmbedder(nn.Module): """ Embed a sequence of categorical features. Args: cardinalities (`list[int]`): List of cardinalities of the categorical features. embedding_dims (`list[int]`): List of embedding dimensions...
class InformerFeatureEmbedder(nn.Module): ''' Embed a sequence of categorical features. Args: cardinalities (`list[int]`): List of cardinalities of the categorical features. embedding_dims (`list[int]`): List of embedding dimensions of the categorical features. '...
3
1
10
1
8
1
2
0.59
1
4
0
0
2
2
2
12
32
5
17
6
14
10
10
6
7
2
1
1
3
3,144
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerForPrediction
from typing import Callable, Optional, Union from ...utils import auto_docstring, is_torch_flex_attn_available, logging import torch from ...time_series_utils import NegativeBinomialOutput, NormalOutput, StudentTOutput from .configuration_informer import InformerConfig from ...modeling_outputs import BaseModelOutput, B...
@auto_docstring class InformerForPrediction(InformerPreTrainedModel): def __init__(self, config: InformerConfig): pass def output_params(self, dec_output): pass def get_encoder(self): pass def get_decoder(self): pass @torch.jit.ignore def output_distribution(s...
12
2
47
7
24
16
3
0.66
1
14
8
0
7
5
7
8
341
58
171
80
129
113
77
47
69
9
2
2
21
3,145
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerMeanScaler
from torch import nn from .configuration_informer import InformerConfig import torch class InformerMeanScaler(nn.Module): """ Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data accordingly. """ def __init__(self, config: InformerConfig):...
class InformerMeanScaler(nn.Module): ''' Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data accordingly. ''' def __init__(self, config: InformerConfig): pass def forward(self, data: torch.Tensor, observed_indicator: torch.Te...
3
2
23
3
12
8
4
0.76
1
3
1
0
2
4
2
12
52
8
25
16
20
19
22
14
19
5
1
1
8
3,146
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerModel
from .configuration_informer import InformerConfig from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, SampleTSPredictionOutput, Seq2SeqTSModelOutput, Seq2SeqTSPredictionOutput from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Option...
@auto_docstring class InformerModel(InformerPreTrainedModel): def __init__(self, config: InformerConfig): pass @property def _past_length(self) -> int: pass def get_lagged_subsequences(self, sequence: torch.Tensor, subsequences_length: int, shift: int=0) -> torch.Tensor: ''' ...
10
2
35
4
24
7
4
0.26
1
14
9
0
7
4
7
8
255
34
175
70
134
46
70
38
62
10
2
1
31
3,147
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerNOPScaler
from typing import Callable, Optional, Union from .configuration_informer import InformerConfig from torch import nn import torch class InformerNOPScaler(nn.Module): """ Assigns a scaling factor equal to 1 along the first dimension, and therefore applies no scaling to the input data. """ def __init__(...
class InformerNOPScaler(nn.Module): ''' Assigns a scaling factor equal to 1 along the first dimension, and therefore applies no scaling to the input data. ''' def __init__(self, config: InformerConfig): pass def forward(self, data: torch.Tensor, observed_indicator: Optional[torch.Tensor]=...
3
2
10
0
5
5
2
1.09
1
3
1
0
2
2
2
12
25
2
11
9
6
12
9
7
6
3
1
0
4
3,148
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerPreTrainedModel
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask, _prepare_4d_causal_attention_mask_for_sdpa from .configuration_informer import InformerConfig from typing import Callable, Optional, Union from ...modeling_utils import ALL_ATTENTI...
@auto_docstring class InformerPreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module): pass def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs_embeds: torch.Tensor): pass def _update_causal_mask(self, attention_mask: Union[torch.Tensor, None...
6
0
10
0
10
0
5
0
1
1
1
4
1
0
1
1
16
1
15
7
13
0
14
7
12
5
1
2
5
3,149
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerProbSparseAttention
import numpy as np from ...utils.deprecation import deprecate_kwarg from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Callable, Optional, Union from torch import nn import torch class InformerProbSparseAttention(nn.Module): """Probabilistic Attention mechanism to select the "ac...
class InformerProbSparseAttention(nn.Module): '''Probabilistic Attention mechanism to select the "active" queries rather than the "lazy" queries and provides a sparse Transformer thus mitigating the quadratic compute and memory requirements of vanilla attention''' def __init__(self, embed_dim: int, nu...
5
2
70
10
49
13
7
0.28
1
6
0
0
3
11
3
13
216
33
148
58
128
42
97
42
93
17
1
2
20
3,150
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerSinusoidalPositionalEmbedding
from typing import Callable, Optional, Union from torch import nn import numpy as np import torch class InformerSinusoidalPositionalEmbedding(nn.Embedding): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Option...
class InformerSinusoidalPositionalEmbedding(nn.Embedding): '''This module produces sinusoidal positional embeddings of any length.''' def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None) -> None: pass def _init_weight(self): ''' Identical to ...
5
3
8
0
7
2
1
0.3
1
4
0
0
2
1
3
3
32
3
23
12
17
7
17
10
13
2
1
0
4
3,151
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerStdScaler
from torch import nn from .configuration_informer import InformerConfig import torch class InformerStdScaler(nn.Module): """ Standardize features by calculating the mean and scaling along the first dimension, and then normalizes it by subtracting from the mean and dividing by the standard deviation. ""...
class InformerStdScaler(nn.Module): ''' Standardize features by calculating the mean and scaling along the first dimension, and then normalizes it by subtracting from the mean and dividing by the standard deviation. ''' def __init__(self, config: InformerConfig): pass def forward(self...
3
2
13
1
7
6
3
1
1
3
1
0
2
3
2
12
33
3
15
12
10
15
13
10
10
4
1
0
5
3,152
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/informer/modeling_informer.py
transformers.models.informer.modeling_informer.InformerValueEmbedding
from torch import nn class InformerValueEmbedding(nn.Module): def __init__(self, feature_size, d_model): super().__init__() self.value_projection = nn.Linear(in_features=feature_size, out_features=d_model, bias=False) def forward(self, x): return self.value_projection(x)
class InformerValueEmbedding(nn.Module): def __init__(self, feature_size, d_model): pass def forward(self, x): pass
3
0
3
0
3
0
1
0
1
1
0
0
2
1
2
12
7
1
6
4
3
0
6
4
3
1
1
0
2
3,153
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/configuration_instructblip.py
transformers.models.instructblip.configuration_instructblip.InstructBlipConfig
from ..auto import CONFIG_MAPPING, AutoConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...configuration_utils import PretrainedConfig class InstructBlipConfig(PretrainedConfig): """ [`InstructBlipConfig`] is the configuration class to store the configuration of a [`In...
class InstructBlipConfig(PretrainedConfig): ''' [`InstructBlipConfig`] is the configuration class to store the configuration of a [`InstructBlipForConditionalGeneration`]. It is used to instantiate a InstructBLIP model according to the specified arguments, defining the vision model, Q-Former model and ...
4
2
28
4
21
3
3
0.98
1
3
2
0
1
8
2
2
120
21
50
29
32
49
26
14
23
5
1
1
6
3,154
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/configuration_instructblip.py
transformers.models.instructblip.configuration_instructblip.InstructBlipQFormerConfig
from ...configuration_utils import PretrainedConfig class InstructBlipQFormerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`InstructBlipQFormerModel`]. It is used to instantiate a InstructBLIP Querying Transformer (Q-Former) model according to the specified ...
class InstructBlipQFormerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`InstructBlipQFormerModel`]. It is used to instantiate a InstructBLIP Querying Transformer (Q-Former) model according to the specified arguments, defining the model architecture. Inst...
2
1
35
1
34
0
1
1.51
1
1
0
0
1
14
1
1
102
9
37
36
17
56
19
18
17
1
1
0
1
3,155
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/configuration_instructblip.py
transformers.models.instructblip.configuration_instructblip.InstructBlipVisionConfig
from ...configuration_utils import PretrainedConfig class InstructBlipVisionConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`InstructBlipVisionModel`]. It is used to instantiate a InstructBLIP vision encoder according to the specified arguments, defining the m...
class InstructBlipVisionConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`InstructBlipVisionModel`]. It is used to instantiate a InstructBLIP vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration...
2
1
28
1
27
0
1
1.4
1
1
0
0
1
11
1
1
82
10
30
29
14
42
16
15
14
1
1
0
1
3,156
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipAttention
import torch from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from typing import Any, Callable, Optional, Union from torch import nn class InstructBlipAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__i...
class InstructBlipAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config): pass def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.T...
4
2
25
6
17
2
3
0.16
1
5
0
0
3
8
3
13
79
20
51
29
42
8
40
24
36
4
1
1
8
3,157
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipEncoder
import torch from typing import Any, Callable, Optional, Union from ...processing_utils import Unpack from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWith...
class InstructBlipEncoder(nn.Module): ''' Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a [`InstructBlipEncoderLayer`]. Args: config (`InstructBlipConfig`): The corresponding vision configuration for the `InstructBlipEncoder`. ...
4
1
37
4
24
9
7
0.52
1
9
3
0
2
3
2
12
84
11
48
18
38
25
27
11
24
12
1
2
13
3,158
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipEncoderLayer
from torch import nn from ...processing_utils import Unpack import torch from .configuration_instructblip import InstructBlipConfig, InstructBlipQFormerConfig, InstructBlipVisionConfig from ...modeling_layers import GradientCheckpointingLayer from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_ret...
class InstructBlipEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: InstructBlipConfig): pass @auto_docstring def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, **kwargs: Unpack[TransformersKwargs]) -> torch.FloatTensor: pass
4
0
22
3
15
5
2
0.33
1
6
3
0
2
5
2
12
46
6
30
16
22
10
21
11
18
2
1
1
3
3,159
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipForConditionalGeneration
from ..auto import AutoModel, AutoModelForCausalLM, AutoModelForSeq2SeqLM import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn from typing import Any, Callable, Optional, Union from ...generation import GenerationMixin from ...proce...
null
18
5
30
4
19
7
3
0.34
2
8
6
0
11
5
11
12
349
53
222
78
182
75
119
53
107
12
2
2
36
3,160
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipForConditionalGenerationModelOutput
from typing import Any, Callable, Optional, Union from dataclasses import dataclass from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int import torch @dataclass @auto_docstring(custom_intro='\n Class defining the outputs of [`InstructBlipForConditionalGeneration...
@dataclass @auto_docstring(custom_intro='\n Class defining the outputs of [`InstructBlipForConditionalGeneration`].\n ') class InstructBlipForConditionalGenerationModelOutput(ModelOutput): ''' loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`): ...
4
1
7
0
7
0
2
1.08
1
2
0
0
1
0
1
1
30
3
13
7
11
14
8
7
6
2
1
0
2
3,161
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipMLP
from torch import nn from ...activations import ACT2FN import torch class InstructBlipMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.activation_fn = ACT2FN[config.hidden_act] self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size...
class InstructBlipMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
1
0
1
2
0
0
2
4
2
12
13
1
12
7
9
0
12
7
9
1
1
0
2
3,162
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipPreTrainedModel
from torch import nn from .configuration_instructblip import InstructBlipConfig, InstructBlipQFormerConfig, InstructBlipVisionConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int @auto_do...
@auto_docstring class InstructBlipPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
19
2
16
1
7
0.22
1
2
2
3
1
0
1
1
38
5
27
8
25
6
20
8
18
7
1
2
7
3,163
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerAttention
from ...processing_utils import Unpack from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from typing import Any, Callable, Optional, Union import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int fr...
class InstructBlipQFormerAttention(nn.Module): def __init__(self, config, is_cross_attention=False): pass def prune_heads(self, heads): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encod...
4
0
15
1
13
1
1
0.07
1
6
2
0
3
3
3
13
47
4
41
20
28
3
22
11
18
2
1
1
4
3,164
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerEmbeddings
import torch from torch import nn class InstructBlipQFormerEmbeddings(nn.Module): """Construct the embeddings from word and position embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_t...
class InstructBlipQFormerEmbeddings(nn.Module): '''Construct the embeddings from word and position embeddings.''' def __init__(self, config): pass def forward(self, input_ids=None, position_ids=None, query_embeds=None, past_key_values_length=0): pass
3
1
23
4
19
1
4
0.05
1
1
0
0
2
6
2
12
49
9
38
18
29
2
28
12
25
6
1
2
7
3,165
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerEncoder
from torch import nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from ...processing_utils im...
class InstructBlipQFormerEncoder(nn.Module): def __init__(self, config): pass @can_return_tuple def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, query_length=0, **kwargs: Unpack[TransformersKwargs]): pass
4
0
46
4
42
0
9
0
1
5
2
0
2
3
2
12
93
8
85
28
69
0
35
15
32
16
1
3
17
3,166
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerIntermediate
import torch from torch import nn from ...activations import ACT2FN class InstructBlipQFormerIntermediate(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....
class InstructBlipQFormerIntermediate(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
3,167
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerLayer
from ...modeling_layers import GradientCheckpointingLayer from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from ...processing_utils import U...
class InstructBlipQFormerLayer(GradientCheckpointingLayer): def __init__(self, config, layer_idx): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, query_length=0, **kwargs: Unpack[TransformersKwargs]): pass ...
5
0
24
3
21
1
3
0.02
1
5
3
0
4
10
4
14
101
14
85
38
70
2
45
28
40
6
1
3
10
3,168
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerModel
from ...utils.generic import OutputRecorder, check_model_inputs from typing import Any, Callable, Optional, Union from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from ...utils import ModelOutput, Transfo...
class InstructBlipQFormerModel(InstructBlipPreTrainedModel): ''' Querying Transformer (Q-Former), used in InstructBLIP. Slightly modified from BLIP-2 as it also takes the instruction as input. ''' def __init__(self, config: InstructBlipQFormerConfig): pass def get_input_embeddings(sel...
9
4
31
3
18
9
4
0.53
1
10
4
0
6
3
6
7
194
25
111
45
84
59
55
25
48
13
2
2
21
3,169
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerMultiHeadAttention
import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn import math from ...processing_utils import Unpack class InstructBlipQFormerMultiHeadAttention(nn.Module): def __init__(self, config, is_cross_attention=False): supe...
class InstructBlipQFormerMultiHeadAttention(nn.Module): def __init__(self, config, is_cross_attention=False): pass def save_attn_gradients(self, attn_gradients): pass def get_attn_gradients(self): pass def save_attention_map(self, attention_map): pass def get_at...
8
0
18
3
14
1
3
0.1
1
3
0
0
7
14
7
17
131
26
96
52
79
10
80
43
72
10
1
2
19
3,170
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerOutput
from torch import nn import torch class InstructBlipQFormerOutput(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.dropou...
class InstructBlipQFormerOutput(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
3,171
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipQFormerSelfOutput
from torch import nn import torch class InstructBlipQFormerSelfOutput(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 ...
class InstructBlipQFormerSelfOutput(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
3,172
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipVisionEmbeddings
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn import torch from .configuration_instructblip import InstructBlipConfig, InstructBlipQFormerConfig, InstructBlipVisionConfig class InstructBlipVisionEmbeddings(nn.Module): def __init__(s...
class InstructBlipVisionEmbeddings(nn.Module): def __init__(self, config: InstructBlipVisionConfig): pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor: ''' This method allows to interpolate the pre-trained position encodings, to...
4
1
23
5
16
3
2
0.19
1
5
1
0
3
9
3
13
72
16
48
27
44
9
40
27
36
2
1
1
5
3,173
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/modeling_instructblip.py
transformers.models.instructblip.modeling_instructblip.InstructBlipVisionModel
from .configuration_instructblip import InstructBlipConfig, InstructBlipQFormerConfig, InstructBlipVisionConfig from torch import nn import torch from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from typing import Any, Callable, Optional, Union from ...modeling_...
class InstructBlipVisionModel(InstructBlipPreTrainedModel): def __init__(self, config: InstructBlipVisionConfig): pass @check_model_inputs @auto_docstring def forward(self, pixel_values: Optional[torch.FloatTensor]=None, interpolate_pos_encoding: bool=False, **kwargs: Unpack[TransformersKwargs...
6
0
19
3
15
1
3
0.06
1
7
4
0
3
4
3
4
65
13
49
23
36
3
28
15
24
6
2
1
8
3,174
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/processing_instructblip.py
transformers.models.instructblip.processing_instructblip.InstructBlipProcessor
from typing import Optional, Union from ..auto import AutoTokenizer from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput import os from ...tokenization_utils_base import AddedToken, PreTokenizedInput, TextInput from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack ...
class InstructBlipProcessor(ProcessorMixin): ''' Constructs an InstructBLIP processor which wraps a BLIP image processor and a LLaMa/T5 tokenizer into a single processor. [`InstructBlipProcessor`] offers all the functionalities of [`BlipImageProcessor`] and [`AutoTokenizer`]. See the docstring of [...
8
2
18
2
13
4
3
0.49
1
11
4
0
6
2
7
24
166
23
96
41
79
47
71
32
63
9
2
3
20
3,175
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblip/processing_instructblip.py
transformers.models.instructblip.processing_instructblip.InstructBlipProcessorKwargs
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack class InstructBlipProcessorKwargs(ProcessingKwargs, total=False): _defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': False, 'stride': 0, 'return_overflowing_tokens': False, 'return_special_tokens_mask': False, 'return_offsets...
class InstructBlipProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
15
0
15
2
14
0
2
2
1
0
3
0
0
3,176
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/configuration_instructblipvideo.py
transformers.models.instructblipvideo.configuration_instructblipvideo.InstructBlipVideoConfig
from ...configuration_utils import PretrainedConfig from ..auto import CONFIG_MAPPING, AutoConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES class InstructBlipVideoConfig(PretrainedConfig): """ [`InstructBlipVideoConfig`] is the configuration class to store the configuration of ...
class InstructBlipVideoConfig(PretrainedConfig): ''' [`InstructBlipVideoConfig`] is the configuration class to store the configuration of a [`InstructBlipVideoForConditionalGeneration`]. It is used to instantiate a Instructblipvideo model according to the specified arguments, defining the vision model,...
4
2
28
4
21
3
3
0.98
1
3
2
0
1
8
2
2
120
21
50
29
32
49
26
14
23
5
1
1
6
3,177
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/configuration_instructblipvideo.py
transformers.models.instructblipvideo.configuration_instructblipvideo.InstructBlipVideoQFormerConfig
from ...configuration_utils import PretrainedConfig class InstructBlipVideoQFormerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`InstructBlipVideoQFormerModel`]. It is used to instantiate a InstructBlipVideo Querying Transformer (Q-Former) model according to...
class InstructBlipVideoQFormerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`InstructBlipVideoQFormerModel`]. It is used to instantiate a InstructBlipVideo Querying Transformer (Q-Former) model according to the specified arguments, defining the model arc...
2
1
35
1
34
0
1
1.51
1
1
0
0
1
14
1
1
102
9
37
36
17
56
19
18
17
1
1
0
1
3,178
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/configuration_instructblipvideo.py
transformers.models.instructblipvideo.configuration_instructblipvideo.InstructBlipVideoVisionConfig
from ...configuration_utils import PretrainedConfig class InstructBlipVideoVisionConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`InstructBlipVideoVisionModel`]. It is used to instantiate a InstructBlipVideo vision encoder according to the specified arguments,...
class InstructBlipVideoVisionConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`InstructBlipVideoVisionModel`]. It is used to instantiate a InstructBlipVideo vision encoder according to the specified arguments, defining the model architecture. Instantiating ...
2
1
28
1
27
0
1
1.4
1
1
0
0
1
11
1
1
82
10
30
29
14
42
16
15
14
1
1
0
1
3,179
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/image_processing_instructblipvideo.py
transformers.models.instructblipvideo.image_processing_instructblipvideo.InstructBlipVideoImageProcessor
import numpy as np from ...image_transforms import convert_to_rgb, resize, to_channel_dimension_format from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...video_utils import VideoInput, make_batched_videos from typing import Optional, Union from ...utils import TensorType, filt...
class InstructBlipVideoImageProcessor(BaseImageProcessor): ''' Constructs a InstructBLIPVideo 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 ...
6
3
59
5
36
18
6
0.74
1
8
2
0
4
9
4
24
279
25
146
69
91
108
55
19
50
11
3
1
24
3,180
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoAttention
from torch import nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from typing import Any, Callable, Optional, Union import torch class InstructBlipVideoAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super(...
class InstructBlipVideoAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config): pass def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): pass def forward(self, hidden_states: torch.Tensor, head_mask: Optional[to...
4
2
25
6
17
2
3
0.16
1
5
0
0
3
8
3
13
79
20
51
29
42
8
40
24
36
4
1
1
8
3,181
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoEncoder
import torch from ...processing_utils import Unpack from .configuration_instructblipvideo import InstructBlipVideoConfig, InstructBlipVideoQFormerConfig, InstructBlipVideoVisionConfig from typing import Any, Callable, Optional, Union from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple...
class InstructBlipVideoEncoder(nn.Module): ''' Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a [`InstructBlipVideoEncoderLayer`]. Args: config (`InstructBlipVideoConfig`): The corresponding vision configuration for the `InstructBli...
4
1
37
4
24
9
7
0.52
1
9
3
0
2
3
2
12
84
11
48
18
38
25
27
11
24
12
1
2
13
3,182
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoEncoderLayer
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn import torch from ...modeling_layers import GradientCheckpointingLayer from ...processing_utils import Unpack from .configuration_instructblipvideo import InstructBlipVideoConfig, InstructBlip...
class InstructBlipVideoEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: InstructBlipVideoConfig): pass @auto_docstring def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, **kwargs: Unpack[TransformersKwargs]) -> torch.FloatTensor: pass
4
0
22
3
15
5
2
0.33
1
6
3
0
2
5
2
12
46
6
30
16
22
10
21
11
18
2
1
1
3
3,183
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoForConditionalGeneration
from ..auto import AutoModel, AutoModelForCausalLM, AutoModelForSeq2SeqLM from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn import torch from ...processing_utils import Unpack from .configuration_instructblipvideo import InstructBlipVideoConf...
null
19
6
34
5
20
9
3
0.43
2
8
6
0
11
5
11
12
390
61
231
79
191
99
128
54
116
12
2
2
36
3,184
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoForConditionalGenerationModelOutput
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from dataclasses import dataclass from typing import Any, Callable, Optional, Union import torch @dataclass @auto_docstring(custom_intro='\n Class defining the outputs of [`InstructBlipVideoForConditionalGener...
@dataclass @auto_docstring(custom_intro='\n Class defining the outputs of [`InstructBlipVideoForConditionalGeneration`].\n ') class InstructBlipVideoForConditionalGenerationModelOutput(ModelOutput): ''' loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided, `torch.FloatTensor` of shape...
4
1
7
0
7
0
2
1.08
1
2
0
0
1
0
1
1
30
3
13
7
11
14
8
7
6
2
1
0
2
3,185
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoMLP
from torch import nn from ...activations import ACT2FN import torch class InstructBlipVideoMLP(nn.Module): def __init__(self, config): super().__init__() self.config = config self.activation_fn = ACT2FN[config.hidden_act] self.fc1 = nn.Linear(config.hidden_size, config.intermediate...
class InstructBlipVideoMLP(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
1
0
1
2
0
0
2
4
2
12
13
1
12
7
9
0
12
7
9
1
1
0
2
3,186
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoPreTrainedModel
from torch import nn from .configuration_instructblipvideo import InstructBlipVideoConfig, InstructBlipVideoQFormerConfig, InstructBlipVideoVisionConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging,...
@auto_docstring class InstructBlipVideoPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
19
2
16
1
7
0.19
1
2
2
3
1
0
1
1
37
5
27
8
25
5
20
8
18
7
1
2
7
3,187
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerAttention
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer import torch from ...processing_utils import Unpack from typing import Any, Callabl...
class InstructBlipVideoQFormerAttention(nn.Module): def __init__(self, config, is_cross_attention=False): pass def prune_heads(self, heads): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, ...
4
0
15
1
13
1
1
0.07
1
6
2
0
3
3
3
13
47
4
41
20
28
3
22
11
18
2
1
1
4
3,188
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerEmbeddings
from torch import nn import torch class InstructBlipVideoQFormerEmbeddings(nn.Module): """Construct the embeddings from word and position embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config....
class InstructBlipVideoQFormerEmbeddings(nn.Module): '''Construct the embeddings from word and position embeddings.''' def __init__(self, config): pass def forward(self, input_ids=None, position_ids=None, query_embeds=None, past_key_values_length=0): pass
3
1
23
4
19
1
4
0.05
1
1
0
0
2
6
2
12
49
9
38
18
29
2
28
12
25
6
1
2
7
3,189
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerEncoder
from ...processing_utils import Unpack from torch import nn from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging...
class InstructBlipVideoQFormerEncoder(nn.Module): def __init__(self, config): pass @can_return_tuple def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, query_length=0, **kwargs: Unpack[TransformersKwargs]): pass
4
0
46
4
42
0
9
0
1
5
2
0
2
3
2
12
93
8
85
28
69
0
35
15
32
16
1
3
17
3,190
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerIntermediate
from torch import nn from ...activations import ACT2FN import torch class InstructBlipVideoQFormerIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): ...
class InstructBlipVideoQFormerIntermediate(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
3,191
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerLayer
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer import torch from ...modeling_layers import GradientCheckpointingLayer from ...processing_utils import U...
class InstructBlipVideoQFormerLayer(GradientCheckpointingLayer): def __init__(self, config, layer_idx): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, query_length=0, **kwargs: Unpack[TransformersKwargs]): pa...
5
0
24
3
21
1
3
0.02
1
5
3
0
4
10
4
14
101
14
85
38
70
2
45
28
40
6
1
3
10
3,192
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerModel
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from ...utils.generic import OutputRecorder, check_model_inputs from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAnd...
class InstructBlipVideoQFormerModel(InstructBlipVideoPreTrainedModel): ''' Querying Transformer (Q-Former), used in InstructBlipVideo. Slightly modified from BLIP-2 as it also takes the instruction as input. ''' def __init__(self, config: InstructBlipVideoQFormerConfig): pass def get_...
9
4
31
3
18
9
4
0.53
1
10
4
0
6
3
6
7
194
25
111
45
84
59
55
25
48
13
2
2
21
3,193
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerMultiHeadAttention
import torch from ...processing_utils import Unpack from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn import math class InstructBlipVideoQFormerMultiHeadAttention(nn.Module): def __init__(self, config, is_cross_attention=False): ...
class InstructBlipVideoQFormerMultiHeadAttention(nn.Module): def __init__(self, config, is_cross_attention=False): pass def save_attn_gradients(self, attn_gradients): pass def get_attn_gradients(self): pass def save_attention_map(self, attention_map): pass def g...
8
0
18
3
14
1
3
0.1
1
3
0
0
7
14
7
17
131
26
96
52
79
10
80
43
72
10
1
2
19
3,194
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerOutput
from torch import nn import torch class InstructBlipVideoQFormerOutput(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.d...
class InstructBlipVideoQFormerOutput(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
3,195
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoQFormerSelfOutput
from torch import nn import torch class InstructBlipVideoQFormerSelfOutput(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.dro...
class InstructBlipVideoQFormerSelfOutput(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
3,196
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoVisionEmbeddings
from torch import nn from .configuration_instructblipvideo import InstructBlipVideoConfig, InstructBlipVideoQFormerConfig, InstructBlipVideoVisionConfig from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int import torch class InstructBlipVideoVisionEmbeddings(nn.Mod...
class InstructBlipVideoVisionEmbeddings(nn.Module): def __init__(self, config: InstructBlipVideoVisionConfig): pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor: ''' This method allows to interpolate the pre-trained position enc...
4
1
23
5
16
3
2
0.19
1
5
1
0
3
9
3
13
72
16
48
27
44
9
40
27
36
2
1
1
5
3,197
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modeling_instructblipvideo.py
transformers.models.instructblipvideo.modeling_instructblipvideo.InstructBlipVideoVisionModel
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int from torch import nn from ...utils.generic import OutputRecorder, check_model_inputs from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseMode...
class InstructBlipVideoVisionModel(InstructBlipVideoPreTrainedModel): def __init__(self, config: InstructBlipVideoVisionConfig): pass @check_model_inputs @auto_docstring def forward(self, pixel_values: Optional[torch.FloatTensor]=None, interpolate_pos_encoding: bool=False, **kwargs: Unpack[Tra...
6
0
19
3
15
1
3
0.06
1
7
4
0
3
4
3
4
65
13
49
23
36
3
28
15
24
6
2
1
8
3,198
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modular_instructblipvideo.py
transformers.models.instructblipvideo.modular_instructblipvideo.InstructBlipVideoConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...configuration_utils import PretrainedConfig from ..auto import CONFIG_MAPPING, AutoConfig class InstructBlipVideoConfig(PretrainedConfig): """ [`InstructBlipVideoConfig`] is the configuration class to store the configuration of ...
class InstructBlipVideoConfig(PretrainedConfig): ''' [`InstructBlipVideoConfig`] is the configuration class to store the configuration of a [`InstructBlipVideoForConditionalGeneration`]. It is used to instantiate a Instructblipvideo model according to the specified arguments, defining the vision model,...
4
2
28
4
21
3
3
0.98
1
3
2
0
1
8
2
34
120
21
50
29
32
49
26
14
23
5
2
1
6
3,199
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/instructblipvideo/modular_instructblipvideo.py
transformers.models.instructblipvideo.modular_instructblipvideo.InstructBlipVideoForConditionalGeneration
import torch from typing import Optional, Union from ...processing_utils import Unpack from transformers.models.instructblip.modeling_instructblip import InstructBlipForConditionalGeneration, InstructBlipForConditionalGenerationModelOutput, InstructBlipModel, InstructBlipPreTrainedModel, InstructBlipQFormerModel, Instr...
class InstructBlipVideoForConditionalGeneration(InstructBlipForConditionalGeneration): def get_video_features(self, pixel_values: torch.FloatTensor, qformer_input_ids: torch.LongTensor, qformer_attention_mask: Optional[torch.LongTensor]=None, interpolate_pos_encoding: Optional[bool]=False, return_dict: Optional[b...
7
4
151
19
90
43
11
0.48
1
2
1
0
2
0
2
14
305
38
181
60
154
86
89
36
86
12
3
2
21