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,500 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py | transformers.models.swin2sr.modeling_swin2sr.Swin2SRSelfAttention | from typing import Optional, Union
import math
from torch import nn
import collections.abc
import torch
from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
class Swin2SRSelfAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size, pretrained_window_size=... |
class Swin2SRSelfAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size, pretrained_window_size=[0, 0]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional... | 3 | 0 | 41 | 4 | 33 | 5 | 3 | 0.15 | 1 | 6 | 0 | 0 | 3 | 11 | 3 | 13 | 127 | 15 | 100 | 45 | 90 | 15 | 72 | 39 | 68 | 5 | 1 | 1 | 10 |
5,501 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py | transformers.models.swin2sr.modeling_swin2sr.Swin2SRSelfOutput | import torch
from torch import nn
class Swin2SRSelfOutput(nn.Module):
def __init__(self, config, dim):
super().__init__()
self.dense = nn.Linear(dim, dim)
self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.... |
class Swin2SRSelfOutput(nn.Module):
def __init__(self, config, dim):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 2 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
5,502 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py | transformers.models.swin2sr.modeling_swin2sr.Swin2SRStage | from torch import nn
from typing import Optional, Union
import torch
from ...modeling_layers import GradientCheckpointingLayer
class Swin2SRStage(GradientCheckpointingLayer):
"""
This corresponds to the Residual Swin Transformer Block (RSTB) in the original implementation.
"""
def __init__(self, confi... |
class Swin2SRStage(GradientCheckpointingLayer):
'''
This corresponds to the Residual Swin Transformer Block (RSTB) in the original implementation.
'''
def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, pretrained_window_size=0):
pass
def forward(self, hidden_st... | 3 | 1 | 32 | 6 | 26 | 1 | 4 | 0.08 | 1 | 9 | 3 | 0 | 2 | 6 | 2 | 12 | 69 | 13 | 52 | 23 | 43 | 4 | 27 | 17 | 24 | 4 | 1 | 1 | 8 |
5,503 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py | transformers.models.swin2sr.modeling_swin2sr.Upsample | from torch import nn
import math
class Upsample(nn.Module):
"""Upsample module.
Args:
scale (`int`):
Scale factor. Supported scales: 2^n and 3.
num_features (`int`):
Channel number of intermediate features.
"""
def __init__(self, scale, num_features):
s... |
class Upsample(nn.Module):
'''Upsample module.
Args:
scale (`int`):
Scale factor. Supported scales: 2^n and 3.
num_features (`int`):
Channel number of intermediate features.
'''
def __init__(self, scale, num_features):
pass
def forward(self, hidden_... | 3 | 1 | 13 | 2 | 11 | 1 | 4 | 0.36 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 36 | 6 | 22 | 8 | 19 | 8 | 19 | 8 | 16 | 4 | 1 | 2 | 8 |
5,504 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py | transformers.models.swin2sr.modeling_swin2sr.UpsampleOneStep | from torch import nn
class UpsampleOneStep(nn.Module):
"""UpsampleOneStep module (the difference with Upsample is that it always only has 1conv + 1pixelshuffle)
Used in lightweight SR to save parameters.
Args:
scale (int):
Scale factor. Supported scales: 2^n and 3.
in_channels... |
class UpsampleOneStep(nn.Module):
'''UpsampleOneStep module (the difference with Upsample is that it always only has 1conv + 1pixelshuffle)
Used in lightweight SR to save parameters.
Args:
scale (int):
Scale factor. Supported scales: 2^n and 3.
in_channels (int):
Cha... | 3 | 1 | 5 | 1 | 4 | 0 | 1 | 1.11 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 25 | 6 | 9 | 5 | 6 | 10 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
5,505 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/configuration_swinv2.py | transformers.models.swinv2.configuration_swinv2.Swinv2Config | from ...configuration_utils import PretrainedConfig
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
class Swinv2Config(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Swinv2Model`]. It is used to i... |
class Swinv2Config(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Swinv2Model`]. It is used to instantiate a Swin
Transformer v2 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with... | 2 | 1 | 52 | 1 | 49 | 2 | 1 | 1.2 | 2 | 3 | 0 | 0 | 1 | 23 | 1 | 6 | 132 | 11 | 55 | 49 | 30 | 66 | 27 | 26 | 25 | 1 | 1 | 0 | 1 |
5,506 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Attention | from typing import Optional, Union
from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
from torch import Tensor, nn
import torch
import collections.abc
class Swinv2Attention(nn.Module):
def __init__(self, config, dim, num_heads, window_size, pretrained_window_size=0):
... |
class Swinv2Attention(nn.Module):
def __init__(self, config, dim, num_heads, window_size, pretrained_window_size=0):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTen... | 4 | 0 | 14 | 1 | 12 | 1 | 2 | 0.08 | 1 | 7 | 2 | 0 | 3 | 3 | 3 | 13 | 44 | 4 | 38 | 17 | 28 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 5 |
5,507 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Backbone | from ...modeling_outputs import BackboneOutput
from ...utils.backbone_utils import BackboneMixin
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from torch import Tensor, nn
@auto_docstring(custom_intro='\n Swinv2 backbone, to be used with frameworks like DETR... | @auto_docstring(custom_intro='\n Swinv2 backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class Swinv2Backbone(Swinv2PreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
@auto_docstring
def forward(self, pixel_va... | 6 | 1 | 28 | 5 | 16 | 7 | 4 | 0.41 | 2 | 9 | 3 | 0 | 3 | 3 | 3 | 16 | 88 | 16 | 51 | 20 | 39 | 21 | 29 | 13 | 25 | 11 | 2 | 2 | 13 |
5,508 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2DropPath | from typing import Optional, Union
import torch
from torch import Tensor, nn
class Swinv2DropPath(nn.Module):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
def __init__(self, drop_prob: Optional[float]=None) -> None:
super().__init__()
self.drop... |
class Swinv2DropPath(nn.Module):
'''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).'''
def __init__(self, drop_prob: Optional[float]=None) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass
def extra_repr(self) ... | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.13 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 13 | 12 | 3 | 8 | 5 | 4 | 1 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
5,509 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Embeddings | from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
import torch
class Swinv2Embeddings(nn.Module):
"""
Construct the patch and position embeddings. Optionally, also the mask token.
"""
def __init__(self, config, use_mask... |
class Swinv2Embeddings(nn.Module):
'''
Construct the patch and position embeddings. Optionally, also the mask token.
'''
def __init__(self, config, use_mask_token=False):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
''... | 4 | 2 | 27 | 6 | 19 | 3 | 3 | 0.23 | 1 | 5 | 1 | 0 | 3 | 8 | 3 | 13 | 90 | 20 | 57 | 31 | 48 | 13 | 45 | 26 | 41 | 4 | 1 | 2 | 9 |
5,510 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Encoder | from torch import Tensor, nn
import torch
from typing import Optional, Union
class Swinv2Encoder(nn.Module):
def __init__(self, config, grid_size, pretrained_window_sizes=(0, 0, 0, 0)):
super().__init__()
self.num_layers = len(config.depths)
self.config = config
if self.config.pret... |
class Swinv2Encoder(nn.Module):
def __init__(self, config, grid_size, pretrained_window_sizes=(0, 0, 0, 0)):
pass
def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int], head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, output_hidden_state... | 3 | 0 | 51 | 6 | 43 | 2 | 8 | 0.05 | 1 | 10 | 3 | 0 | 2 | 4 | 2 | 12 | 103 | 12 | 87 | 30 | 75 | 4 | 49 | 21 | 46 | 12 | 1 | 2 | 16 |
5,511 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2EncoderOutput | from dataclasses import dataclass
import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro="\n Swinv2 encoder's outputs, with potential hidden states and attentions.\n ")
class Swinv2EncoderOutput(ModelOutput):
... | @dataclass
@auto_docstring(custom_intro="\n Swinv2 encoder's outputs, with potential hidden states and attentions.\n ")
class Swinv2EncoderOutput(ModelOutput):
'''
reshaped_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hid... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 30 | 5 | 5 | 5 | 4 | 20 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
5,512 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2ForImageClassification | import torch
from typing import Optional, Union
from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@auto_docstring(custom_intro="\n Swinv2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state\n of the [CLS] toke... | @auto_docstring(custom_intro="\n Swinv2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state\n of the [CLS] token) e.g. for ImageNet.\n\n <Tip>\n\n Note that it's possible to fine-tune SwinV2 on higher resolution images than the ones it has been tra... | 5 | 1 | 39 | 5 | 30 | 4 | 7 | 0.12 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 87 | 11 | 68 | 22 | 49 | 8 | 32 | 12 | 29 | 12 | 2 | 3 | 14 |
5,513 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2ForMaskedImageModeling | from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
import torch
import math
@auto_docstring(custom_intro='\n Swinv2 Model with a decoder on top for masked image modeling, as proposed in\n [SimMIM](https://huggingface.co/papers/... | @auto_docstring(custom_intro='\n Swinv2 Model with a decoder on top for masked image modeling, as proposed in\n [SimMIM](https://huggingface.co/papers/2111.09886).\n\n <Tip>\n\n Note that we provide a script to pre-train this model on custom data in our [examples\n directory](https://gith... | 5 | 1 | 50 | 8 | 30 | 13 | 3 | 0.42 | 1 | 5 | 2 | 0 | 2 | 2 | 2 | 3 | 104 | 16 | 62 | 26 | 48 | 26 | 27 | 16 | 24 | 5 | 2 | 1 | 6 |
5,514 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2ImageClassifierOutput | from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
from dataclasses import dataclass
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Swinv2 outputs for image classification.\n ')
class Swinv2ImageClassifierOutput(ModelOutput):
"""
loss (`torch... | @dataclass
@auto_docstring(custom_intro='\n Swinv2 outputs for image classification.\n ')
class Swinv2ImageClassifierOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.
... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.67 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 5 | 6 | 6 | 5 | 22 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,515 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Intermediate | from ...activations import ACT2FN
from torch import Tensor, nn
import torch
class Swinv2Intermediate(nn.Module):
def __init__(self, config, dim):
super().__init__()
self.dense = nn.Linear(dim, int(config.mlp_ratio * dim))
if isinstance(config.hidden_act, str):
self.intermediate... |
class Swinv2Intermediate(nn.Module):
def __init__(self, config, dim):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
5,516 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Layer | from typing import Optional, Union
import collections.abc
from torch import Tensor, nn
import torch
class Swinv2Layer(nn.Module):
def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0, pretrained_window_size=0):
super().__init__()
self.input_resolution = inp... |
class Swinv2Layer(nn.Module):
def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0, pretrained_window_size=0):
pass
def _compute_window_shift(self, target_window_size, target_shift_size) -> tuple[tuple[int, int], tuple[int, int]]:
pass
def get_att... | 6 | 0 | 24 | 2 | 20 | 1 | 3 | 0.05 | 1 | 12 | 4 | 0 | 5 | 9 | 5 | 15 | 123 | 15 | 103 | 52 | 89 | 5 | 72 | 44 | 66 | 6 | 1 | 3 | 17 |
5,517 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2MaskedImageModelingOutput | import warnings
from dataclasses import dataclass
import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Swinv2 masked image model outputs.\n ')
class Swinv2MaskedImageModelingOutput(ModelOutput):
"""
... | @dataclass
@auto_docstring(custom_intro='\n Swinv2 masked image model outputs.\n ')
class Swinv2MaskedImageModelingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `bool_masked_pos` is provided):
Masked image modeling (MLM) loss.
reconstruction (`to... | 5 | 1 | 7 | 0 | 7 | 0 | 1 | 1.57 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 42 | 6 | 14 | 8 | 11 | 22 | 9 | 7 | 7 | 1 | 1 | 0 | 1 |
5,518 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Model | import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
from torch import Tensor, nn
@auto_docstring
class Swinv2Model(Swinv2PreTrainedModel):
def __init__(self, config, add_pooling_layer=True, use_mask_token=False):
"""
add_pooling_laye... | @auto_docstring
class Swinv2Model(Swinv2PreTrainedModel):
def __init__(self, config, add_pooling_layer=True, use_mask_token=False):
'''
add_pooling_layer (`bool`, *optional*, defaults to `True`):
Whether or not to apply pooling layer.
use_mask_token (`bool`, *optional*, defaults... | 7 | 3 | 22 | 3 | 15 | 4 | 3 | 0.2 | 1 | 7 | 3 | 0 | 4 | 7 | 4 | 5 | 98 | 15 | 69 | 28 | 47 | 14 | 35 | 18 | 30 | 7 | 2 | 1 | 12 |
5,519 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2ModelOutput | from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
from dataclasses import dataclass
import torch
@dataclass
@auto_docstring(custom_intro="\n Swinv2 model's outputs that also contains a pooling of the last hidden states.\n ")
class Swinv2ModelOutput(ModelOutpu... | @dataclass
@auto_docstring(custom_intro="\n Swinv2 model's outputs that also contains a pooling of the last hidden states.\n ")
class Swinv2ModelOutput(ModelOutput):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*, returned when `add_pooling_layer=True` is passed):
... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.67 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 5 | 6 | 6 | 5 | 22 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,520 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Output | import torch
from torch import Tensor, nn
class Swinv2Output(nn.Module):
def __init__(self, config, dim):
super().__init__()
self.dense = nn.Linear(int(config.mlp_ratio * dim), dim)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, hidden_states: torch.Tensor) ->... |
class Swinv2Output(nn.Module):
def __init__(self, config, dim):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 10 | 1 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
5,521 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2PatchEmbeddings | import torch
import collections.abc
from torch import Tensor, nn
from typing import Optional, Union
class Swinv2PatchEmbeddings(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... |
class Swinv2PatchEmbeddings(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):... | 4 | 1 | 11 | 1 | 10 | 0 | 2 | 0.2 | 1 | 4 | 0 | 0 | 3 | 6 | 3 | 13 | 41 | 5 | 30 | 17 | 26 | 6 | 30 | 17 | 26 | 3 | 1 | 1 | 7 |
5,522 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2PatchMerging | from torch import Tensor, nn
import torch
class Swinv2PatchMerging(nn.Module):
"""
Patch Merging Layer.
Args:
input_resolution (`tuple[int]`):
Resolution of input feature.
dim (`int`):
Number of input channels.
norm_layer (`nn.Module`, *optional*, defaults t... |
class Swinv2PatchMerging(nn.Module):
'''
Patch Merging Layer.
Args:
input_resolution (`tuple[int]`):
Resolution of input feature.
dim (`int`):
Number of input channels.
norm_layer (`nn.Module`, *optional*, defaults to `nn.LayerNorm`):
Normalizatio... | 4 | 1 | 12 | 1 | 9 | 3 | 1 | 0.67 | 1 | 3 | 0 | 0 | 3 | 4 | 3 | 13 | 52 | 8 | 27 | 16 | 23 | 18 | 27 | 16 | 23 | 2 | 1 | 1 | 4 |
5,523 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2PreTrainedModel | import math
from .configuration_swinv2 import Swinv2Config
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from torch import Tensor, nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class Swinv2PreTrainedModel(PreTrainedModel):
config: Swinv2Config
base_model_prefix = 'swin... | @auto_docstring
class Swinv2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.5 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 23 | 2 | 14 | 7 | 12 | 7 | 13 | 7 | 11 | 4 | 1 | 2 | 4 |
5,524 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2SelfAttention | import torch
from torch import Tensor, nn
import collections.abc
from typing import Optional, Union
import math
from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
class Swinv2SelfAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size, pretrained_windo... |
class Swinv2SelfAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size, pretrained_window_size=[0, 0]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[... | 3 | 0 | 41 | 4 | 33 | 5 | 3 | 0.15 | 1 | 6 | 0 | 0 | 3 | 11 | 3 | 13 | 127 | 15 | 100 | 45 | 90 | 15 | 72 | 39 | 68 | 5 | 1 | 1 | 10 |
5,525 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2SelfOutput | from torch import Tensor, nn
import torch
class Swinv2SelfOutput(nn.Module):
def __init__(self, config, dim):
super().__init__()
self.dense = nn.Linear(dim, dim)
self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
def forward(self, hidden_states: torch.Tensor, input_tensor:... |
class Swinv2SelfOutput(nn.Module):
def __init__(self, config, dim):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 2 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
5,526 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/swinv2/modeling_swinv2.py | transformers.models.swinv2.modeling_swinv2.Swinv2Stage | import torch
from typing import Optional, Union
from torch import Tensor, nn
from ...modeling_layers import GradientCheckpointingLayer
class Swinv2Stage(GradientCheckpointingLayer):
def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, downsample, pretrained_window_size=0):
super(... |
class Swinv2Stage(GradientCheckpointingLayer):
def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, downsample, pretrained_window_size=0):
pass
def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int], head_mask: Optional[torch.FloatTensor]=None, outp... | 3 | 0 | 30 | 4 | 26 | 1 | 5 | 0.02 | 1 | 7 | 1 | 0 | 2 | 5 | 2 | 12 | 62 | 8 | 53 | 27 | 42 | 1 | 30 | 19 | 27 | 5 | 1 | 1 | 9 |
5,527 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/configuration_switch_transformers.py | transformers.models.switch_transformers.configuration_switch_transformers.SwitchTransformersConfig | from ...configuration_utils import PretrainedConfig
class SwitchTransformersConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SwitchTransformersModel`]. It is used to
instantiate a SwitchTransformers model according to the specified arguments, defining the mode... |
class SwitchTransformersConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SwitchTransformersModel`]. It is used to
instantiate a SwitchTransformers model according to the specified arguments, defining the model architecture.
Instantiating a configuration wi... | 2 | 1 | 86 | 9 | 75 | 5 | 5 | 0.89 | 1 | 2 | 0 | 0 | 1 | 27 | 1 | 1 | 159 | 13 | 79 | 63 | 46 | 70 | 39 | 32 | 37 | 5 | 1 | 1 | 5 |
5,528 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersAttention | from ...utils.deprecation import deprecate_kwarg
from .configuration_switch_transformers import SwitchTransformersConfig
import math
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch.nn as nn
import torch
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
fr... |
class SwitchTransformersAttention(nn.Module):
def __init__(self, config: SwitchTransformersConfig, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
def prune_heads(self, heads):
pass
@staticmethod
def _relative_position_bucket(relative_position, bidirectional=Tr... | 8 | 3 | 44 | 5 | 32 | 8 | 5 | 0.26 | 1 | 5 | 1 | 0 | 4 | 17 | 5 | 15 | 226 | 28 | 160 | 67 | 136 | 42 | 113 | 49 | 107 | 16 | 1 | 3 | 26 |
5,529 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersBlock | from ...modeling_layers import GradientCheckpointingLayer
import torch
from typing import Optional, Union
import torch.nn as nn
class SwitchTransformersBlock(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, is_sparse=False, layer_idx: Optional[int]=None):
super().... |
class SwitchTransformersBlock(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, is_sparse=False, layer_idx: Optional[int]=None):
pass
def forward(self, hidden_states, attention_mask=None, position_bias=None, encoder_hidden_states=None, encoder_attention_mask=N... | 3 | 0 | 47 | 6 | 39 | 4 | 5 | 0.09 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 12 | 96 | 12 | 79 | 29 | 60 | 7 | 37 | 13 | 34 | 7 | 1 | 2 | 9 |
5,530 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersDenseActDense | from .configuration_switch_transformers import SwitchTransformersConfig
from ...activations import ACT2FN
import torch
import torch.nn as nn
class SwitchTransformersDenseActDense(nn.Module):
def __init__(self, config: SwitchTransformersConfig):
super().__init__()
self.wi = nn.Linear(config.d_model... |
class SwitchTransformersDenseActDense(nn.Module):
def __init__(self, config: SwitchTransformersConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 0 | 9 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 20 | 1 | 19 | 7 | 16 | 0 | 15 | 7 | 12 | 2 | 1 | 1 | 3 |
5,531 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersEncoderModel | from .configuration_switch_transformers import SwitchTransformersConfig
import torch.nn as nn
import copy
from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...modeling_outputs import MoEModelOutput, MoEMode... | @auto_docstring(custom_intro="\n The bare SWITCH_TRANSFORMERS Model transformer outputting encoder's raw hidden-states without any specific head\n ")
class SwitchTransformersEncoderModel(SwitchTransformersPreTrainedModel):
def __init__(self, config: SwitchTransformersConfig):
pass
def get_input_... | 10 | 2 | 10 | 1 | 6 | 3 | 1 | 0.39 | 1 | 5 | 3 | 0 | 7 | 3 | 7 | 10 | 83 | 15 | 49 | 26 | 29 | 19 | 28 | 15 | 20 | 2 | 2 | 1 | 10 |
5,532 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersForConditionalGeneration | import copy
import torch
from ...modeling_outputs import MoEModelOutput, MoEModelOutputWithPastAndCrossAttentions, Seq2SeqMoEModelOutput, Seq2SeqMoEOutput
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from ...generation import GenerationMixin
import warnings
from... | @auto_docstring(custom_intro='\n SWITCH_TRANSFORMERS Model with a `language modeling` head on top.\n ')
class SwitchTransformersForConditionalGeneration(SwitchTransformersPreTrainedModel, GenerationMixin):
def __init__(self, config: SwitchTransformersConfig):
pass
def get_input_embeddings(self):... | 11 | 1 | 22 | 3 | 16 | 3 | 3 | 0.21 | 2 | 9 | 4 | 0 | 12 | 8 | 12 | 15 | 281 | 44 | 196 | 70 | 161 | 41 | 118 | 49 | 105 | 20 | 2 | 2 | 39 |
5,533 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersLayerCrossAttention | from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
import torch.nn as nn
class SwitchTransformersLayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
super().__init__()
self.EncDecAttention = SwitchTransformersAttention(config,... |
class SwitchTransformersLayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, key_value_states, attention_mask=None, position_bias=None, layer_h... | 4 | 0 | 18 | 0 | 18 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 38 | 1 | 37 | 22 | 22 | 1 | 12 | 10 | 9 | 1 | 1 | 0 | 2 |
5,534 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersLayerFF | from .configuration_switch_transformers import SwitchTransformersConfig
import torch.nn as nn
class SwitchTransformersLayerFF(nn.Module):
"""
Switch Transformers Feed Forward layer module. This is a wrapper around the Mixture of Experts module.
Parameters:
config : ([`SwitchTransformersConfig`]): ... |
class SwitchTransformersLayerFF(nn.Module):
'''
Switch Transformers Feed Forward layer module. This is a wrapper around the Mixture of Experts module.
Parameters:
config : ([`SwitchTransformersConfig`]): Model configuration class with all the parameters of the model.
Initializing with a... | 3 | 1 | 14 | 3 | 10 | 1 | 3 | 0.48 | 1 | 6 | 4 | 0 | 2 | 4 | 2 | 12 | 40 | 9 | 21 | 10 | 18 | 10 | 19 | 10 | 16 | 3 | 1 | 1 | 5 |
5,535 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersLayerNorm | import torch
import torch.nn as nn
class SwitchTransformersLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Construct a layernorm module in the SwitchTransformers style. No bias and no subtraction of mean.
"""
super().__init__()
self.weight = nn.Paramet... |
class SwitchTransformersLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Construct a layernorm module in the SwitchTransformers style. No bias and no subtraction of mean.
'''
pass
def forward(self, hidden_states):
pass | 3 | 1 | 11 | 2 | 5 | 4 | 2 | 0.73 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 23 | 4 | 11 | 6 | 8 | 8 | 11 | 6 | 8 | 2 | 1 | 1 | 3 |
5,536 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersLayerSelfAttention | from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
import torch.nn as nn
class SwitchTransformersLayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
super().__init__()
self.SelfAttention = Swi... |
class SwitchTransformersLayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, position_bi... | 4 | 0 | 16 | 0 | 16 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 34 | 1 | 33 | 19 | 20 | 1 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
5,537 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersModel | import warnings
from .configuration_switch_transformers import SwitchTransformersConfig
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch.nn as nn
import copy
from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_com... | @auto_docstring
class SwitchTransformersModel(SwitchTransformersPreTrainedModel):
def __init__(self, config: SwitchTransformersConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def _tie_weights(self):
pass
def... | 10 | 2 | 20 | 2 | 14 | 3 | 3 | 0.23 | 1 | 9 | 4 | 0 | 8 | 4 | 8 | 11 | 170 | 24 | 119 | 39 | 89 | 27 | 50 | 19 | 41 | 12 | 2 | 2 | 21 |
5,538 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersPreTrainedModel | from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
from .configuration_switch_transformers import SwitchTransformersConfig
import torch.nn as nn
import torch
from ...modeling_utils import PreTrainedModel
@auto_docstring
clas... | @auto_docstring
class SwitchTransformersPreTrainedModel(PreTrainedModel):
@property
def dummy_inputs(self):
pass
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _shift_right(self, input_ids):
pass | 6 | 1 | 27 | 1 | 21 | 5 | 5 | 0.25 | 1 | 9 | 7 | 4 | 3 | 0 | 3 | 3 | 97 | 8 | 72 | 22 | 67 | 18 | 56 | 21 | 52 | 11 | 1 | 2 | 16 |
5,539 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersSparseMLP | import torch.nn as nn
import torch
from .configuration_switch_transformers import SwitchTransformersConfig
class SwitchTransformersSparseMLP(nn.Module):
"""
Implementation of the Switch Transformers Sparse MLP module.
"""
def __init__(self, config: SwitchTransformersConfig, expert_class: nn.Module=Swi... |
class SwitchTransformersSparseMLP(nn.Module):
'''
Implementation of the Switch Transformers Sparse MLP module.
'''
def __init__(self, config: SwitchTransformersConfig, expert_class: nn.Module=SwitchTransformersDenseActDense):
pass
def forward(self, hidden_states):
'''
Hold... | 3 | 2 | 22 | 4 | 11 | 7 | 2 | 0.74 | 1 | 5 | 3 | 0 | 2 | 2 | 2 | 12 | 49 | 10 | 23 | 12 | 20 | 17 | 19 | 12 | 16 | 2 | 1 | 1 | 4 |
5,540 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersStack | from ...modeling_outputs import MoEModelOutput, MoEModelOutputWithPastAndCrossAttentions, Seq2SeqMoEModelOutput, Seq2SeqMoEOutput
import torch.nn as nn
import torch
from ...modeling_attn_mask_utils import AttentionMaskConverter
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDe... |
class SwitchTransformersStack(SwitchTransformersPreTrainedModel):
def __init__(self, config, embed_tokens=None):
pass
def set_input_embeddings(self, new_embeddings):
pass
def forward(self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, input... | 7 | 1 | 63 | 7 | 49 | 8 | 11 | 0.16 | 1 | 16 | 8 | 0 | 5 | 7 | 6 | 9 | 388 | 46 | 296 | 86 | 256 | 48 | 155 | 53 | 148 | 46 | 2 | 3 | 67 |
5,541 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/switch_transformers/modeling_switch_transformers.py | transformers.models.switch_transformers.modeling_switch_transformers.SwitchTransformersTop1Router | from .configuration_switch_transformers import SwitchTransformersConfig
import torch
import torch.nn as nn
class SwitchTransformersTop1Router(nn.Module):
"""
Router using tokens choose top-1 experts assignment.
This router uses the same mechanism as in Switch Transformer (https://huggingface.co/papers/210... |
class SwitchTransformersTop1Router(nn.Module):
'''
Router using tokens choose top-1 experts assignment.
This router uses the same mechanism as in Switch Transformer (https://huggingface.co/papers/2101.03961) and V-MoE
(https://huggingface.co/papers/2106.05974): tokens choose their top experts. Items ar... | 5 | 4 | 19 | 2 | 7 | 10 | 2 | 1.53 | 1 | 3 | 1 | 0 | 4 | 7 | 4 | 14 | 91 | 15 | 30 | 18 | 25 | 46 | 30 | 18 | 25 | 2 | 1 | 1 | 6 |
5,542 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/configuration_t5.py | transformers.models.t5.configuration_t5.T5Config | from ...configuration_utils import PretrainedConfig
class T5Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`T5Model`] or a [`TFT5Model`]. It is used to
instantiate a T5 model according to the specified arguments, defining the model architecture. Instantiating... |
class T5Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`T5Model`] or a [`TFT5Model`]. It is used to
instantiate a T5 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a ... | 2 | 1 | 61 | 4 | 56 | 2 | 4 | 0.69 | 1 | 2 | 0 | 0 | 1 | 17 | 1 | 1 | 117 | 8 | 65 | 44 | 42 | 45 | 28 | 23 | 26 | 4 | 1 | 1 | 4 |
5,543 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/configuration_t5.py | transformers.models.t5.configuration_t5.T5OnnxConfig | from collections.abc import Mapping
from ...onnx import OnnxSeq2SeqConfigWithPast
class T5OnnxConfig(OnnxSeq2SeqConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
common_inputs = {'input_ids': {0: 'batch', 1: 'encoder_sequence'}, 'attention_mask': {0: 'batch', 1: 'encoder_... |
class T5OnnxConfig(OnnxSeq2SeqConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def default_onnx_opset(self) -> int:
pass | 5 | 0 | 10 | 1 | 9 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 23 | 3 | 20 | 6 | 15 | 0 | 14 | 4 | 11 | 3 | 1 | 1 | 4 |
5,544 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5Attention | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils.deprecation import deprecate_kwarg
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from typing import Optional, Union
from .configuration_t5 import T5Config
import math
from torch import nn
... |
class T5Attention(nn.Module):
def __init__(self, config: T5Config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
def prune_heads(self, heads):
pass
@staticmethod
def _relative_position_bucket(relative_position, bidirectional=True, num_buckets=32, max_distance... | 8 | 3 | 44 | 5 | 32 | 8 | 5 | 0.26 | 1 | 5 | 1 | 0 | 4 | 17 | 5 | 15 | 226 | 28 | 160 | 67 | 136 | 42 | 113 | 49 | 107 | 16 | 1 | 3 | 26 |
5,545 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5Block | import torch
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class T5Block(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
... |
class T5Block(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, position_bias=None, enc... | 4 | 0 | 48 | 5 | 41 | 4 | 4 | 0.09 | 1 | 5 | 3 | 0 | 2 | 2 | 2 | 12 | 98 | 11 | 82 | 26 | 64 | 7 | 33 | 11 | 30 | 6 | 1 | 2 | 8 |
5,546 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5ClassificationHead | import torch
from torch import nn
from .configuration_t5 import T5Config
class T5ClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config: T5Config):
super().__init__()
self.dense = nn.Linear(config.d_model, config.d_model)
self.dropo... |
class T5ClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config: T5Config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 6 | 0 | 6 | 0 | 1 | 0.08 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 16 | 2 | 13 | 6 | 10 | 1 | 13 | 6 | 10 | 1 | 1 | 0 | 2 |
5,547 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5DenseActDense | import torch
from torch import nn
from .configuration_t5 import T5Config
from ...activations import ACT2FN
class T5DenseActDense(nn.Module):
def __init__(self, config: T5Config):
super().__init__()
self.wi = nn.Linear(config.d_model, config.d_ff, bias=False)
self.wo = nn.Linear(config.d_ff... |
class T5DenseActDense(nn.Module):
def __init__(self, config: T5Config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 0 | 9 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 20 | 1 | 19 | 7 | 16 | 0 | 15 | 7 | 12 | 2 | 1 | 1 | 3 |
5,548 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5DenseGatedActDense | import torch
from torch import nn
from .configuration_t5 import T5Config
from ...activations import ACT2FN
class T5DenseGatedActDense(nn.Module):
def __init__(self, config: T5Config):
super().__init__()
self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False)
self.wi_1 = nn.Linear(co... |
class T5DenseGatedActDense(nn.Module):
def __init__(self, config: T5Config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 13 | 1 | 10 | 2 | 2 | 0.14 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 27 | 3 | 21 | 10 | 18 | 3 | 17 | 10 | 14 | 2 | 1 | 1 | 3 |
5,549 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5EncoderModel | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
import warnings
from .configuration_t5 import T5Con... | @auto_docstring
class T5EncoderModel(T5PreTrainedModel):
def __init__(self, config: T5Config):
pass
@add_start_docstrings(PARALLELIZE_DOCSTRING)
def parallelize(self, device_map=None):
pass
@add_start_docstrings(DEPARALLELIZE_DOCSTRING)
def deparallelize(self):
pass
def... | 14 | 2 | 11 | 1 | 8 | 2 | 1 | 0.25 | 1 | 7 | 3 | 0 | 9 | 4 | 9 | 12 | 113 | 17 | 77 | 31 | 54 | 19 | 43 | 19 | 33 | 2 | 2 | 1 | 13 |
5,550 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5ForConditionalGeneration | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput, TokenClassifierOutput
from typing import... | @auto_docstring(custom_intro='\n T5 Model with a `language modeling` head on top.\n ')
class T5ForConditionalGeneration(T5PreTrainedModel, GenerationMixin):
def __init__(self, config: T5Config):
pass
@add_start_docstrings(PARALLELIZE_DOCSTRING)
def parallelize(self, device_map=None):
... | 14 | 1 | 20 | 2 | 14 | 3 | 3 | 0.22 | 2 | 10 | 4 | 0 | 13 | 7 | 13 | 16 | 282 | 42 | 197 | 58 | 160 | 43 | 116 | 36 | 102 | 20 | 2 | 2 | 39 |
5,551 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5ForQuestionAnswering | import copy
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput... | @auto_docstring
class T5ForQuestionAnswering(T5PreTrainedModel):
def __init__(self, config: T5Config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def _tie_weights(self):
pass
def get_encoder(self):
pass
... | 9 | 1 | 24 | 3 | 19 | 3 | 4 | 0.14 | 1 | 9 | 4 | 0 | 7 | 7 | 7 | 10 | 183 | 25 | 138 | 49 | 110 | 20 | 77 | 30 | 69 | 19 | 2 | 2 | 26 |
5,552 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5ForSequenceClassification | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
from .configuration_t5 import T5Config
from torch.n... | @auto_docstring(custom_intro='\n T5 model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g. for GLUE\n tasks.\n ')
class T5ForSequenceClassification(T5PreTrainedModel):
def __init__(self, config: T5Config):
pass
@auto_docstring
def forward(self, i... | 5 | 1 | 59 | 5 | 49 | 5 | 9 | 0.09 | 1 | 10 | 4 | 0 | 2 | 3 | 2 | 5 | 124 | 12 | 103 | 35 | 81 | 9 | 48 | 17 | 45 | 17 | 2 | 3 | 18 |
5,553 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5ForTokenClassification | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
from .configuration_t5 import T5Config
from torch.n... | @auto_docstring
class T5ForTokenClassification(T5PreTrainedModel):
def __init__(self, config: T5Config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, inputs_embeds: Optional[torch.... | 5 | 1 | 29 | 4 | 22 | 3 | 3 | 0.13 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 5 | 63 | 9 | 48 | 25 | 33 | 6 | 23 | 14 | 20 | 5 | 2 | 1 | 6 |
5,554 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5LayerCrossAttention | from typing import Optional, Union
from torch import nn
from ...utils.deprecation import deprecate_kwarg
class T5LayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
super().__init__()
self.EncDecAttention = T5Attention(config, has_relative_attention_bias=Fals... |
class T5LayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, key_value_states, attention_mask=None, position_bias=None, layer_head_mask=None, p... | 4 | 0 | 17 | 0 | 17 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 36 | 1 | 35 | 22 | 20 | 1 | 12 | 10 | 9 | 1 | 1 | 0 | 2 |
5,555 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5LayerFF | from torch import nn
from .configuration_t5 import T5Config
class T5LayerFF(nn.Module):
def __init__(self, config: T5Config):
super().__init__()
if config.is_gated_act:
self.DenseReluDense = T5DenseGatedActDense(config)
else:
self.DenseReluDense = T5DenseActDense(co... |
class T5LayerFF(nn.Module):
def __init__(self, config: T5Config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 1 | 7 | 0 | 2 | 0 | 1 | 5 | 4 | 0 | 2 | 3 | 2 | 12 | 16 | 2 | 14 | 7 | 11 | 0 | 13 | 7 | 10 | 2 | 1 | 1 | 3 |
5,556 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5LayerNorm | import torch
from torch import nn
class T5LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Construct a layernorm module in the T5 style. No bias and no subtraction of mean.
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
... |
class T5LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Construct a layernorm module in the T5 style. No bias and no subtraction of mean.
'''
pass
def forward(self, hidden_states):
pass | 3 | 1 | 11 | 2 | 5 | 4 | 2 | 0.73 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 23 | 4 | 11 | 6 | 8 | 8 | 11 | 6 | 8 | 2 | 1 | 1 | 3 |
5,557 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5LayerSelfAttention | from typing import Optional, Union
from torch import nn
from ...utils.deprecation import deprecate_kwarg
class T5LayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
super().__init__()
self.SelfAttention = T5Attention(config, ... |
class T5LayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, position_bias=None, layer_h... | 4 | 0 | 16 | 0 | 16 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 34 | 1 | 33 | 19 | 20 | 1 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
5,558 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5Model | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput, TokenClassifierOutput
from typing import... | @auto_docstring
class T5Model(T5PreTrainedModel):
def __init__(self, config: T5Config):
pass
@add_start_docstrings(PARALLELIZE_DOCSTRING)
def parallelize(self, device_map=None):
pass
@add_start_docstrings(DEPARALLELIZE_DOCSTRING)
def deparallelize(self):
pass
def get_in... | 14 | 2 | 19 | 2 | 14 | 3 | 3 | 0.19 | 1 | 9 | 4 | 0 | 10 | 5 | 10 | 13 | 204 | 27 | 149 | 44 | 116 | 28 | 76 | 23 | 65 | 14 | 2 | 2 | 26 |
5,559 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5PreTrainedModel | from .configuration_t5 import T5Config
from ...modeling_utils import PreTrainedModel
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
@auto_docstring
class T5PreTrainedModel(PreTrainedMod... | @auto_docstring
class T5PreTrainedModel(PreTrainedModel):
@property
def dummy_inputs(self):
pass
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _shift_right(self, input_ids):
pass | 6 | 1 | 32 | 1 | 27 | 4 | 8 | 0.18 | 1 | 11 | 10 | 7 | 3 | 0 | 3 | 3 | 115 | 8 | 92 | 25 | 87 | 17 | 74 | 24 | 70 | 19 | 1 | 2 | 24 |
5,560 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/modeling_t5.py | transformers.models.t5.modeling_t5.T5Stack | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQuestionAnsweringModelOutput, Seq2SeqSequenceClassifierOutput, TokenClassifierOutput
from typing import... |
class T5Stack(T5PreTrainedModel):
def __init__(self, config, embed_tokens=None):
pass
@add_start_docstrings(PARALLELIZE_DOCSTRING)
def parallelize(self, device_map=None):
pass
@add_start_docstrings(DEPARALLELIZE_DOCSTRING)
def deparallelize(self):
pass
def set_input_em... | 11 | 1 | 53 | 4 | 42 | 7 | 10 | 0.17 | 1 | 18 | 8 | 0 | 7 | 10 | 8 | 11 | 439 | 42 | 342 | 92 | 299 | 57 | 192 | 58 | 183 | 57 | 2 | 4 | 80 |
5,561 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/tokenization_t5.py | transformers.models.t5.tokenization_t5.T5Tokenizer | import sentencepiece as spm
import warnings
from ...tokenization_utils import PreTrainedTokenizer
import os
from typing import TYPE_CHECKING, Any, Optional
from ...convert_slow_tokenizer import import_protobuf
from shutil import copyfile
from ...tokenization_utils_base import AddedToken
import re
from ...utils.import_u... | @requires(backends=('sentencepiece',))
class T5Tokenizer(PreTrainedTokenizer):
'''
Construct a T5 tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this supercl... | 25 | 10 | 15 | 1 | 10 | 3 | 3 | 0.59 | 1 | 11 | 0 | 1 | 19 | 8 | 20 | 109 | 403 | 63 | 215 | 73 | 173 | 126 | 145 | 50 | 124 | 10 | 3 | 3 | 52 |
5,562 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/t5/tokenization_t5_fast.py | transformers.models.t5.tokenization_t5_fast.T5TokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
import re
from shutil import copyfile
from typing import Optional
import os
import warnings
class T5TokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" T5 tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](h... |
class T5TokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" T5 tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models).
This tokenizer inherits from [`PreTrainedTokenizerFast`]... | 9 | 3 | 18 | 2 | 13 | 3 | 3 | 0.51 | 1 | 10 | 0 | 1 | 7 | 2 | 8 | 96 | 194 | 29 | 109 | 36 | 83 | 56 | 54 | 19 | 45 | 5 | 3 | 2 | 22 |
5,563 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/configuration_table_transformer.py | transformers.models.table_transformer.configuration_table_transformer.TableTransformerConfig | from ..auto import CONFIG_MAPPING
from ...utils.backbone_utils import verify_backbone_config_arguments
from ...configuration_utils import PretrainedConfig
class TableTransformerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`TableTransformerModel`]. It is used to... |
class TableTransformerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`TableTransformerModel`]. It is used to
instantiate a Table Transformer model according to the specified arguments, defining the model architecture.
Instantiating a configuration with th... | 8 | 1 | 36 | 1 | 33 | 2 | 3 | 0.93 | 1 | 3 | 0 | 0 | 3 | 34 | 3 | 3 | 223 | 13 | 109 | 82 | 66 | 101 | 59 | 43 | 55 | 6 | 1 | 2 | 8 |
5,564 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/configuration_table_transformer.py | transformers.models.table_transformer.configuration_table_transformer.TableTransformerOnnxConfig | from packaging import version
from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
class TableTransformerOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
retur... |
class TableTransformerOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass
@property
def default_onnx_opset(self) -> int:
pass | 7 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 3 | 0 | 3 | 3 | 19 | 3 | 16 | 8 | 9 | 0 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
5,565 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerAttention | from torch import Tensor, nn
import torch
from typing import Optional, Union
class TableTransformerAttention(nn.Module):
"""
Multi-headed attention from 'Attention Is All You Need' paper.
Here, we add position embeddings to the queries and keys (as explained in the TABLE_TRANSFORMER paper).
"""
d... |
class TableTransformerAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper.
Here, we add position embeddings to the queries and keys (as explained in the TABLE_TRANSFORMER paper).
'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, bias: bo... | 5 | 2 | 29 | 4 | 22 | 3 | 4 | 0.19 | 1 | 6 | 0 | 0 | 4 | 9 | 4 | 14 | 127 | 22 | 88 | 41 | 69 | 17 | 60 | 27 | 55 | 9 | 1 | 2 | 14 |
5,566 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerConvEncoder | from torch import Tensor, nn
import torch
from ...utils.backbone_utils import load_backbone
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
class TableTransformerConvEncoder(nn.Module):
"""
Convolutional backbone, using either the AutoBackbone API or one from the... |
class TableTransformerConvEncoder(nn.Module):
'''
Convolutional backbone, using either the AutoBackbone API or one from the timm library.
nn.BatchNorm2d layers are replaced by TableTransformerFrozenBatchNorm2d as defined above.
'''
def __init__(self, config):
pass
def forward(self, pi... | 3 | 1 | 31 | 3 | 25 | 3 | 8 | 0.2 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 70 | 10 | 50 | 16 | 47 | 10 | 37 | 16 | 34 | 12 | 1 | 4 | 15 |
5,567 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerConvModel | from torch import Tensor, nn
class TableTransformerConvModel(nn.Module):
"""
This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder.
"""
def __init__(self, conv_encoder, position_embedding):
super().__init__()
self.conv_encoder = conv_enco... |
class TableTransformerConvModel(nn.Module):
'''
This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder.
'''
def __init__(self, conv_encoder, position_embedding):
pass
def forward(self, pixel_values, pixel_mask):
pass | 3 | 1 | 7 | 1 | 5 | 1 | 2 | 0.45 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 3 | 11 | 8 | 8 | 5 | 11 | 8 | 8 | 2 | 1 | 1 | 3 |
5,568 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerDecoder | from .configuration_table_transformer import TableTransformerConfig
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
import torch
from torch import Tensor, nn
class TableTransformerDecoder(TableTransformerPreTrainedModel):
"""
Transformer decoder consisting of *config.decoder_layers* layers. ... |
class TableTransformerDecoder(TableTransformerPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`TableTransformerDecoderLayer`].
The decoder updates the query embeddings through multiple self-attention and cross-attention layers.
Some small tweaks ... | 3 | 2 | 79 | 12 | 47 | 21 | 12 | 0.53 | 1 | 7 | 3 | 0 | 2 | 5 | 2 | 3 | 174 | 30 | 94 | 29 | 80 | 50 | 51 | 18 | 48 | 22 | 2 | 3 | 23 |
5,569 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerDecoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...activations import ACT2FN
from typing import Optional, Union
from .configuration_table_transformer import TableTransformerConfig
import torch
from torch import Tensor, nn
class TableTransformerDecoderLayer(GradientCheckpointingLayer):
def __init__(... |
class TableTransformerDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: TableTransformerConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, object_queries: Optional[torch.Tensor]=None, query_position_embeddings: Optional[torch.T... | 3 | 1 | 51 | 6 | 33 | 12 | 2 | 0.37 | 1 | 5 | 2 | 0 | 2 | 11 | 2 | 12 | 105 | 13 | 67 | 27 | 55 | 25 | 38 | 18 | 35 | 3 | 1 | 1 | 4 |
5,570 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerDecoderOutput | from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_int... | @dataclass
@auto_docstring(custom_intro='\n Base class for outputs of the TABLE_TRANSFORMER decoder. This class adds one attribute to BaseModelOutputWithCrossAttentions,\n namely an optional stack of intermediate decoder activations, i.e. the output of each decoder layer, each of them\n gone through a layernor... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 11.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 27 | 2 | 2 | 2 | 1 | 23 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
5,571 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerEncoder | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
from .configuration_table_transformer import TableTransformerConfig
from torch import Tensor, nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
import torch
class TableTransformerEncoder(TableTra... |
class TableTransformerEncoder(TableTransformerPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`TableTransformerEncoderLayer`].
The encoder updates the flattened feature map through multiple self-attention layers.
Small tweak fo... | 3 | 2 | 49 | 9 | 28 | 13 | 8 | 0.63 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 114 | 24 | 56 | 22 | 45 | 35 | 38 | 14 | 35 | 15 | 2 | 3 | 16 |
5,572 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerEncoderLayer | from .configuration_table_transformer import TableTransformerConfig
from torch import Tensor, nn
import torch
from ...activations import ACT2FN
from typing import Optional, Union
class TableTransformerEncoderLayer(nn.Module):
def __init__(self, config: TableTransformerConfig):
super().__init__()
s... |
class TableTransformerEncoderLayer(nn.Module):
def __init__(self, config: TableTransformerConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, object_queries: Optional[torch.Tensor]=None, output_attentions: bool=False):
'''
Args:
hidde... | 3 | 1 | 34 | 5 | 24 | 6 | 3 | 0.25 | 1 | 5 | 2 | 0 | 2 | 9 | 2 | 12 | 71 | 11 | 48 | 22 | 39 | 12 | 33 | 16 | 30 | 4 | 1 | 2 | 5 |
5,573 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerForObjectDetection | import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from torch import Tensor, nn
from .configuration_table_transformer import TableTransformerConfig
@auto_docstring(custom_intro='\n Table Transformer Model (consisting of a b... | null | 5 | 1 | 61 | 9 | 34 | 19 | 5 | 0.55 | 1 | 6 | 4 | 0 | 2 | 3 | 2 | 3 | 127 | 18 | 71 | 27 | 54 | 39 | 27 | 14 | 24 | 8 | 2 | 2 | 9 |
5,574 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerFrozenBatchNorm2d | import torch
from torch import Tensor, nn
class TableTransformerFrozenBatchNorm2d(nn.Module):
"""
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
torchvision.models.resnet[... |
class TableTransformerFrozenBatchNorm2d(nn.Module):
'''
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
torchvision.models.resnet[18,34,50,101] produce nans.
'''
de... | 4 | 1 | 9 | 0 | 8 | 1 | 1 | 0.28 | 1 | 1 | 0 | 0 | 3 | 0 | 3 | 13 | 37 | 5 | 25 | 13 | 19 | 7 | 21 | 11 | 17 | 2 | 1 | 1 | 4 |
5,575 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerLearnedPositionEmbedding | import torch
from torch import Tensor, nn
class TableTransformerLearnedPositionEmbedding(nn.Module):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, embedding_dim=256):
super().__init__()
self.row_embeddings = nn.Embedding(50, embedding_d... |
class TableTransformerLearnedPositionEmbedding(nn.Module):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, embedding_dim=256):
pass
def forward(self, pixel_values, pixel_mask=None):
pass | 3 | 1 | 8 | 0 | 8 | 0 | 1 | 0.19 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 21 | 2 | 16 | 11 | 13 | 3 | 16 | 11 | 13 | 1 | 1 | 0 | 2 |
5,576 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerMLPPredictionHead | from torch import Tensor, nn
class TableTransformerMLPPredictionHead(nn.Module):
"""
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/table_t... |
class TableTransformerMLPPredictionHead(nn.Module):
'''
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/table_transformer/blob/master/models/... | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.5 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 4 | 10 | 7 | 7 | 5 | 10 | 7 | 7 | 3 | 1 | 1 | 4 |
5,577 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerModel | from torch import Tensor, nn
import torch
from .configuration_table_transformer import TableTransformerConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from typin... | null | 8 | 1 | 25 | 4 | 15 | 6 | 3 | 0.41 | 1 | 10 | 7 | 0 | 6 | 5 | 6 | 7 | 160 | 30 | 92 | 39 | 72 | 38 | 46 | 27 | 39 | 11 | 2 | 1 | 18 |
5,578 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerObjectDetectionOutput | from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
import torch
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`TableTransformerForObjectDetection`].\n ')
class TableTransformerObjectDet... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`TableTransformerForObjectDetection`].\n ')
class TableTransformerObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.46 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 60 | 2 | 13 | 13 | 12 | 45 | 13 | 13 | 12 | 0 | 1 | 0 | 0 |
5,579 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerPreTrainedModel | from .configuration_table_transformer import TableTransformerConfig
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from torch import Tensor, nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class TableTransformerPreTrainedModel(PreTrainedModel):
conf... | @auto_docstring
class TableTransformerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 16 | 1 | 13 | 2 | 6 | 0.09 | 1 | 1 | 1 | 4 | 1 | 0 | 1 | 1 | 26 | 2 | 22 | 7 | 20 | 2 | 17 | 7 | 15 | 6 | 1 | 2 | 6 |
5,580 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/table_transformer/modeling_table_transformer.py | transformers.models.table_transformer.modeling_table_transformer.TableTransformerSinePositionEmbedding | import torch
import math
from torch import Tensor, nn
class TableTransformerSinePositionEmbedding(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one used by the Attention is all you
need paper, generalized to work on images.
"""
def __init__(self, em... |
class TableTransformerSinePositionEmbedding(nn.Module):
'''
This is a more standard version of the position embedding, very similar to the one used by the Attention is all you
need paper, generalized to work on images.
'''
def __init__(self, embedding_dim=64, temperature=10000, normalize=False, sc... | 3 | 1 | 14 | 1 | 13 | 0 | 3 | 0.15 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 35 | 4 | 27 | 13 | 24 | 4 | 27 | 13 | 24 | 3 | 1 | 1 | 6 |
5,581 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/configuration_tapas.py | transformers.models.tapas.configuration_tapas.TapasConfig | from ...configuration_utils import PretrainedConfig
class TapasConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`TapasModel`]. It is used to instantiate a TAPAS
model according to the specified arguments, defining the model architecture. Instantiating a configu... |
class TapasConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`TapasModel`]. It is used to instantiate a TAPAS
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar co... | 2 | 1 | 87 | 4 | 80 | 3 | 2 | 1.27 | 1 | 3 | 0 | 0 | 1 | 36 | 1 | 1 | 199 | 13 | 82 | 79 | 40 | 104 | 42 | 39 | 40 | 2 | 1 | 1 | 2 |
5,582 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.AverageApproximationFunction | import enum
class AverageApproximationFunction(str, enum.Enum):
RATIO = 'ratio'
FIRST_ORDER = 'first_order'
SECOND_ORDER = 'second_order' |
class AverageApproximationFunction(str, enum.Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
5,583 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.IndexMap | import torch
class IndexMap:
"""Index grouping entries within a tensor."""
def __init__(self, indices, num_segments, batch_dims=0):
"""
Creates an index
Args:
indices (`torch.LongTensor`, same shape as a *values* Tensor to which the indices refer):
Tensor c... |
class IndexMap:
'''Index grouping entries within a tensor.'''
def __init__(self, indices, num_segments, batch_dims=0):
'''
Creates an index
Args:
indices (`torch.LongTensor`, same shape as a *values* Tensor to which the indices refer):
Tensor containing the ... | 3 | 2 | 10 | 1 | 3 | 7 | 1 | 2.14 | 0 | 0 | 0 | 1 | 2 | 3 | 2 | 2 | 24 | 3 | 7 | 6 | 4 | 15 | 7 | 6 | 4 | 1 | 0 | 0 | 2 |
5,584 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.ProductIndexMap | import torch
class ProductIndexMap(IndexMap):
"""The product of two indices."""
def __init__(self, outer_index, inner_index):
"""
Combines indices i and j into pairs (i, j). The result is an index where each segment (i, j) is the
intersection of segments i and j. For example if the inp... |
class ProductIndexMap(IndexMap):
'''The product of two indices.'''
def __init__(self, outer_index, inner_index):
'''
Combines indices i and j into pairs (i, j). The result is an index where each segment (i, j) is the
intersection of segments i and j. For example if the inputs represent... | 4 | 4 | 13 | 1 | 7 | 5 | 1 | 0.65 | 1 | 3 | 0 | 0 | 3 | 2 | 3 | 5 | 43 | 5 | 23 | 7 | 19 | 15 | 12 | 7 | 8 | 2 | 1 | 1 | 4 |
5,585 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput | from dataclasses import dataclass
import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n Output type of [`TapasForQuestionAnswering`].\n ')
class TableQuestionAnsweringOutput(ModelOutput):
"""
loss (`torch.Floa... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`TapasForQuestionAnswering`].\n ')
class TableQuestionAnsweringOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` (and possibly `answer`, `aggregation_labels`, `numeric_values` and `numeric_valu... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 27 | 2 | 6 | 6 | 5 | 19 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,586 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasAttention | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from torch import nn
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class TapasAttention(nn.Module):
def __init__(self, config, layer_id... |
class TapasAttention(nn.Module):
def __init__(self, config, layer_idx=None):
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, encoder_hidden_states: Option... | 4 | 0 | 15 | 1 | 13 | 1 | 1 | 0.12 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 41 | 20 | 28 | 5 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
5,587 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasEmbeddings | import torch
from torch import nn
class TapasEmbeddings(nn.Module):
"""
Construct the embeddings from word, position and token_type embeddings. Same as BertEmbeddings but with a number of
additional token type embeddings to encode tabular structure.
"""
def __init__(self, config):
super().... |
class TapasEmbeddings(nn.Module):
'''
Construct the embeddings from word, position and token_type embeddings. Same as BertEmbeddings but with a number of
additional token type embeddings to encode tabular structure.
'''
def __init__(self, config):
pass
def forward(self, input_ids=None... | 3 | 1 | 35 | 6 | 23 | 7 | 5 | 0.39 | 1 | 5 | 2 | 0 | 2 | 6 | 2 | 12 | 77 | 13 | 46 | 24 | 43 | 18 | 41 | 24 | 38 | 8 | 1 | 2 | 10 |
5,588 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasEncoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, SequenceClassifierOutput
from torch import nn
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
class TapasEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config =... |
class TapasEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, past_key_values=None, use_cache=None, output_attentions=False, output_hidden_states=False, return_dict=True, c... | 3 | 0 | 30 | 2 | 28 | 0 | 6 | 0 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 61 | 5 | 56 | 23 | 41 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
5,589 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasForMaskedLM | from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, SequenceClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from .configuration_tapas import TapasConfi... | @auto_docstring
class TapasForMaskedLM(TapasPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attentio... | 7 | 1 | 24 | 4 | 14 | 7 | 2 | 0.48 | 1 | 5 | 3 | 0 | 4 | 2 | 4 | 5 | 107 | 18 | 61 | 32 | 39 | 29 | 27 | 16 | 22 | 5 | 2 | 1 | 8 |
5,590 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasForQuestionAnswering | import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from torch import nn
from .configuration_tapas import TapasConfig
@auto_docstring(custom_intro='\n Tapas Model with a cell selection head and optional aggregation head on top for question-answering tasks on tab... | @auto_docstring(custom_intro='\n Tapas Model with a cell selection head and optional aggregation head on top for question-answering tasks on tables\n (linear layers on top of the hidden-states output to compute `logits` and optional `logits_aggregation`), e.g. for\n SQA, WTQ or WikiSQL-supervised tasks.\n '... | 5 | 1 | 166 | 19 | 110 | 39 | 15 | 0.35 | 1 | 9 | 5 | 0 | 2 | 7 | 2 | 3 | 336 | 38 | 222 | 57 | 200 | 78 | 99 | 39 | 96 | 26 | 2 | 4 | 29 |
5,591 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasForSequenceClassification | import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, SequenceClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from torch import nn
@auto_do... | @auto_docstring(custom_intro='\n Tapas Model with a sequence classification head on top (a linear layer on top of the pooled output), e.g. for table\n entailment tasks, such as TabFact (Chen et al., 2020).\n ')
class TapasForSequenceClassification(TapasPreTrainedModel):
def __init__(self, config):
... | 5 | 1 | 56 | 8 | 33 | 16 | 7 | 0.46 | 1 | 6 | 2 | 0 | 2 | 4 | 2 | 3 | 115 | 16 | 68 | 26 | 51 | 31 | 34 | 13 | 31 | 12 | 2 | 3 | 13 |
5,592 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasIntermediate | from ...activations import ACT2FN
import torch
from torch import nn
class TapasIntermediate(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_a... |
class TapasIntermediate(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,593 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasLMPredictionHead | import torch
from torch import nn
class TapasLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = TapasPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.bias = nn.Parameter(torch.... |
class TapasLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def _tie_weights(self):
pass
def forward(self, hidden_states):
pass | 4 | 0 | 6 | 1 | 4 | 1 | 1 | 0.23 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 21 | 5 | 13 | 7 | 9 | 3 | 13 | 7 | 9 | 1 | 1 | 0 | 3 |
5,594 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasLayer | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class TapasLayer(GradientCheckpointi... |
class TapasLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.13 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 86 | 9 | 70 | 32 | 57 | 9 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
5,595 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, SequenceClassifierOutput
from ...utils import ModelOutput, auto_docstring, logging
import torch
from typing import Optional, Union
@auto_docstring
class TapasModel(TapasPreTrainedModel):
"""
This class is a small chang... | @auto_docstring
class TapasModel(TapasPreTrainedModel):
'''
This class is a small change compared to [`BertModel`], taking into account the additional token type ids.
The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added bet... | 8 | 4 | 27 | 4 | 16 | 7 | 4 | 0.47 | 1 | 8 | 4 | 0 | 5 | 4 | 5 | 6 | 150 | 25 | 85 | 35 | 64 | 40 | 46 | 21 | 40 | 14 | 2 | 2 | 20 |
5,596 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasOnlyMLMHead | import torch
from torch import nn
class TapasOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = TapasLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predictions(sequence_output)
... |
class TapasOnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
5,597 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasOutput | import torch
from torch import nn
class TapasOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout... |
class TapasOutput(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,598 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasPooler | import torch
from torch import nn
class TapasPooler(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... |
class TapasPooler(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,599 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/tapas/modeling_tapas.py | transformers.models.tapas.modeling_tapas.TapasPreTrainedModel | from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_utils import PreTrainedModel
from torch import nn
from .configuration_tapas import TapasConfig
@auto_docstring
class TapasPreTrainedModel(PreTrainedModel):
config: TapasConfig
base_model_prefix = 'tapas'
supports_gradient_checkpoint... | @auto_docstring
class TapasPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.47 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 27 | 2 | 17 | 6 | 15 | 8 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.