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,600 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasPredictionHeadTransform | from ...activations import ACT2FN
import torch
from torch import nn
class TapasPredictionHeadTransform(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... |
class TapasPredictionHeadTransform(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,601 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasSelfAttention | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils.deprecation import deprecate_kwarg
import math
from torch import nn
class TapasSelfAttention(nn.Module):
def __init__(self, config, layer_idx=None):
super().__init__()
if config.hidden_size % config.num_... |
class TapasSelfAttention(nn.Module):
def __init__(self, config, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, past_key_values=None, output_attent... | 4 | 0 | 30 | 5 | 22 | 3 | 4 | 0.15 | 1 | 3 | 0 | 0 | 3 | 8 | 3 | 13 | 93 | 16 | 67 | 32 | 54 | 10 | 52 | 23 | 48 | 9 | 1 | 1 | 12 |
5,602 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasSelfOutput | import torch
from torch import nn
class TapasSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(c... |
class TapasSelfOutput(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,603 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.BasicTokenizer | import unicodedata
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
class BasicTokenizer:
"""
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaul... |
class BasicTokenizer:
'''
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
never_split (`Iterable`, *opti... | 8 | 7 | 19 | 1 | 14 | 5 | 4 | 0.55 | 0 | 2 | 0 | 0 | 7 | 5 | 7 | 7 | 159 | 14 | 98 | 39 | 83 | 54 | 78 | 32 | 70 | 8 | 0 | 4 | 27 |
5,604 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.Cell | from typing import Callable, Optional, Union
from dataclasses import dataclass
@dataclass
class Cell:
text: str
numeric_value: Optional[NumericValue] = None | @dataclass
class Cell:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 2 | 2 | 0 | 3 | 2 | 2 | 0 | 0 | 0 | 0 |
5,605 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.Date | from typing import Callable, Optional, Union
from dataclasses import dataclass
@dataclass
class Date:
year: Optional[int] = None
month: Optional[int] = None
day: Optional[int] = None | @dataclass
class Date:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
5,606 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.NumericValue | from typing import Callable, Optional, Union
from dataclasses import dataclass
@dataclass
class NumericValue:
float_value: Optional[float] = None
date: Optional[Date] = None | @dataclass
class NumericValue:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
5,607 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.NumericValueSpan | from typing import Callable, Optional, Union
from dataclasses import dataclass
@dataclass
class NumericValueSpan:
begin_index: Optional[int] = None
end_index: Optional[int] = None
values: list[NumericValue] = None | @dataclass
class NumericValueSpan:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
5,608 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.Question | from typing import Callable, Optional, Union
from dataclasses import dataclass
@dataclass
class Question:
original_text: str
text: str
numeric_spans: Optional[list[NumericValueSpan]] = None | @dataclass
class Question:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 2 | 3 | 2 | 4 | 2 | 3 | 0 | 0 | 0 | 0 |
5,609 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.Relation | import enum
class Relation(enum.Enum):
HEADER_TO_CELL = 1
CELL_TO_HEADER = 2
QUERY_TO_HEADER = 3
QUERY_TO_CELL = 4
ROW_TO_CELL = 5
CELL_TO_ROW = 6
EQ = 7
LT = 8
GT = 9 |
class Relation(enum.Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 10 | 0 | 10 | 10 | 9 | 9 | 10 | 10 | 9 | 0 | 4 | 0 | 0 |
5,610 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.SerializedExample | from dataclasses import dataclass
@dataclass(frozen=True)
class SerializedExample:
tokens: list[str]
column_ids: list[int]
row_ids: list[int]
segment_ids: list[int] | @dataclass(frozen=True)
class SerializedExample:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 1 | 4 | 0 | 5 | 1 | 4 | 0 | 0 | 0 | 0 |
5,611 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.TapasTokenizer | from ...utils import ExplicitEnum, PaddingStrategy, TensorType, add_end_docstrings, is_pandas_available, logging
from collections.abc import Generator
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import numpy as np
import collections
import os
from ...tokenization_... |
class TapasTokenizer(PreTrainedTokenizer):
'''
Construct a TAPAS tokenizer. Based on WordPiece. Flattens a table and one or more related sentences to be used by
TAPAS models.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this sup... | 64 | 38 | 30 | 3 | 22 | 6 | 4 | 0.32 | 1 | 24 | 8 | 0 | 55 | 12 | 55 | 144 | 1,835 | 212 | 1,235 | 530 | 893 | 394 | 611 | 243 | 554 | 25 | 3 | 6 | 246 |
5,612 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.TapasTruncationStrategy | from ...utils import ExplicitEnum, PaddingStrategy, TensorType, add_end_docstrings, is_pandas_available, logging
class TapasTruncationStrategy(ExplicitEnum):
"""
Possible values for the `truncation` argument in [`~TapasTokenizer.__call__`]. Useful for tab-completion in an IDE.
"""
DROP_ROWS_TO_FIT = 'd... |
class TapasTruncationStrategy(ExplicitEnum):
'''
Possible values for the `truncation` argument in [`~TapasTokenizer.__call__`]. Useful for tab-completion in an IDE.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 3 | 3 | 2 | 3 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
5,613 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.TokenCoordinates | from dataclasses import dataclass
@dataclass(frozen=True)
class TokenCoordinates:
column_index: int
row_index: int
token_index: int | @dataclass(frozen=True)
class TokenCoordinates:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 1 | 3 | 0 | 4 | 1 | 3 | 0 | 0 | 0 | 0 |
5,614 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.TokenizedTable | from dataclasses import dataclass
@dataclass
class TokenizedTable:
rows: list[list[list[str]]]
selected_tokens: list[TokenCoordinates] | @dataclass
class TokenizedTable:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
5,615 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/tokenization_tapas.py | transformers.models.tapas.tokenization_tapas.WordpieceTokenizer | class WordpieceTokenizer:
"""Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
self.vocab = vocab
self.unk_token = unk_token
self.max_input_chars_per_word = max_input_chars_per_word
def tokenize(self, text):
"""
Toke... | class WordpieceTokenizer:
'''Runs WordPiece tokenization.'''
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
pass
def tokenize(self, text):
'''
Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform
to... | 3 | 2 | 26 | 3 | 18 | 6 | 5 | 0.33 | 0 | 1 | 0 | 0 | 2 | 3 | 2 | 2 | 55 | 8 | 36 | 15 | 33 | 12 | 35 | 15 | 32 | 9 | 0 | 4 | 10 |
5,616 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/configuration_textnet.py | transformers.models.textnet.configuration_textnet.TextNetConfig | from transformers.utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from transformers import PretrainedConfig
class TextNetConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`TextNextModel`]. It is used t... |
class TextNetConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`TextNextModel`]. It is used to instantiate a
TextNext model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the def... | 2 | 1 | 48 | 5 | 43 | 0 | 3 | 1.11 | 2 | 2 | 0 | 0 | 1 | 15 | 1 | 38 | 108 | 13 | 45 | 33 | 27 | 50 | 22 | 17 | 20 | 3 | 2 | 1 | 3 |
5,617 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/image_processing_textnet.py | transformers.models.textnet.image_processing_textnet.TextNetImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from typing import Optional, Union
from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to... |
class TextNetImageProcessor(BaseImageProcessor):
'''
Constructs a TextNet 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... | 4 | 3 | 86 | 6 | 54 | 25 | 11 | 0.68 | 1 | 8 | 2 | 0 | 3 | 13 | 3 | 23 | 302 | 24 | 165 | 63 | 119 | 113 | 73 | 21 | 69 | 22 | 3 | 2 | 32 |
5,618 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetBackbone | from torch import Tensor
from transformers.modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from transformers.utils.backbone_utils import BackboneMixin
from typing import Any, Optional, Union
from ...utils import auto_... | @auto_docstring(custom_intro='\n TextNet backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class TextNetBackbone(TextNetPreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Tensor, output_hidden_states: Optional[bo... | 5 | 1 | 30 | 6 | 15 | 9 | 6 | 0.52 | 2 | 6 | 1 | 0 | 2 | 2 | 2 | 142 | 63 | 13 | 33 | 13 | 26 | 17 | 23 | 10 | 20 | 10 | 3 | 2 | 11 |
5,619 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetConvLayer | from transformers.activations import ACT2CLS
import torch
from transformers.models.textnet.configuration_textnet import TextNetConfig
import torch.nn as nn
class TextNetConvLayer(nn.Module):
def __init__(self, config: TextNetConfig):
super().__init__()
self.kernel_size = config.stem_kernel_size
... |
class TextNetConvLayer(nn.Module):
def __init__(self, config: TextNetConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 15 | 2 | 13 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 6 | 2 | 12 | 32 | 5 | 27 | 10 | 24 | 0 | 16 | 10 | 13 | 3 | 1 | 1 | 4 |
5,620 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetEncoder | from transformers.modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
import torch.nn as nn
from typing import Any, Optional, Union
from transformers.models.textnet.configuration_textnet import TextNetConfig
import torch
... |
class TextNetEncoder(nn.Module):
def __init__(self, config: TextNetConfig):
pass
def forward(self, hidden_state: torch.Tensor, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> BaseModelOutputWithNoAttention:
pass | 3 | 0 | 13 | 2 | 11 | 0 | 3 | 0 | 1 | 7 | 1 | 0 | 2 | 1 | 2 | 12 | 27 | 5 | 22 | 15 | 14 | 0 | 17 | 10 | 14 | 4 | 1 | 1 | 6 |
5,621 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetForImageClassification | from ...utils import auto_docstring
import torch
from transformers.modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from typing import Any, Optional, Union
import torch.nn as nn
@auto_docstring(custom_intro='\n Tex... | @auto_docstring(custom_intro='\n TextNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n ImageNet.\n ')
class TextNetForImageClassification(TextNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, ... | 5 | 1 | 41 | 6 | 24 | 12 | 8 | 0.48 | 1 | 5 | 1 | 0 | 2 | 6 | 2 | 130 | 86 | 12 | 50 | 23 | 39 | 24 | 37 | 16 | 34 | 13 | 3 | 3 | 15 |
5,622 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetModel | from transformers.modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...utils import auto_docstring
from typing import Any, Optional, Union
import torch.nn as nn
from torch import Tensor
@auto_docstring
class TextN... | @auto_docstring
class TextNetModel(TextNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Tensor, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> Union[tuple[Any, list[Any]], tuple[Any], BaseModelOutputWithPoolingAnd... | 5 | 0 | 16 | 3 | 14 | 0 | 4 | 0 | 1 | 7 | 2 | 0 | 2 | 3 | 2 | 130 | 42 | 6 | 36 | 14 | 23 | 0 | 18 | 11 | 15 | 6 | 3 | 1 | 7 |
5,623 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetPreTrainedModel | import torch.nn as nn
from transformers.models.textnet.configuration_textnet import TextNetConfig
from transformers import PreTrainedModel
from ...utils import auto_docstring
@auto_docstring
class TextNetPreTrainedModel(PreTrainedModel):
config: TextNetConfig
base_model_prefix = 'textnet'
main_input_name =... | @auto_docstring
class TextNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 9 | 0 | 9 | 0 | 5 | 0.31 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 128 | 19 | 2 | 13 | 5 | 11 | 4 | 12 | 5 | 10 | 5 | 2 | 2 | 5 |
5,624 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetRepConvLayer | import torch.nn as nn
from transformers.models.textnet.configuration_textnet import TextNetConfig
import torch
class TextNetRepConvLayer(nn.Module):
"""
This layer supports re-parameterization by combining multiple convolutional branches
(e.g., main convolution, vertical, horizontal, and identity branches)... |
class TextNetRepConvLayer(nn.Module):
'''
This layer supports re-parameterization by combining multiple convolutional branches
(e.g., main convolution, vertical, horizontal, and identity branches) during training.
At inference time, these branches can be collapsed into a single convolution for
effi... | 3 | 1 | 39 | 6 | 32 | 1 | 4 | 0.14 | 1 | 4 | 0 | 0 | 2 | 12 | 2 | 12 | 88 | 15 | 64 | 22 | 61 | 9 | 37 | 22 | 34 | 4 | 1 | 1 | 8 |
5,625 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/textnet/modeling_textnet.py | transformers.models.textnet.modeling_textnet.TextNetStage | import torch.nn as nn
from transformers.models.textnet.configuration_textnet import TextNetConfig
class TextNetStage(nn.Module):
def __init__(self, config: TextNetConfig, depth: int):
super().__init__()
kernel_size = config.conv_layer_kernel_sizes[depth]
stride = config.conv_layer_strides[... |
class TextNetStage(nn.Module):
def __init__(self, config: TextNetConfig, depth: int):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 10 | 2 | 9 | 0 | 2 | 0 | 1 | 5 | 1 | 0 | 2 | 1 | 2 | 12 | 22 | 4 | 18 | 14 | 15 | 0 | 18 | 14 | 15 | 2 | 1 | 1 | 4 |
5,626 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/configuration_time_series_transformer.py | transformers.models.time_series_transformer.configuration_time_series_transformer.TimeSeriesTransformerConfig | from ...configuration_utils import PretrainedConfig
from typing import Optional, Union
class TimeSeriesTransformerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`TimeSeriesTransformerModel`]. It is used to
instantiate a Time Series Transformer model according... |
class TimeSeriesTransformerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`TimeSeriesTransformerModel`]. It is used to
instantiate a Time Series Transformer model according to the specified arguments, defining the model architecture.
Instantiating a confi... | 4 | 1 | 47 | 3 | 44 | 2 | 3 | 0.97 | 1 | 6 | 0 | 0 | 2 | 30 | 2 | 2 | 201 | 15 | 95 | 69 | 58 | 92 | 45 | 35 | 42 | 5 | 1 | 2 | 6 |
5,627 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesFeatureEmbedder | from torch import nn
import torch
class TimeSeriesFeatureEmbedder(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 dimensio... |
class TimeSeriesFeatureEmbedder(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 |
5,628 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesMeanScaler | import torch
from torch import nn
from .configuration_time_series_transformer import TimeSeriesTransformerConfig
class TimeSeriesMeanScaler(nn.Module):
"""
Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data
accordingly.
"""
def __init__(... |
class TimeSeriesMeanScaler(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: TimeSeriesTransformerConfig):
pass
def forward(self, data: torch.Tensor, observed_indi... | 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 |
5,629 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesNOPScaler | from torch import nn
from typing import Callable, Optional, Union
from .configuration_time_series_transformer import TimeSeriesTransformerConfig
import torch
class TimeSeriesNOPScaler(nn.Module):
"""
Assigns a scaling factor equal to 1 along the first dimension, and therefore applies no scaling to the input da... |
class TimeSeriesNOPScaler(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: TimeSeriesTransformerConfig):
pass
def forward(self, data: torch.Tensor, observed_indicator: Optional... | 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 |
5,630 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesSinusoidalPositionalEmbedding | from torch import nn
from typing import Callable, Optional, Union
import numpy as np
import torch
class TimeSeriesSinusoidalPositionalEmbedding(nn.Embedding):
"""This module produces sinusoidal positional embeddings of any length."""
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Opti... |
class TimeSeriesSinusoidalPositionalEmbedding(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 t... | 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 |
5,631 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesStdScaler | from torch import nn
from .configuration_time_series_transformer import TimeSeriesTransformerConfig
import torch
class TimeSeriesStdScaler(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 ... |
class TimeSeriesStdScaler(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: TimeSeriesTransformerConfig):
pass
d... | 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 |
5,632 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerAttention | from .configuration_time_series_transformer import TimeSeriesTransformerConfig
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 i... |
class TimeSeriesTransformerAttention(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[TimeSeriesTransformerConfig]=None, layer_... | 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 |
5,633 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerDecoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, SampleTSPredictionOutput, Seq2SeqTSModelOutput, Seq2SeqTSPredictionOutput
from .configuration_time_series_transformer import TimeSeriesTransformerConfig
import torch
from torch import nn
from typing import Callable, Optional, Un... |
class TimeSeriesTransformerDecoder(TimeSeriesTransformerPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a
[`TimeSeriesTransformerDecoderLayer`]
Args:
config: TimeSeriesTransformerConfig
'''
def __init__(self, config: TimeSeriesTrans... | 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 |
5,634 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerDecoderLayer | 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 import nn
import torch
from .configuration_time_series_... |
class TimeSeriesTransformerDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: TimeSeriesTransformerConfig, 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_... | 4 | 1 | 58 | 6 | 40 | 13 | 4 | 0.31 | 1 | 4 | 1 | 0 | 2 | 11 | 2 | 12 | 118 | 12 | 81 | 32 | 67 | 25 | 44 | 21 | 41 | 6 | 1 | 1 | 7 |
5,635 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerEncoder | from typing import Callable, Optional, Union
from torch import nn
import torch
from .configuration_time_series_transformer import TimeSeriesTransformerConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, SampleTSPredictionOutput, Seq2SeqTSModelOutput, Seq2SeqTSPredictionOut... |
class TimeSeriesTransformerEncoder(TimeSeriesTransformerPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`TimeSeriesTransformerEncoderLayer`].
Args:
config: TimeSeriesTransformerConfig
'''
def __init__(self, config:... | 3 | 2 | 63 | 9 | 39 | 15 | 11 | 0.46 | 1 | 12 | 5 | 0 | 2 | 7 | 2 | 3 | 135 | 21 | 79 | 26 | 68 | 36 | 49 | 18 | 46 | 20 | 2 | 3 | 22 |
5,636 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerEncoderLayer | from .configuration_time_series_transformer import TimeSeriesTransformerConfig
from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optional, Union
from ...activations import ACT2FN
from torch import nn
import torch
class TimeSeriesTransformerEncoderLayer(GradientCheckpointingLayer):
... |
class TimeSeriesTransformerEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: TimeSeriesTransformerConfig, layer_idx: Optional[int]=None):
pass
def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, layer_head_mask: torch.FloatTensor, output_attention... | 3 | 1 | 33 | 3 | 25 | 6 | 2 | 0.22 | 1 | 3 | 1 | 0 | 2 | 9 | 2 | 12 | 68 | 7 | 50 | 22 | 41 | 11 | 32 | 16 | 29 | 3 | 1 | 1 | 4 |
5,637 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerForPrediction | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
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_time_series_t... | @auto_docstring
class TimeSeriesTransformerForPrediction(TimeSeriesTransformerPreTrainedModel):
def __init__(self, config: TimeSeriesTransformerConfig):
pass
def output_params(self, dec_output):
pass
def get_encoder(self):
pass
def get_decoder(self):
pass
@torch.j... | 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 |
5,638 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerModel | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
import torch
from .configuration_time_series_transformer import TimeSeriesTransformerConfig
from ...modeling_outputs import BaseMode... | @auto_docstring
class TimeSeriesTransformerModel(TimeSeriesTransformerPreTrainedModel):
def __init__(self, config: TimeSeriesTransformerConfig):
pass
@property
def _past_length(self) -> int:
pass
def get_lagged_subsequences(self, sequence: torch.Tensor, subsequences_length: int, shift:... | 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 |
5,639 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesTransformerPreTrainedModel | from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from torch import nn
import torch
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_... | @auto_docstring
class TimeSeriesTransformerPreTrainedModel(PreTrainedModel):
def _init_weights(self, 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, No... | 6 | 0 | 12 | 0 | 12 | 0 | 6 | 0 | 1 | 1 | 1 | 4 | 1 | 0 | 1 | 1 | 18 | 1 | 17 | 7 | 15 | 0 | 15 | 7 | 13 | 6 | 1 | 2 | 6 |
5,640 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/time_series_transformer/modeling_time_series_transformer.py | transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesValueEmbedding | from torch import nn
class TimeSeriesValueEmbedding(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 TimeSeriesValueEmbedding(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 |
5,641 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/configuration_timesformer.py | transformers.models.timesformer.configuration_timesformer.TimesformerConfig | from ...configuration_utils import PretrainedConfig
class TimesformerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`TimesformerModel`]. It is used to instantiate a
TimeSformer model according to the specified arguments, defining the model architecture. Insta... |
class TimesformerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`TimesformerModel`]. It is used to instantiate a
TimeSformer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will ... | 2 | 1 | 40 | 3 | 37 | 0 | 1 | 1.33 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 103 | 12 | 39 | 38 | 18 | 52 | 20 | 19 | 18 | 1 | 1 | 0 | 1 |
5,642 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimeSformerAttention | from typing import Optional, Union
from torch import nn
from .configuration_timesformer import TimesformerConfig
import torch.nn.functional
import torch
class TimeSformerAttention(nn.Module):
def __init__(self, config: TimesformerConfig) -> None:
super().__init__()
self.attention = TimesformerSelf... |
class TimeSformerAttention(nn.Module):
def __init__(self, config: TimesformerConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: bool=False) -> Union[tuple[torch.Tensor, torch.Tensor], tuple[torch.Tensor]]:
pass | 3 | 0 | 8 | 1 | 7 | 1 | 1 | 0.07 | 1 | 6 | 3 | 0 | 2 | 2 | 2 | 12 | 17 | 3 | 14 | 12 | 7 | 1 | 10 | 8 | 7 | 1 | 1 | 0 | 2 |
5,643 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimeSformerDropPath | from typing import Optional, Union
import torch
from torch import nn
import torch.nn.functional
class TimeSformerDropPath(nn.Module):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
def __init__(self, drop_prob: Optional[float]=None) -> None:
super().__in... |
class TimeSformerDropPath(nn.Module):
'''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).'''
def __init__(self, drop_prob: Optional[float]=None) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass
def extra_repr(s... | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.13 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 13 | 12 | 3 | 8 | 5 | 4 | 1 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
5,644 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerEmbeddings | from torch import nn
import torch.nn.functional
import torch
class TimesformerEmbeddings(nn.Module):
"""
Construct the patch and position embeddings.
"""
def __init__(self, config):
super().__init__()
embed_dim = config.hidden_size
num_frames = config.num_frames
drop_ra... |
class TimesformerEmbeddings(nn.Module):
'''
Construct the patch and position embeddings.
'''
def __init__(self, config):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 36 | 4 | 30 | 3 | 3 | 0.13 | 1 | 3 | 1 | 0 | 2 | 8 | 2 | 12 | 78 | 10 | 60 | 27 | 57 | 8 | 50 | 27 | 47 | 4 | 1 | 2 | 6 |
5,645 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerEncoder | import torch.nn.functional
from .configuration_timesformer import TimesformerConfig
from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from torch import nn
class TimesformerEncoder(nn.Module):
def __init__(self, config: TimesformerConfig) -> None... |
class TimesformerEncoder(nn.Module):
def __init__(self, config: TimesformerConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=True) -> Union[tuple, BaseModelOutput]:
pass | 3 | 0 | 22 | 3 | 19 | 0 | 5 | 0 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 45 | 7 | 38 | 16 | 29 | 0 | 23 | 10 | 20 | 9 | 1 | 2 | 10 |
5,646 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerForVideoClassification | from typing import Optional, Union
from ...utils import auto_docstring, logging
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
import torch.nn.functional
import torch
@auto_docstring(custom_intro='\n T... | @auto_docstring(custom_intro='\n TimeSformer Model transformer with a video classification head on top (a linear layer on top of the final hidden state\n of the [CLS] token) e.g. for ImageNet.\n ')
class TimesformerForVideoClassification(TimesformerPreTrainedModel):
def __init__(self, config):
... | 5 | 1 | 75 | 13 | 27 | 35 | 7 | 1.25 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 3 | 153 | 27 | 56 | 20 | 44 | 70 | 32 | 12 | 29 | 12 | 2 | 3 | 14 |
5,647 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerIntermediate | import torch
import torch.nn.functional
from .configuration_timesformer import TimesformerConfig
from ...activations import ACT2FN
from torch import nn
class TimesformerIntermediate(nn.Module):
def __init__(self, config: TimesformerConfig) -> None:
super().__init__()
self.dense = nn.Linear(config.... |
class TimesformerIntermediate(nn.Module):
def __init__(self, config: TimesformerConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 1 | 7 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 17 | 3 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
5,648 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
import torch.nn.functional
import torch
from .configuration_timesformer import TimesformerConfig
class TimesformerLayer(GradientCheckpointingLayer):
def __init__(self, config: TimesformerConfig, layer_index: int) -> None:
super... |
class TimesformerLayer(GradientCheckpointingLayer):
def __init__(self, config: TimesformerConfig, layer_index: int) -> None:
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: bool=False):
pass | 3 | 0 | 60 | 11 | 47 | 5 | 4 | 0.1 | 1 | 10 | 5 | 0 | 2 | 11 | 2 | 12 | 121 | 22 | 94 | 35 | 91 | 9 | 69 | 35 | 66 | 4 | 1 | 1 | 7 |
5,649 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerModel | from torch import nn
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
import torch.nn.functional
import torch
from typing import Optional, Union
@auto_docstring
class TimesformerModel(TimesformerPreTrainedModel):
def __init__(self, config):
... | @auto_docstring
class TimesformerModel(TimesformerPreTrainedModel):
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 th... | 7 | 2 | 32 | 5 | 10 | 17 | 3 | 1.52 | 1 | 5 | 3 | 0 | 4 | 4 | 4 | 5 | 135 | 24 | 44 | 20 | 31 | 67 | 25 | 13 | 20 | 6 | 2 | 1 | 10 |
5,650 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerOutput | from .configuration_timesformer import TimesformerConfig
import torch
from torch import nn
import torch.nn.functional
class TimesformerOutput(nn.Module):
def __init__(self, config: TimesformerConfig) -> None:
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
... |
class TimesformerOutput(nn.Module):
def __init__(self, config: TimesformerConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 11 | 2 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
5,651 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerPatchEmbeddings | from torch import nn
import collections
class TimesformerPatchEmbeddings(nn.Module):
"""Image to Patch Embedding"""
def __init__(self, config):
super().__init__()
image_size = config.image_size
patch_size = config.patch_size
image_size = image_size if isinstance(image_size, col... |
class TimesformerPatchEmbeddings(nn.Module):
'''Image to Patch Embedding'''
def __init__(self, config):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 12 | 3 | 9 | 0 | 2 | 0.05 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 27 | 7 | 19 | 13 | 16 | 1 | 19 | 13 | 16 | 3 | 1 | 0 | 4 |
5,652 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerPreTrainedModel | from torch import nn
from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, logging
from .configuration_timesformer import TimesformerConfig
@auto_docstring
class TimesformerPreTrainedModel(PreTrainedModel):
config: TimesformerConfig
base_model_prefix = 'timesformer'
main_input_... | @auto_docstring
class TimesformerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 12 | 0 | 12 | 0 | 5 | 0.22 | 1 | 1 | 1 | 2 | 1 | 0 | 1 | 1 | 24 | 2 | 18 | 7 | 16 | 4 | 16 | 7 | 14 | 5 | 1 | 2 | 5 |
5,653 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerSelfAttention | from torch import nn
from .configuration_timesformer import TimesformerConfig
class TimesformerSelfAttention(nn.Module):
def __init__(self, config: TimesformerConfig):
super().__init__()
num_heads = config.num_attention_heads
qkv_bias = config.qkv_bias
attention_dropout_prob = conf... |
class TimesformerSelfAttention(nn.Module):
def __init__(self, config: TimesformerConfig):
pass
def forward(self, hidden_states, output_attentions: bool=False):
pass | 3 | 0 | 15 | 3 | 12 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 32 | 7 | 25 | 17 | 22 | 0 | 21 | 17 | 18 | 2 | 1 | 0 | 3 |
5,654 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timesformer/modeling_timesformer.py | transformers.models.timesformer.modeling_timesformer.TimesformerSelfOutput | import torch
from torch import nn
from .configuration_timesformer import TimesformerConfig
import torch.nn.functional
class TimesformerSelfOutput(nn.Module):
"""
The residual connection is defined in TimesformerLayer instead of here (as is the case with other models), due to
the layernorm applied before ea... |
class TimesformerSelfOutput(nn.Module):
'''
The residual connection is defined in TimesformerLayer instead of here (as is the case with other models), due to
the layernorm applied before each block.
'''
def __init__(self, config: TimesformerConfig) -> None:
pass
def forward(self, hidd... | 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,655 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timm_backbone/configuration_timm_backbone.py | transformers.models.timm_backbone.configuration_timm_backbone.TimmBackboneConfig | from ...configuration_utils import PretrainedConfig
class TimmBackboneConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration for a timm backbone [`TimmBackbone`].
It is used to instantiate a timm backbone model according to the specified arguments, defining the model.
... |
class TimmBackboneConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration for a timm backbone [`TimmBackbone`].
It is used to instantiate a timm backbone model according to the specified arguments, defining the model.
Configuration objects inherit from [`PretrainedConfi... | 2 | 1 | 18 | 0 | 18 | 0 | 2 | 1.5 | 1 | 1 | 0 | 0 | 1 | 7 | 1 | 1 | 59 | 9 | 20 | 19 | 9 | 30 | 11 | 10 | 9 | 2 | 1 | 0 | 2 |
5,656 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timm_backbone/modeling_timm_backbone.py | transformers.models.timm_backbone.modeling_timm_backbone.TimmBackbone | import torch
from ...utils import is_timm_available, is_torch_available, requires_backends
from ...modeling_utils import PreTrainedModel
from ...modeling_outputs import BackboneOutput
from typing import Optional, Union
from ...utils.backbone_utils import BackboneMixin
from .configuration_timm_backbone import TimmBackbo... |
class TimmBackbone(PreTrainedModel, BackboneMixin):
'''
Wrapper class for timm models to be used as backbones. This enables using the timm models interchangeably with the
other models in the library keeping the same API.
'''
def __init__(self, config, **kwargs):
pass
@classmethod
d... | 8 | 2 | 18 | 3 | 14 | 2 | 3 | 0.15 | 2 | 9 | 2 | 0 | 5 | 4 | 6 | 18 | 124 | 22 | 89 | 35 | 73 | 13 | 63 | 27 | 55 | 9 | 1 | 2 | 20 |
5,657 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timm_wrapper/configuration_timm_wrapper.py | transformers.models.timm_wrapper.configuration_timm_wrapper.TimmWrapperConfig | from ...utils import is_timm_available, logging, requires_backends
from ...configuration_utils import PretrainedConfig
from typing import Any, Optional
class TimmWrapperConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration for a timm backbone [`TimmWrapper`].
It is used ... |
class TimmWrapperConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration for a timm backbone [`TimmWrapper`].
It is used to instantiate a timm model according to the specified arguments, defining the model.
Configuration objects inherit from [`PretrainedConfig`] and can... | 5 | 1 | 16 | 2 | 11 | 3 | 3 | 0.78 | 1 | 9 | 0 | 0 | 2 | 2 | 3 | 3 | 84 | 18 | 37 | 17 | 32 | 29 | 35 | 16 | 31 | 6 | 1 | 2 | 8 |
5,658 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timm_wrapper/image_processing_timm_wrapper.py | transformers.models.timm_wrapper.image_processing_timm_wrapper.TimmWrapperImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature
from ...utils.import_utils import is_timm_available, is_torch_available, requires
import os
from typing import Any, Optional, Union
from ...image_utils import ImageInput, make_flat_list_of_images
from ...utils import TensorType, logging, requires_ba... | @requires(backends=('torch', 'timm', 'torchvision'))
class TimmWrapperImageProcessor(BaseImageProcessor):
'''
Wrapper class for timm models to be used within transformers.
Args:
pretrained_cfg (`dict[str, Any]`):
The configuration of the pretrained model used to resolve evaluation and
... | 8 | 4 | 16 | 1 | 10 | 4 | 2 | 0.58 | 1 | 8 | 2 | 0 | 4 | 4 | 5 | 25 | 98 | 14 | 53 | 25 | 35 | 31 | 32 | 13 | 26 | 5 | 3 | 1 | 9 |
5,659 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timm_wrapper/modeling_timm_wrapper.py | transformers.models.timm_wrapper.modeling_timm_wrapper.TimmWrapperForImageClassification | from typing import Optional, Union
import torch
from .configuration_timm_wrapper import TimmWrapperConfig
from ...utils import auto_docstring, is_timm_available, requires_backends
from ...modeling_outputs import ImageClassifierOutput, ModelOutput
from torch import Tensor, nn
class TimmWrapperForImageClassification(Tim... |
class TimmWrapperForImageClassification(TimmWrapperPreTrainedModel):
'''
Wrapper class for timm models to be used in transformers for image classification.
'''
def __init__(self, config: TimmWrapperConfig):
pass
@auto_docstring
def forward(self, pixel_values: torch.FloatTensor, lab... | 4 | 2 | 60 | 8 | 37 | 15 | 10 | 0.43 | 1 | 9 | 2 | 0 | 2 | 2 | 2 | 7 | 127 | 18 | 76 | 19 | 63 | 33 | 45 | 10 | 42 | 17 | 2 | 3 | 19 |
5,660 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timm_wrapper/modeling_timm_wrapper.py | transformers.models.timm_wrapper.modeling_timm_wrapper.TimmWrapperModel | from typing import Optional, Union
import torch
from torch import Tensor, nn
from .configuration_timm_wrapper import TimmWrapperConfig
from ...utils import auto_docstring, is_timm_available, requires_backends
class TimmWrapperModel(TimmWrapperPreTrainedModel):
"""
Wrapper class for timm models to be used in tr... |
class TimmWrapperModel(TimmWrapperPreTrainedModel):
'''
Wrapper class for timm models to be used in transformers.
'''
def __init__(self, config: TimmWrapperConfig):
pass
@auto_docstring
def forward(self, pixel_values: torch.FloatTensor, output_attentions: Optional[bool]=None, outpu... | 4 | 2 | 49 | 8 | 25 | 17 | 6 | 0.69 | 1 | 9 | 2 | 0 | 2 | 1 | 2 | 7 | 105 | 17 | 52 | 16 | 39 | 36 | 29 | 7 | 26 | 11 | 2 | 2 | 12 |
5,661 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/timm_wrapper/modeling_timm_wrapper.py | transformers.models.timm_wrapper.modeling_timm_wrapper.TimmWrapperPreTrainedModel | from torch import Tensor, nn
from ...utils import auto_docstring, is_timm_available, requires_backends
from ...modeling_utils import PreTrainedModel
from .configuration_timm_wrapper import TimmWrapperConfig
@auto_docstring
class TimmWrapperPreTrainedModel(PreTrainedModel):
main_input_name = 'pixel_values'
conf... | @auto_docstring
class TimmWrapperPreTrainedModel(PreTrainedModel):
def __init__(self, *args, **kwargs):
pass
def post_init(self):
pass
@staticmethod
def _fix_state_dict_key_on_load(key) -> tuple[str, bool]:
'''
Overrides original method that renames `gamma` and `beta` t... | 11 | 5 | 7 | 0 | 3 | 4 | 2 | 0.79 | 1 | 3 | 0 | 2 | 4 | 0 | 5 | 5 | 49 | 6 | 24 | 12 | 17 | 19 | 23 | 11 | 17 | 3 | 1 | 2 | 8 |
5,662 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/configuration_trocr.py | transformers.models.trocr.configuration_trocr.TrOCRConfig | from ...configuration_utils import PretrainedConfig
class TrOCRConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`TrOCRForCausalLM`]. It is used to instantiate an
TrOCR model according to the specified arguments, defining the model architecture. Instantiating a ... |
class TrOCRConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`TrOCRForCausalLM`]. It is used to instantiate an
TrOCR model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a sim... | 2 | 1 | 48 | 1 | 47 | 0 | 1 | 0.98 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 120 | 11 | 55 | 44 | 30 | 54 | 22 | 21 | 20 | 1 | 1 | 0 | 1 |
5,663 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRAttention | from typing import Optional, Union
import torch
from torch import nn
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
class TrOCRAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper."""
def __init__(self, con... |
class TrOCRAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper.'''
def __init__(self, config, embed_dim: int, num_heads: int, kdim: Optional[int]=None, vdim: Optional[int]=None, dropout: Optional[float]=0.0, is_decoder: Optional[bool]=False, bias: Optional[bool]=True, is_cro... | 4 | 2 | 47 | 6 | 35 | 7 | 6 | 0.2 | 1 | 6 | 0 | 0 | 3 | 12 | 3 | 13 | 147 | 21 | 105 | 46 | 82 | 21 | 68 | 27 | 64 | 12 | 1 | 2 | 17 |
5,664 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRDecoder | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask
from torch import nn
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import math
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions
import t... |
class TrOCRDecoder(TrOCRPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`TrOCRDecoderLayer`]
Args:
config: TrOCRConfig
'''
def __init__(self, config: TrOCRConfig):
pass
def forward(self, input_ids=None, attention_mask=No... | 3 | 2 | 63 | 9 | 38 | 16 | 11 | 0.44 | 1 | 12 | 6 | 0 | 4 | 8 | 4 | 5 | 263 | 42 | 154 | 42 | 135 | 67 | 83 | 28 | 78 | 39 | 2 | 3 | 45 |
5,665 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRDecoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...activations import ACT2FN
from ...utils.deprecation import deprecate_kwarg
from .configuration_trocr import TrOCRConfig
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from torch import ... |
class TrOCRDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: TrOCRConfig, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, encoder_hidd... | 4 | 1 | 63 | 9 | 42 | 13 | 4 | 0.3 | 1 | 5 | 2 | 0 | 2 | 11 | 2 | 12 | 127 | 18 | 84 | 32 | 70 | 25 | 45 | 21 | 42 | 6 | 1 | 1 | 8 |
5,666 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRDecoderWrapper | from ...utils import auto_docstring, logging
@auto_docstring(custom_intro='\n The TrOCR Model with a language modeling head. Can be used for summarization.\n This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is\n used in combination with the [`Encoder... | @auto_docstring(custom_intro='\n The TrOCR Model with a language modeling head. Can be used for summarization.\n This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is\n used in combination with the [`EncoderDecoderModel`] framework.\n ')
class TrOCRD... | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0.67 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 3 | 12 | 2 | 6 | 4 | 3 | 4 | 6 | 4 | 3 | 1 | 2 | 0 | 2 |
5,667 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRForCausalLM | from ...generation import GenerationMixin
import torch
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from tor... | @auto_docstring(custom_intro='\n The TrOCR Decoder with a language modeling head. Can be used as the decoder part of [`EncoderDecoderModel`] and\n ')
class TrOCRForCausalLM(TrOCRPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
... | 11 | 1 | 23 | 3 | 9 | 11 | 2 | 1.18 | 2 | 6 | 2 | 0 | 8 | 2 | 9 | 10 | 216 | 37 | 82 | 37 | 55 | 97 | 41 | 20 | 31 | 7 | 2 | 1 | 16 |
5,668 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRLearnedPositionalEmbedding | import torch
from typing import Optional, Union
from torch import nn
class TrOCRLearnedPositionalEmbedding(nn.Embedding):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, num_embeddings: int, embedding_dim: int):
self.offset = 2
super().__... |
class TrOCRLearnedPositionalEmbedding(nn.Embedding):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, num_embeddings: int, embedding_dim: int):
pass
def forward(self, input_ids: torch.Tensor, past_key_values_length: int=0, position_ids: Optio... | 3 | 2 | 7 | 1 | 5 | 2 | 1 | 0.6 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 2 | 20 | 4 | 10 | 6 | 7 | 6 | 8 | 6 | 5 | 1 | 1 | 0 | 2 |
5,669 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRPreTrainedModel | from ...modeling_utils import PreTrainedModel
from .configuration_trocr import TrOCRConfig
from torch import nn
from ...utils import auto_docstring, logging
@auto_docstring
class TrOCRPreTrainedModel(PreTrainedModel):
config: TrOCRConfig
base_model_prefix = 'model'
supports_gradient_checkpointing = True
... | @auto_docstring
class TrOCRPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 16 | 1 | 15 | 7 | 13 | 0 | 14 | 7 | 12 | 5 | 1 | 2 | 5 |
5,670 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRScaledWordEmbedding | import torch
from torch import nn
from typing import Optional, Union
class TrOCRScaledWordEmbedding(nn.Embedding):
"""
This module overrides nn.Embeddings' forward by multiplying with embeddings scale.
"""
def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optio... |
class TrOCRScaledWordEmbedding(nn.Embedding):
'''
This module overrides nn.Embeddings' forward by multiplying with embeddings scale.
'''
def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0):
pass
def forward(self, input_ids: torch... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.5 | 1 | 4 | 0 | 0 | 2 | 1 | 2 | 2 | 11 | 2 | 6 | 4 | 3 | 3 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
5,671 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/modeling_trocr.py | transformers.models.trocr.modeling_trocr.TrOCRSinusoidalPositionalEmbedding | import torch
from torch import nn
from typing import Optional, Union
import math
class TrOCRSinusoidalPositionalEmbedding(nn.Module):
"""This module produces sinusoidal positional embeddings of any length."""
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None):
... |
class TrOCRSinusoidalPositionalEmbedding(nn.Module):
'''This module produces sinusoidal positional embeddings of any length.'''
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None):
pass
@staticmethod
def get_embedding(num_embeddings: int, embedding_dim: ... | 7 | 3 | 13 | 1 | 9 | 3 | 2 | 0.37 | 1 | 3 | 0 | 0 | 3 | 4 | 4 | 14 | 60 | 8 | 38 | 21 | 29 | 14 | 32 | 17 | 27 | 3 | 1 | 1 | 7 |
5,672 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/processing_trocr.py | transformers.models.trocr.processing_trocr.TrOCRProcessor | from contextlib import contextmanager
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
import warnings
from ...image_processing_utils import BatchFeature
from typing import Optional, Union
from ...image_utils import ImageInput
from ...tokenization_utils_base import PreTokenizedInput, TextInput
... |
class TrOCRProcessor(ProcessorMixin):
'''
Constructs a TrOCR processor which wraps a vision image processor and a TrOCR tokenizer into a single processor.
[`TrOCRProcessor`] offers all the functionalities of [`ViTImageProcessor`/`DeiTImageProcessor`] and
[`RobertaTokenizer`/`XLMRobertaTokenizer`]. See ... | 11 | 3 | 14 | 1 | 10 | 3 | 2 | 0.37 | 1 | 5 | 2 | 0 | 7 | 2 | 7 | 24 | 124 | 16 | 79 | 27 | 61 | 29 | 49 | 17 | 41 | 7 | 2 | 1 | 17 |
5,673 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/trocr/processing_trocr.py | transformers.models.trocr.processing_trocr.TrOCRProcessorKwargs | from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class TrOCRProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {} |
class TrOCRProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
5,674 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/configuration_tvp.py | transformers.models.tvp.configuration_tvp.TvpConfig | from ..auto import CONFIG_MAPPING
from ...configuration_utils import PretrainedConfig
from ...utils.backbone_utils import verify_backbone_config_arguments
import copy
class TvpConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`TvpModel`]. It is used to instantiate a... |
class TvpConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`TvpModel`]. It is used to instantiate an Tvp
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configu... | 7 | 3 | 31 | 1 | 26 | 4 | 2 | 1 | 1 | 2 | 0 | 0 | 2 | 25 | 3 | 3 | 171 | 11 | 80 | 62 | 47 | 80 | 44 | 33 | 40 | 3 | 1 | 1 | 6 |
5,675 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/image_processing_tvp.py | transformers.models.tvp.image_processing_tvp.TvpImageProcessor | from ...image_transforms import PaddingMode, flip_channel_order, pad, resize, to_channel_dimension_format
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, is_valid_image, to_numpy_array, valid_images, validate_preprocess_argument... |
class TvpImageProcessor(BaseImageProcessor):
'''
Constructs a Tvp image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
`do_resize` parameter in th... | 7 | 5 | 68 | 5 | 45 | 18 | 7 | 0.61 | 1 | 9 | 3 | 0 | 5 | 15 | 5 | 25 | 395 | 30 | 227 | 108 | 143 | 139 | 80 | 30 | 74 | 17 | 3 | 1 | 35 |
5,676 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpAttention | from ...pytorch_utils import prune_linear_layer
import math
from torch import nn
import torch
from typing import Optional
class TvpAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')... |
class TvpAttention(nn.Module):
def __init__(self, config):
pass
def prune_heads(self, heads):
pass
def _reshape(self, tensor: torch.Tensor, sequence_length: int, batch_size: int):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions: O... | 5 | 0 | 23 | 3 | 18 | 3 | 3 | 0.14 | 1 | 6 | 0 | 0 | 4 | 11 | 4 | 14 | 96 | 16 | 71 | 36 | 60 | 10 | 59 | 30 | 54 | 4 | 1 | 1 | 11 |
5,677 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpEncodeLayer | from typing import Optional
from ...modeling_layers import GradientCheckpointingLayer
class TvpEncodeLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = TvpAttention(config)
self.intermediate = TvpIntermediate(config)
self.output = Tvp... |
class TvpEncodeLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions: Optional[bool]=None):
pass | 3 | 0 | 12 | 0 | 12 | 1 | 1 | 0.04 | 1 | 5 | 3 | 0 | 2 | 3 | 2 | 12 | 26 | 1 | 25 | 17 | 16 | 1 | 14 | 11 | 11 | 1 | 1 | 0 | 2 |
5,678 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpEncoder | import torch
from typing import Optional
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ModelOutput
from torch import nn
class TvpEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.layer = nn.ModuleList([TvpEncodeLayer... |
class TvpEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None):
pass | 3 | 0 | 29 | 3 | 26 | 1 | 8 | 0.04 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 60 | 7 | 52 | 19 | 41 | 2 | 31 | 11 | 28 | 15 | 1 | 2 | 16 |
5,679 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpForVideoGrounding | import torch
from typing import Optional
from ...utils import auto_docstring, logging
@auto_docstring(custom_intro='\n Tvp Model with a video grounding head on top computing IoU, distance, and duration loss.\n ')
class TvpForVideoGrounding(TvpPreTrainedModel):
def __init__(self, config):
super().__i... | @auto_docstring(custom_intro='\n Tvp Model with a video grounding head on top computing IoU, distance, and duration loss.\n ')
class TvpForVideoGrounding(TvpPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, pixel_v... | 5 | 1 | 37 | 4 | 26 | 7 | 3 | 0.25 | 1 | 7 | 4 | 0 | 2 | 3 | 2 | 3 | 77 | 8 | 55 | 24 | 39 | 14 | 24 | 12 | 21 | 5 | 2 | 2 | 6 |
5,680 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpFrameDownPadPrompter | import torch
from torch import nn
class TvpFrameDownPadPrompter(nn.Module):
"""
Pad frames extracted from videos only at the bottom.
"""
def __init__(self, config):
if config.visual_prompter_apply not in ('add', 'replace', 'remove'):
raise ValueError('`visual_prompter_apply` must b... |
class TvpFrameDownPadPrompter(nn.Module):
'''
Pad frames extracted from videos only at the bottom.
'''
def __init__(self, config):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 15 | 1 | 14 | 0 | 3 | 0.11 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 35 | 4 | 28 | 11 | 25 | 3 | 21 | 11 | 18 | 3 | 1 | 1 | 5 |
5,681 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpFramePadPrompter | from torch import nn
import torch
class TvpFramePadPrompter(nn.Module):
"""
Pad frames extracted from videos in the surroundings.
"""
def __init__(self, config):
if config.visual_prompter_apply not in ('add', 'replace', 'remove'):
raise ValueError('`visual_prompter_apply` must be i... |
class TvpFramePadPrompter(nn.Module):
'''
Pad frames extracted from videos in the surroundings.
'''
def __init__(self, config):
pass
def interpolate_pad_encoding(self, prompt: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate the... | 4 | 2 | 27 | 2 | 23 | 2 | 3 | 0.14 | 1 | 5 | 0 | 0 | 3 | 8 | 3 | 13 | 88 | 9 | 69 | 18 | 65 | 10 | 36 | 18 | 32 | 6 | 1 | 2 | 9 |
5,682 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpIntermediate | from torch import nn
from ...activations import ACT2FN
import torch
class TvpIntermediate(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.intermediate_act... |
class TvpIntermediate(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,683 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpLoss | import torch
from torch import nn
class TvpLoss(nn.Module):
"""
This class computes the losses for `TvpForVideoGrounding`. The process happens in two steps: 1) we compute
hungarian assignment between ground truth boxes and the outputs of the model 2) we supervise each pair of matched
ground-truth / pre... |
class TvpLoss(nn.Module):
'''
This class computes the losses for `TvpForVideoGrounding`. The process happens in two steps: 1) we compute
hungarian assignment between ground truth boxes and the outputs of the model 2) we supervise each pair of matched
ground-truth / prediction (supervise class and box).... | 6 | 5 | 13 | 1 | 8 | 3 | 2 | 0.63 | 1 | 2 | 0 | 0 | 5 | 2 | 5 | 15 | 78 | 13 | 40 | 23 | 34 | 25 | 32 | 23 | 26 | 3 | 1 | 2 | 8 |
5,684 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpModel | from ...utils import auto_docstring, logging
from typing import Optional
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ModelOutput
@auto_docstring(custom_intro='\n The bare Tvp Model transformer outputting BaseModelOutputWithPooling object without any... | @auto_docstring(custom_intro='\n The bare Tvp Model transformer outputting BaseModelOutputWithPooling object without any specific head on top.\n ')
class TvpModel(TvpPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self... | 8 | 2 | 20 | 1 | 14 | 4 | 2 | 0.31 | 1 | 9 | 6 | 0 | 5 | 9 | 5 | 6 | 105 | 11 | 72 | 36 | 54 | 22 | 42 | 25 | 36 | 5 | 2 | 1 | 11 |
5,685 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpOutputLayer | import torch
from torch import nn
class TvpOutputLayer(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dro... |
class TvpOutputLayer(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,686 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpPooler | from torch import nn
import torch
class TvpPooler(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_token_t... |
class TvpPooler(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,687 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpPreTrainedModel | from ...utils import auto_docstring, logging
from torch import nn
from .configuration_tvp import TvpConfig
from ...modeling_utils import PreTrainedModel
@auto_docstring
class TvpPreTrainedModel(PreTrainedModel):
config: TvpConfig
base_model_prefix = 'model'
supports_gradient_checkpointing = True
def _... | @auto_docstring
class TvpPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 17 | 2 | 12 | 3 | 6 | 0.38 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 26 | 4 | 16 | 5 | 14 | 6 | 15 | 5 | 13 | 6 | 1 | 2 | 6 |
5,688 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpTextInputEmbeddings | from torch import nn
import torch
class TvpTextInputEmbeddings(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.... |
class TvpTextInputEmbeddings(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 | 15 | 2 | 14 | 0 | 4 | 0.04 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 34 | 5 | 28 | 14 | 25 | 1 | 27 | 14 | 24 | 6 | 1 | 1 | 7 |
5,689 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpVideoGroundingHead | from torch import nn
class TvpVideoGroundingHead(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_0 = nn.Linear(config.hidden_size, config.hidden_size * 2)
self.layer_1 = nn.Linear(config.hidden_size * 2, 2)
self.activation_0 = nn.ReLU()
self.activation... |
class TvpVideoGroundingHead(nn.Module):
def __init__(self, config):
pass
def forward(self, pooler_output):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 12 | 1 | 11 | 8 | 8 | 0 | 11 | 8 | 8 | 1 | 1 | 0 | 2 |
5,690 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpVideoGroundingOutput | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ModelOutput
import torch
from typing import Optional
from dataclasses import dataclass
from ...utils import auto_docstring, logging
@dataclass
@auto_docstring
class TvpVideoGroundingOutput(ModelOutput):
"""
loss (`torch.FloatTensor` o... | @dataclass
@auto_docstring
class TvpVideoGroundingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Temporal-Distance IoU loss for video grounding.
logits (`torch.FloatTensor` of shape `(batch_size, 2)`):
Contains start_ti... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 21 | 1 | 5 | 5 | 4 | 15 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
5,691 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpVisionModel | from ...utils.backbone_utils import load_backbone
from torch import nn
class TvpVisionModel(nn.Module):
def __init__(self, config):
super().__init__()
self.backbone = load_backbone(config)
if config.backbone_config is not None:
in_channels = config.backbone_config.hidden_sizes[... |
class TvpVisionModel(nn.Module):
def __init__(self, config):
pass
def forward(self, pixel_values):
pass | 3 | 0 | 18 | 1 | 16 | 2 | 3 | 0.09 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 38 | 3 | 32 | 10 | 29 | 3 | 21 | 10 | 18 | 4 | 1 | 1 | 5 |
5,692 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/modeling_tvp.py | transformers.models.tvp.modeling_tvp.TvpVisualInputEmbedding | import torch
from torch import nn
class TvpVisualInputEmbedding(nn.Module):
"""
Takes input of both image and video (multi-frame)
"""
def __init__(self, config):
super().__init__()
self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)
self.... |
class TvpVisualInputEmbedding(nn.Module):
'''
Takes input of both image and video (multi-frame)
'''
def __init__(self, config):
pass
def interpolate_pos_encoding(self, embedding: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate ... | 5 | 4 | 26 | 2 | 15 | 10 | 2 | 0.71 | 1 | 4 | 0 | 0 | 4 | 8 | 4 | 14 | 111 | 12 | 59 | 31 | 54 | 42 | 51 | 31 | 46 | 3 | 1 | 1 | 7 |
5,693 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tvp/processing_tvp.py | transformers.models.tvp.processing_tvp.TvpProcessor | from ...processing_utils import ProcessingKwargs, ProcessorMixin
class TvpProcessor(ProcessorMixin):
"""
Constructs an TVP processor which wraps a TVP image processor and a Bert tokenizer into a single processor.
[`TvpProcessor`] offers all the functionalities of [`TvpImageProcessor`] and [`BertTokenizerF... |
class TvpProcessor(ProcessorMixin):
'''
Constructs an TVP processor which wraps a TVP image processor and a Bert tokenizer into a single processor.
[`TvpProcessor`] offers all the functionalities of [`TvpImageProcessor`] and [`BertTokenizerFast`]. See the
[`~TvpProcessor.__call__`] and [`~TvpProcessor.... | 3 | 2 | 18 | 2 | 7 | 9 | 2 | 1.35 | 1 | 5 | 1 | 0 | 6 | 0 | 6 | 23 | 131 | 23 | 46 | 18 | 38 | 62 | 33 | 17 | 26 | 4 | 2 | 1 | 11 |
5,694 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/udop/configuration_udop.py | transformers.models.udop.configuration_udop.UdopConfig | from ...configuration_utils import PretrainedConfig
class UdopConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`UdopForConditionalGeneration`]. It is used to
instantiate a UDOP model according to the specified arguments, defining the model architecture. Instant... |
class UdopConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`UdopForConditionalGeneration`]. It is used to
instantiate a UDOP model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yi... | 2 | 1 | 69 | 4 | 64 | 2 | 4 | 0.87 | 1 | 4 | 0 | 0 | 1 | 21 | 1 | 1 | 134 | 8 | 68 | 52 | 41 | 59 | 32 | 27 | 30 | 4 | 1 | 1 | 4 |
5,695 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/udop/modeling_udop.py | transformers.models.udop.modeling_udop.BaseModelOutputWithAttentionMask | from typing import Any, Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils import ModelOutput, auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling
from dataclasses import dataclass
import torch
@dataclass
@auto_docstring(custom_intro="\n Class for th... | @dataclass
@auto_docstring(custom_intro="\n Class for the model's outputs that may also contain a past key/values (to speed up sequential decoding). Includes\n an additional attention mask.\n ")
class BaseModelOutputWithAttentionMask(ModelOutput):
'''
last_hidden_state (`torch.FloatTensor` of shape `(b... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4.43 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 40 | 2 | 7 | 7 | 6 | 31 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
5,696 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/udop/modeling_udop.py | transformers.models.udop.modeling_udop.RelativePositionBias1D | from typing import Any, Optional, Union
from torch import Tensor, nn
import torch
class RelativePositionBias1D(RelativePositionBiasBase):
def __init__(self, scaling_factor=1, max_distance=128, **kwargs):
"""
Reimplementation of T5 relative position bias. Distance between given tokens is their dist... |
class RelativePositionBias1D(RelativePositionBiasBase):
def __init__(self, scaling_factor=1, max_distance=128, **kwargs):
'''
Reimplementation of T5 relative position bias. Distance between given tokens is their distance in the sequence.
Parameters are the same as in base class
'''... | 3 | 1 | 7 | 1 | 5 | 2 | 2 | 0.4 | 1 | 5 | 0 | 0 | 2 | 0 | 2 | 37 | 16 | 2 | 10 | 4 | 7 | 4 | 8 | 4 | 5 | 2 | 5 | 1 | 3 |
5,697 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/udop/modeling_udop.py | transformers.models.udop.modeling_udop.RelativePositionBiasAggregated | from collections.abc import Sequence
from typing import Any, Optional, Union
from torch import Tensor, nn
class RelativePositionBiasAggregated(nn.Module):
def __init__(self, modules: Sequence[RelativePositionBiasBase]):
"""
Class which sums up various computed biases.
Args:
mo... |
class RelativePositionBiasAggregated(nn.Module):
def __init__(self, modules: Sequence[RelativePositionBiasBase]):
'''
Class which sums up various computed biases.
Args:
modules (Sequence[RelativePositionBiasBase]):
List of relative bias modules.
'''
... | 3 | 1 | 9 | 1 | 5 | 4 | 2 | 0.64 | 1 | 6 | 1 | 0 | 2 | 1 | 2 | 12 | 20 | 3 | 11 | 8 | 6 | 7 | 9 | 6 | 6 | 2 | 1 | 1 | 3 |
5,698 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/udop/modeling_udop.py | transformers.models.udop.modeling_udop.RelativePositionBiasBase | import torch
from abc import ABC, abstractmethod
from typing import Any, Optional, Union
import random
from torch import Tensor, nn
class RelativePositionBiasBase(nn.Module, ABC):
"""
Base class of relative biases.
Args:
num_heads (`int`):
Number of attention heads in the model, it wil... |
class RelativePositionBiasBase(nn.Module, ABC):
'''
Base class of relative biases.
Args:
num_heads (`int`):
Number of attention heads in the model, it will create embeddings of size `num_heads`, which will be added to the scores of each token pair.
relative_attention_num_buckets... | 7 | 1 | 15 | 1 | 14 | 0 | 2 | 0.3 | 2 | 6 | 0 | 3 | 5 | 10 | 5 | 35 | 102 | 11 | 70 | 44 | 48 | 21 | 49 | 28 | 43 | 6 | 4 | 2 | 12 |
5,699 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/udop/modeling_udop.py | transformers.models.udop.modeling_udop.RelativePositionBiasHorizontal | from torch import Tensor, nn
from typing import Any, Optional, Union
class RelativePositionBiasHorizontal(RelativePositionBiasBase):
def __init__(self, scaling_factor=100, max_distance=100, **kwargs):
"""
Represents in the bucket embeddings horizontal distance between two tokens. Parameters are th... |
class RelativePositionBiasHorizontal(RelativePositionBiasBase):
def __init__(self, scaling_factor=100, max_distance=100, **kwargs):
'''
Represents in the bucket embeddings horizontal distance between two tokens. Parameters are the same as in base
class
'''
p... | 3 | 1 | 8 | 1 | 5 | 3 | 2 | 0.5 | 1 | 5 | 0 | 0 | 2 | 0 | 2 | 37 | 17 | 2 | 10 | 4 | 7 | 5 | 10 | 4 | 7 | 3 | 5 | 1 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.