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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,200 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertPreTrainedModel | from ...modeling_utils import PreTrainedModel
from .configuration_distilbert import DistilBertConfig
from ...utils import auto_docstring, logging
from torch import nn
@auto_docstring
class DistilBertPreTrainedModel(PreTrainedModel):
config: DistilBertConfig
base_model_prefix = 'distilbert'
supports_gradien... | @auto_docstring
class DistilBertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights.'''
pass | 3 | 1 | 19 | 0 | 16 | 3 | 7 | 0.3 | 1 | 1 | 1 | 6 | 1 | 0 | 1 | 1 | 32 | 2 | 23 | 8 | 21 | 7 | 18 | 8 | 16 | 7 | 1 | 2 | 7 |
2,201 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertSdpaAttention | from ...configuration_utils import PretrainedConfig
import torch
from typing import Optional, Union
class DistilBertSdpaAttention(MultiHeadSelfAttention):
def __init__(self, config: PretrainedConfig):
super().__init__(config=config)
self.dropout_prob = config.attention_dropout
def forward(sel... |
class DistilBertSdpaAttention(MultiHeadSelfAttention):
def __init__(self, config: PretrainedConfig):
pass
def forward(self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor, mask: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> tuple[torch.Tensor, ..... | 5 | 3 | 21 | 2 | 14 | 5 | 2 | 0.34 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 15 | 78 | 10 | 53 | 21 | 40 | 18 | 26 | 13 | 21 | 4 | 2 | 1 | 7 |
2,202 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.Embeddings | from torch import nn
from ...configuration_utils import PretrainedConfig
from typing import Optional, Union
import torch
class Embeddings(nn.Module):
def __init__(self, config: PretrainedConfig):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.dim, padding_idx=conf... |
class Embeddings(nn.Module):
def __init__(self, config: PretrainedConfig):
pass
def forward(self, input_ids: torch.Tensor, input_embeds: Optional[torch.Tensor]=None) -> torch.Tensor:
'''
Parameters:
input_ids (torch.Tensor):
torch.tensor(bs, max_seq_length)... | 3 | 1 | 21 | 4 | 12 | 10 | 2 | 0.79 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 44 | 8 | 24 | 11 | 21 | 19 | 21 | 11 | 18 | 3 | 1 | 1 | 4 |
2,203 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.FFN | import torch
from ...configuration_utils import PretrainedConfig
from ...activations import get_activation
from torch import nn
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class FFN(nn.Module):
def __init__(self, config: PretrainedConfig):
s... |
class FFN(nn.Module):
def __init__(self, config: PretrainedConfig):
pass
def forward(self, input: torch.Tensor) -> torch.Tensor:
pass
def ff_chunk(self, input: torch.Tensor) -> torch.Tensor:
pass | 4 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 3 | 6 | 3 | 13 | 19 | 2 | 17 | 11 | 13 | 0 | 17 | 11 | 13 | 1 | 1 | 0 | 3 |
2,204 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.MultiHeadSelfAttention | from ...configuration_utils import PretrainedConfig
import torch
from typing import Optional, Union
import math
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
class MultiHeadSelfAttention(nn.Module):
def __init__(self, config: Pret... |
class MultiHeadSelfAttention(nn.Module):
def __init__(self, config: PretrainedConfig):
pass
def prune_heads(self, heads: list[int]):
pass
def forward(self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor, mask: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_atte... | 6 | 3 | 21 | 3 | 14 | 7 | 2 | 0.47 | 1 | 6 | 0 | 2 | 3 | 11 | 3 | 13 | 102 | 17 | 66 | 36 | 52 | 31 | 53 | 28 | 47 | 3 | 1 | 1 | 9 |
2,205 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.Transformer | from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
from torch import nn
import torch
from ...configuration_utils import PretrainedConfig
class Transformer(nn.Module)... |
class Transformer(nn.Module):
def __init__(self, config: PretrainedConfig):
pass
def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: Optional[bool]=None) -> Uni... | 3 | 1 | 37 | 4 | 26 | 8 | 6 | 0.29 | 1 | 9 | 2 | 0 | 2 | 3 | 2 | 12 | 75 | 9 | 52 | 20 | 41 | 15 | 29 | 12 | 26 | 11 | 1 | 3 | 12 |
2,206 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.TransformerBlock | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
import torch
from typing import Optional, Union
from ...configuration_utils import PretrainedConfig
class TransformerBlock(GradientCheckpointingLayer):
def __init__(self, config: PretrainedConfig):
super().__init__()
if... |
class TransformerBlock(GradientCheckpointingLayer):
def __init__(self, config: PretrainedConfig):
pass
def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> tuple[torch.Tensor, ...]:
'''
Par... | 3 | 1 | 27 | 4 | 18 | 8 | 3 | 0.43 | 1 | 8 | 1 | 0 | 2 | 4 | 2 | 12 | 56 | 8 | 37 | 17 | 28 | 16 | 23 | 11 | 20 | 4 | 1 | 2 | 6 |
2,207 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/tokenization_distilbert.py | transformers.models.distilbert.tokenization_distilbert.DistilBertTokenizer | from typing import Optional
import os
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import collections
class DistilBertTokenizer(PreTrainedTokenizer):
"""
Construct a DistilBERT tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTo... |
class DistilBertTokenizer(PreTrainedTokenizer):
'''
Construct a DistilBERT tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
v... | 14 | 6 | 15 | 1 | 10 | 4 | 2 | 0.8 | 1 | 9 | 2 | 0 | 12 | 5 | 12 | 101 | 247 | 28 | 122 | 54 | 86 | 98 | 66 | 30 | 53 | 6 | 3 | 3 | 27 |
2,208 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/tokenization_distilbert_fast.py | transformers.models.distilbert.tokenization_distilbert_fast.DistilBertTokenizerFast | from tokenizers import normalizers
from .tokenization_distilbert import DistilBertTokenizer
from typing import Optional
from ...tokenization_utils_fast import PreTrainedTokenizerFast
import json
class DistilBertTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" DistilBERT tokenizer (backed by Huggi... |
class DistilBertTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" DistilBERT tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclass... | 4 | 2 | 24 | 3 | 14 | 7 | 2 | 1.15 | 1 | 4 | 0 | 0 | 4 | 1 | 4 | 92 | 145 | 18 | 59 | 30 | 39 | 68 | 28 | 15 | 23 | 2 | 3 | 1 | 7 |
2,209 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/configuration_donut_swin.py | transformers.models.donut.configuration_donut_swin.DonutSwinConfig | from ...configuration_utils import PretrainedConfig
class DonutSwinConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DonutSwinModel`]. It is used to instantiate a
Donut model according to the specified arguments, defining the model architecture. Instantiating a... |
class DonutSwinConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DonutSwinModel`]. It is used to instantiate a
Donut model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a si... | 2 | 1 | 42 | 1 | 39 | 2 | 1 | 1.18 | 1 | 2 | 0 | 0 | 1 | 18 | 1 | 1 | 109 | 11 | 45 | 41 | 24 | 53 | 23 | 22 | 21 | 1 | 1 | 0 | 1 |
2,210 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/feature_extraction_donut.py | transformers.models.donut.feature_extraction_donut.DonutFeatureExtractor | from ...utils.import_utils import requires
from .image_processing_donut import DonutImageProcessor
import warnings
@requires(backends=('vision',))
class DonutFeatureExtractor(DonutImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class DonutFeatureExtractor is deprecated and... | @requires(backends=('vision',))
class DonutFeatureExtractor(DonutImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 28 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
2,211 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/image_processing_donut.py | transformers.models.donut.image_processing_donut.DonutImageProcessor | from typing import Optional, Union
from ...image_transforms import convert_to_rgb, get_resize_output_image_size, pad, resize, to_channel_dimension_format
from ...utils import TensorType, filter_out_non_signature_kwargs, logging
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ... | @requires(backends=('vision',))
class DonutImageProcessor(BaseImageProcessor):
'''
Constructs a Donut 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
... | 9 | 6 | 52 | 5 | 30 | 17 | 5 | 0.7 | 1 | 10 | 2 | 1 | 7 | 11 | 7 | 27 | 407 | 41 | 216 | 101 | 146 | 151 | 100 | 39 | 92 | 22 | 3 | 1 | 38 |
2,212 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinAttention | from torch import nn
from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
import torch
from typing import Optional, Union
class DonutSwinAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size):
super().__init__()
self.self = DonutSwinSel... |
class DonutSwinAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size):
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, output_atten... | 4 | 0 | 11 | 1 | 10 | 1 | 1 | 0.1 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 36 | 4 | 30 | 17 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,213 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinDropPath | import torch
from torch import nn
from typing import Optional, Union
class DonutSwinDropPath(nn.Module):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
def __init__(self, drop_prob: Optional[float]=None) -> None:
super().__init__()
self.drop_prob... |
class DonutSwinDropPath(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(sel... | 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 |
2,214 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinEmbeddings | from torch import nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
import torch
class DonutSwinEmbeddings(nn.Module):
"""
Construct the patch and position embeddings. Optionally, also the mask token.
"""
def __init__(self, config, use_mask_toke... |
class DonutSwinEmbeddings(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 |
2,215 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinEncoder | import torch
from typing import Optional, Union
from torch import nn
class DonutSwinEncoder(nn.Module):
def __init__(self, config, grid_size):
super().__init__()
self.num_layers = len(config.depths)
self.config = config
dpr = [x.item() for x in torch.linspace(0, config.drop_path_ra... |
class DonutSwinEncoder(nn.Module):
def __init__(self, config, grid_size):
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_states: Optional[bool]=False, output_hid... | 3 | 0 | 49 | 5 | 42 | 2 | 7 | 0.05 | 1 | 10 | 3 | 0 | 2 | 4 | 2 | 12 | 99 | 11 | 84 | 28 | 71 | 4 | 43 | 18 | 40 | 12 | 1 | 2 | 14 |
2,216 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinEncoderOutput | from typing import Optional, Union
from dataclasses import dataclass
import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@dataclass
@auto_docstring(custom_intro="\n DonutSwin encoder's outputs, with potential hidden states and attentions.\n ")
class DonutSwinEncoderOutput(ModelOutpu... | @dataclass
@auto_docstring(custom_intro="\n DonutSwin encoder's outputs, with potential hidden states and attentions.\n ")
class DonutSwinEncoderOutput(ModelOutput):
'''
reshaped_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.outp... | 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 |
2,217 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinIntermediate | from torch import nn
import torch
from ...activations import ACT2FN
class DonutSwinIntermediate(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_act_... |
class DonutSwinIntermediate(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 |
2,218 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinLayer | from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from torch import nn
import torch
class DonutSwinLayer(nn.Module):
def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0):
super().__init__()
self.chunk_s... |
class DonutSwinLayer(nn.Module):
def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0):
pass
def set_shift_and_window_size(self, input_resolution):
pass
def get_attn_mask(self, height, width, dtype, device):
pass
def maybe_pad(self, h... | 6 | 0 | 24 | 3 | 19 | 1 | 3 | 0.06 | 1 | 10 | 4 | 0 | 5 | 10 | 5 | 15 | 123 | 19 | 98 | 49 | 85 | 6 | 73 | 42 | 67 | 6 | 1 | 3 | 16 |
2,219 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinModel | from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
from torch import nn
from typing import Optional, Union
@auto_docstring
class DonutSwinModel(DonutSwinPreTrainedModel):
def __init__(self, config, add_pooling_layer=True, use_mask_token=False):
"""
add_pooling_layer ... | @auto_docstring
class DonutSwinModel(DonutSwinPreTrainedModel):
def __init__(self, config, add_pooling_layer=True, use_mask_token=False):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
use_mask_token (`bool`, *optional*, defaults to ... | 7 | 3 | 21 | 3 | 15 | 4 | 3 | 0.21 | 1 | 7 | 3 | 0 | 4 | 6 | 4 | 5 | 96 | 15 | 67 | 27 | 45 | 14 | 33 | 17 | 28 | 7 | 2 | 1 | 12 |
2,220 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinModelOutput | from typing import Optional, Union
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
@dataclass
@auto_docstring(custom_intro="\n DonutSwin model's outputs that also contains a pooling of the last hidden states.\n ")
class DonutSwinModelOutput(Mode... | @dataclass
@auto_docstring(custom_intro="\n DonutSwin model's outputs that also contains a pooling of the last hidden states.\n ")
class DonutSwinModelOutput(ModelOutput):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*, returned when `add_pooling_layer=True` is pas... | 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 |
2,221 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinOutput | from torch import nn
import torch
class DonutSwinOutput(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) -> torc... |
class DonutSwinOutput(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 |
2,222 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinPatchEmbeddings | from typing import Optional, Union
from torch import nn
import collections.abc
import torch
class DonutSwinPatchEmbeddings(nn.Module):
"""
This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial
`hidden_states` (patch embeddings) of shape `(batch_size, seq_leng... |
class DonutSwinPatchEmbeddings(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, confi... | 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 |
2,223 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinPatchMerging | import torch
from torch import nn
class DonutSwinPatchMerging(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... |
class DonutSwinPatchMerging(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`):
Normaliza... | 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 |
2,224 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinPreTrainedModel | from .configuration_donut_swin import DonutSwinConfig
from ...modeling_utils import PreTrainedModel
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from torch import nn
@auto_docstring
class DonutSwinPreTrainedModel(PreTrainedModel):
config: DonutSwinConfig
base_model_prefix = 'donut'
... | @auto_docstring
class DonutSwinPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.5 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 23 | 2 | 14 | 7 | 12 | 7 | 13 | 7 | 11 | 4 | 1 | 2 | 4 |
2,225 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinSelfAttention | from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
from typing import Optional, Union
import collections.abc
import math
from torch import nn
import torch
class DonutSwinSelfAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size):
super().__in... |
class DonutSwinSelfAttention(nn.Module):
def __init__(self, config, dim, num_heads, window_size):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False) -> tuple[torch.... | 3 | 0 | 32 | 6 | 24 | 2 | 3 | 0.1 | 1 | 6 | 0 | 0 | 3 | 9 | 3 | 13 | 98 | 19 | 72 | 38 | 62 | 7 | 56 | 32 | 52 | 4 | 1 | 1 | 8 |
2,226 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinSelfOutput | from torch import nn
import torch
class DonutSwinSelfOutput(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: torc... |
class DonutSwinSelfOutput(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 |
2,227 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/modeling_donut_swin.py | transformers.models.donut.modeling_donut_swin.DonutSwinStage | from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
import torch
from typing import Optional, Union
class DonutSwinStage(GradientCheckpointingLayer):
def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, downsample):
super().__init__()
self.confi... |
class DonutSwinStage(GradientCheckpointingLayer):
def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, downsample):
pass
def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int], head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional... | 3 | 0 | 28 | 4 | 24 | 1 | 4 | 0.02 | 1 | 7 | 1 | 0 | 2 | 5 | 2 | 12 | 58 | 8 | 49 | 23 | 39 | 1 | 26 | 16 | 23 | 5 | 1 | 1 | 8 |
2,228 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/processing_donut.py | transformers.models.donut.processing_donut.DonutProcessor | from ...image_utils import ImageInput
from typing import Optional, Union
import warnings
from ...tokenization_utils_base import PreTokenizedInput, TextInput
import re
from contextlib import contextmanager
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class DonutProcessor(ProcessorMixin):
... |
class DonutProcessor(ProcessorMixin):
'''
Constructs a Donut processor which wraps a Donut image processor and an XLMRoBERTa tokenizer into a single
processor.
[`DonutProcessor`] offers all the functionalities of [`DonutImageProcessor`] and
[`XLMRobertaTokenizer`/`XLMRobertaTokenizerFast`]. See the... | 12 | 4 | 20 | 2 | 16 | 3 | 4 | 0.29 | 1 | 5 | 1 | 0 | 8 | 2 | 8 | 25 | 192 | 23 | 135 | 39 | 116 | 39 | 95 | 29 | 86 | 16 | 2 | 6 | 35 |
2,229 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/donut/processing_donut.py | transformers.models.donut.processing_donut.DonutProcessorKwargs | from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class DonutProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {} |
class DonutProcessorKwargs(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 |
2,230 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/configuration_dpr.py | transformers.models.dpr.configuration_dpr.DPRConfig | from ...configuration_utils import PretrainedConfig
class DPRConfig(PretrainedConfig):
"""
[`DPRConfig`] is the configuration class to store the configuration of a *DPRModel*.
This is the configuration class to store the configuration of a [`DPRContextEncoder`], [`DPRQuestionEncoder`], or a
[`DPRReade... |
class DPRConfig(PretrainedConfig):
'''
[`DPRConfig`] is the configuration class to store the configuration of a *DPRModel*.
This is the configuration class to store the configuration of a [`DPRContextEncoder`], [`DPRQuestionEncoder`], or a
[`DPRReader`]. It is used to instantiate the components of the ... | 2 | 1 | 35 | 1 | 34 | 0 | 1 | 1.61 | 1 | 2 | 0 | 0 | 1 | 14 | 1 | 1 | 105 | 11 | 36 | 35 | 16 | 58 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
2,231 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/convert_dpr_original_checkpoint_to_pytorch.py | transformers.models.dpr.convert_dpr_original_checkpoint_to_pytorch.DPRContextEncoderState | from transformers import BertConfig, DPRConfig, DPRContextEncoder, DPRQuestionEncoder, DPRReader
class DPRContextEncoderState(DPRState):
def load_dpr_model(self):
model = DPRContextEncoder(DPRConfig(**BertConfig.get_config_dict('google-bert/bert-base-uncased')[0]))
print(f'Loading DPR biencoder fr... |
class DPRContextEncoderState(DPRState):
def load_dpr_model(self):
pass | 2 | 0 | 15 | 0 | 14 | 1 | 4 | 0.07 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 4 | 16 | 0 | 15 | 7 | 13 | 1 | 15 | 7 | 13 | 4 | 1 | 3 | 4 |
2,232 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/convert_dpr_original_checkpoint_to_pytorch.py | transformers.models.dpr.convert_dpr_original_checkpoint_to_pytorch.DPRQuestionEncoderState | from transformers import BertConfig, DPRConfig, DPRContextEncoder, DPRQuestionEncoder, DPRReader
class DPRQuestionEncoderState(DPRState):
def load_dpr_model(self):
model = DPRQuestionEncoder(DPRConfig(**BertConfig.get_config_dict('google-bert/bert-base-uncased')[0]))
print(f'Loading DPR biencoder ... |
class DPRQuestionEncoderState(DPRState):
def load_dpr_model(self):
pass | 2 | 0 | 15 | 0 | 14 | 1 | 4 | 0.07 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 4 | 16 | 0 | 15 | 7 | 13 | 1 | 15 | 7 | 13 | 4 | 1 | 3 | 4 |
2,233 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/convert_dpr_original_checkpoint_to_pytorch.py | transformers.models.dpr.convert_dpr_original_checkpoint_to_pytorch.DPRReaderState | from transformers import BertConfig, DPRConfig, DPRContextEncoder, DPRQuestionEncoder, DPRReader
class DPRReaderState(DPRState):
def load_dpr_model(self):
model = DPRReader(DPRConfig(**BertConfig.get_config_dict('google-bert/bert-base-uncased')[0]))
print(f'Loading DPR reader from {self.src_file}'... |
class DPRReaderState(DPRState):
def load_dpr_model(self):
pass | 2 | 0 | 14 | 0 | 13 | 1 | 3 | 0.07 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 4 | 15 | 0 | 14 | 6 | 12 | 1 | 12 | 6 | 10 | 3 | 1 | 2 | 3 |
2,234 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/convert_dpr_original_checkpoint_to_pytorch.py | transformers.models.dpr.convert_dpr_original_checkpoint_to_pytorch.DPRState | from pathlib import Path
class DPRState:
def __init__(self, src_file: Path):
self.src_file = src_file
def load_dpr_model(self):
raise NotImplementedError
@staticmethod
def from_type(comp_type: str, *args, **kwargs) -> 'DPRState':
if comp_type.startswith('c'):
retu... |
class DPRState:
def __init__(self, src_file: Path):
pass
def load_dpr_model(self):
pass
@staticmethod
def from_type(comp_type: str, *args, **kwargs) -> 'DPRState':
pass | 5 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 7 | 3 | 3 | 2 | 1 | 3 | 3 | 17 | 2 | 15 | 6 | 10 | 0 | 13 | 5 | 9 | 4 | 0 | 1 | 6 |
2,235 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRContextEncoder | from .configuration_dpr import DPRConfig
from typing import Optional, Union
from torch import Tensor, nn
import torch
from ...utils import ModelOutput, auto_docstring, logging
@auto_docstring(custom_intro='\n The bare DPRContextEncoder transformer outputting pooler outputs as context representations.\n ')
class ... | @auto_docstring(custom_intro='\n The bare DPRContextEncoder transformer outputting pooler outputs as context representations.\n ')
class DPRContextEncoder(DPRPretrainedContextEncoder):
def __init__(self, config: DPRConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[Tensor]=No... | 5 | 1 | 36 | 5 | 26 | 6 | 7 | 0.2 | 1 | 7 | 3 | 0 | 2 | 2 | 2 | 3 | 75 | 10 | 54 | 18 | 40 | 11 | 24 | 8 | 21 | 12 | 3 | 1 | 13 |
2,236 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRContextEncoderOutput | import torch
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`DPRQuestionEncoder`].\n ')
class DPRContextEncoderOutput(ModelOutput):
"""
pooler_output (`torch.F... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`DPRQuestionEncoder`].\n ')
class DPRContextEncoderOutput(ModelOutput):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, embeddings_size)`):
The DPR encoder outputs the *pooler_output* that corresponds to the context re... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 4 | 4 | 3 | 3 | 17 | 4 | 3 | 3 | 0 | 1 | 0 | 0 |
2,237 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPREncoder | from torch import Tensor, nn
from typing import Optional, Union
from ..bert.modeling_bert import BertModel
from .configuration_dpr import DPRConfig
from ...modeling_outputs import BaseModelOutputWithPooling
class DPREncoder(DPRPreTrainedModel):
base_model_prefix = 'bert_model'
def __init__(self, config: DPRCo... |
class DPREncoder(DPRPreTrainedModel):
def __init__(self, config: DPRConfig):
pass
def forward(self, input_ids: Tensor, attention_mask: Optional[Tensor]=None, token_type_ids: Optional[Tensor]=None, inputs_embeds: Optional[Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, r... | 5 | 0 | 16 | 1 | 15 | 0 | 3 | 0.02 | 1 | 8 | 3 | 0 | 3 | 3 | 3 | 4 | 54 | 6 | 47 | 21 | 33 | 1 | 24 | 11 | 20 | 3 | 2 | 1 | 8 |
2,238 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRPreTrainedModel | from ...modeling_utils import PreTrainedModel
from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, logging
@auto_docstring
class DPRPreTrainedModel(PreTrainedModel):
_supports_sdpa = True
def _init_weights(self, module):
"""Initialize the weights"""
if isinstance(modu... | @auto_docstring
class DPRPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.21 | 1 | 0 | 0 | 5 | 1 | 0 | 1 | 1 | 18 | 1 | 14 | 3 | 12 | 3 | 12 | 3 | 10 | 6 | 1 | 2 | 6 |
2,239 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRPretrainedContextEncoder | from .configuration_dpr import DPRConfig
class DPRPretrainedContextEncoder(DPRPreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config: DPRConfig
base_model_prefix = 'ctx_encoder' |
class DPRPretrainedContextEncoder(DPRPreTrainedModel):
'''
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 9 | 1 | 4 | 4 | 3 | 4 | 4 | 4 | 3 | 0 | 2 | 0 | 0 |
2,240 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRPretrainedQuestionEncoder | from .configuration_dpr import DPRConfig
class DPRPretrainedQuestionEncoder(DPRPreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config: DPRConfig
base_model_prefix = 'question_encoder' |
class DPRPretrainedQuestionEncoder(DPRPreTrainedModel):
'''
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 9 | 1 | 4 | 4 | 3 | 4 | 4 | 4 | 3 | 0 | 2 | 0 | 0 |
2,241 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRPretrainedReader | from .configuration_dpr import DPRConfig
class DPRPretrainedReader(DPRPreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config: DPRConfig
base_model_prefix = 'span_predictor' |
class DPRPretrainedReader(DPRPreTrainedModel):
'''
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 9 | 1 | 4 | 4 | 3 | 4 | 4 | 4 | 3 | 0 | 2 | 0 | 0 |
2,242 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRQuestionEncoder | from .configuration_dpr import DPRConfig
from ...utils import ModelOutput, auto_docstring, logging
from torch import Tensor, nn
from typing import Optional, Union
import torch
@auto_docstring(custom_intro='\n The bare DPRQuestionEncoder transformer outputting pooler outputs as question representations.\n ')
clas... | @auto_docstring(custom_intro='\n The bare DPRQuestionEncoder transformer outputting pooler outputs as question representations.\n ')
class DPRQuestionEncoder(DPRPretrainedQuestionEncoder):
def __init__(self, config: DPRConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[Tensor... | 5 | 1 | 36 | 4 | 26 | 6 | 7 | 0.22 | 1 | 7 | 3 | 0 | 2 | 2 | 2 | 3 | 76 | 9 | 55 | 18 | 41 | 12 | 25 | 8 | 22 | 12 | 3 | 1 | 13 |
2,243 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRQuestionEncoderOutput | import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`DPRQuestionEncoder`].\n ')
class DPRQuestionEncoderOutput(ModelOutput):
"""
pooler_output (`torch.... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`DPRQuestionEncoder`].\n ')
class DPRQuestionEncoderOutput(ModelOutput):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, embeddings_size)`):
The DPR encoder outputs the *pooler_output* that corresponds to the question ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 4 | 4 | 3 | 3 | 17 | 4 | 3 | 3 | 0 | 1 | 0 | 0 |
2,244 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRReader | import torch
from ...utils import ModelOutput, auto_docstring, logging
from .configuration_dpr import DPRConfig
from typing import Optional, Union
from torch import Tensor, nn
@auto_docstring(custom_intro='\n The bare DPRReader transformer outputting span predictions.\n ')
class DPRReader(DPRPretrainedReader):
... | null | 5 | 1 | 33 | 4 | 20 | 10 | 5 | 0.48 | 1 | 7 | 3 | 0 | 2 | 2 | 2 | 3 | 70 | 8 | 42 | 16 | 29 | 20 | 20 | 7 | 17 | 9 | 3 | 1 | 10 |
2,245 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRReaderOutput | import torch
from typing import Optional, Union
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`DPRQuestionEncoder`].\n ')
class DPRReaderOutput(ModelOutput):
"""
start_logits (`torch.FloatTenso... | null | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 30 | 4 | 6 | 5 | 5 | 20 | 6 | 5 | 5 | 0 | 1 | 0 | 0 |
2,246 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/modeling_dpr.py | transformers.models.dpr.modeling_dpr.DPRSpanPredictor | from .configuration_dpr import DPRConfig
from torch import Tensor, nn
from typing import Optional, Union
class DPRSpanPredictor(DPRPreTrainedModel):
base_model_prefix = 'encoder'
def __init__(self, config: DPRConfig):
super().__init__(config)
self.encoder = DPREncoder(config)
self.qa_o... |
class DPRSpanPredictor(DPRPreTrainedModel):
def __init__(self, config: DPRConfig):
pass
def forward(self, input_ids: Tensor, attention_mask: Tensor, inputs_embeds: Optional[Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=False) -> Union[DPRReaderOutput... | 3 | 0 | 26 | 2 | 21 | 3 | 2 | 0.11 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 3 | 55 | 6 | 44 | 21 | 33 | 5 | 23 | 13 | 20 | 3 | 2 | 1 | 4 |
2,247 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr.py | transformers.models.dpr.tokenization_dpr.CustomDPRReaderTokenizerMixin | from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from typing import Optional, Union
from ...tokenization_utils_base import BatchEncoding
@add_start_docstrings(CUSTOM_DPR_READER_DOCSTRING)
class CustomDPRReaderTokenizerMixin:
def __call__(self, questions, titles: Optional[str]=Non... | null | 5 | 2 | 56 | 2 | 43 | 11 | 8 | 0.25 | 0 | 10 | 1 | 1 | 3 | 0 | 3 | 3 | 170 | 9 | 130 | 52 | 102 | 32 | 60 | 28 | 56 | 11 | 0 | 2 | 24 |
2,248 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr.py | transformers.models.dpr.tokenization_dpr.DPRContextEncoderTokenizer | from ..bert.tokenization_bert import BertTokenizer
class DPRContextEncoderTokenizer(BertTokenizer):
"""
Construct a DPRContextEncoder tokenizer.
[`DPRContextEncoderTokenizer`] is identical to [`BertTokenizer`] and runs end-to-end tokenization: punctuation
splitting and wordpiece.
Refer to supercl... |
class DPRContextEncoderTokenizer(BertTokenizer):
'''
Construct a DPRContextEncoder tokenizer.
[`DPRContextEncoderTokenizer`] is identical to [`BertTokenizer`] and runs end-to-end tokenization: punctuation
splitting and wordpiece.
Refer to superclass [`BertTokenizer`] for usage examples and document... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 101 | 11 | 3 | 2 | 2 | 1 | 6 | 2 | 2 | 1 | 0 | 4 | 0 | 0 |
2,249 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr.py | transformers.models.dpr.tokenization_dpr.DPRQuestionEncoderTokenizer | from ..bert.tokenization_bert import BertTokenizer
class DPRQuestionEncoderTokenizer(BertTokenizer):
"""
Constructs a DPRQuestionEncoder tokenizer.
[`DPRQuestionEncoderTokenizer`] is identical to [`BertTokenizer`] and runs end-to-end tokenization: punctuation
splitting and wordpiece.
Refer to sup... |
class DPRQuestionEncoderTokenizer(BertTokenizer):
'''
Constructs a DPRQuestionEncoder tokenizer.
[`DPRQuestionEncoderTokenizer`] is identical to [`BertTokenizer`] and runs end-to-end tokenization: punctuation
splitting and wordpiece.
Refer to superclass [`BertTokenizer`] for usage examples and docu... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 101 | 11 | 3 | 2 | 2 | 1 | 6 | 2 | 2 | 1 | 0 | 4 | 0 | 0 |
2,250 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr.py | transformers.models.dpr.tokenization_dpr.DPRReaderTokenizer | from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from ..bert.tokenization_bert import BertTokenizer
@add_end_docstrings(CUSTOM_DPR_READER_DOCSTRING)
class DPRReaderTokenizer(CustomDPRReaderTokenizerMixin, BertTokenizer):
"""
Construct a DPRReader tokenizer.
[`DPRReaderTok... | @add_end_docstrings(CUSTOM_DPR_READER_DOCSTRING)
class DPRReaderTokenizer(CustomDPRReaderTokenizerMixin, BertTokenizer):
'''
Construct a DPRReader tokenizer.
[`DPRReaderTokenizer`] is almost identical to [`BertTokenizer`] and runs end-to-end tokenization: punctuation
splitting and wordpiece. The differe... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 2.33 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 104 | 13 | 3 | 3 | 3 | 2 | 7 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
2,251 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr_fast.py | transformers.models.dpr.tokenization_dpr_fast.CustomDPRReaderTokenizerMixin | from typing import Optional, Union
from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from ...tokenization_utils_base import BatchEncoding
@add_start_docstrings(CUSTOM_DPR_READER_DOCSTRING)
class CustomDPRReaderTokenizerMixin:
def __call__(self, questions, titles: Optional[str]=Non... | null | 5 | 2 | 55 | 2 | 42 | 11 | 7 | 0.25 | 0 | 9 | 1 | 1 | 3 | 0 | 3 | 3 | 167 | 9 | 127 | 52 | 99 | 32 | 57 | 28 | 53 | 10 | 0 | 2 | 21 |
2,252 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr_fast.py | transformers.models.dpr.tokenization_dpr_fast.DPRContextEncoderTokenizerFast | from ..bert.tokenization_bert_fast import BertTokenizerFast
from .tokenization_dpr import DPRContextEncoderTokenizer, DPRQuestionEncoderTokenizer, DPRReaderTokenizer
class DPRContextEncoderTokenizerFast(BertTokenizerFast):
"""
Construct a "fast" DPRContextEncoder tokenizer (backed by HuggingFace's *tokenizers*... |
class DPRContextEncoderTokenizerFast(BertTokenizerFast):
'''
Construct a "fast" DPRContextEncoder tokenizer (backed by HuggingFace's *tokenizers* library).
[`DPRContextEncoderTokenizerFast`] is identical to [`BertTokenizerFast`] and runs end-to-end tokenization:
punctuation splitting and wordpiece.
... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 92 | 12 | 3 | 3 | 3 | 2 | 6 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
2,253 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr_fast.py | transformers.models.dpr.tokenization_dpr_fast.DPRQuestionEncoderTokenizerFast | from ..bert.tokenization_bert_fast import BertTokenizerFast
from .tokenization_dpr import DPRContextEncoderTokenizer, DPRQuestionEncoderTokenizer, DPRReaderTokenizer
class DPRQuestionEncoderTokenizerFast(BertTokenizerFast):
"""
Constructs a "fast" DPRQuestionEncoder tokenizer (backed by HuggingFace's *tokenize... |
class DPRQuestionEncoderTokenizerFast(BertTokenizerFast):
'''
Constructs a "fast" DPRQuestionEncoder tokenizer (backed by HuggingFace's *tokenizers* library).
[`DPRQuestionEncoderTokenizerFast`] is identical to [`BertTokenizerFast`] and runs end-to-end tokenization:
punctuation splitting and wordpiece.... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 92 | 12 | 3 | 3 | 3 | 2 | 6 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
2,254 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpr/tokenization_dpr_fast.py | transformers.models.dpr.tokenization_dpr_fast.DPRReaderTokenizerFast | from ..bert.tokenization_bert_fast import BertTokenizerFast
from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from .tokenization_dpr import DPRContextEncoderTokenizer, DPRQuestionEncoderTokenizer, DPRReaderTokenizer
@add_end_docstrings(CUSTOM_DPR_READER_DOCSTRING)
class DPRReaderTokeni... | @add_end_docstrings(CUSTOM_DPR_READER_DOCSTRING)
class DPRReaderTokenizerFast(CustomDPRReaderTokenizerMixin, BertTokenizerFast):
'''
Constructs a "fast" DPRReader tokenizer (backed by HuggingFace's *tokenizers* library).
[`DPRReaderTokenizerFast`] is almost identical to [`BertTokenizerFast`] and runs end-to... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1.75 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 95 | 15 | 4 | 4 | 4 | 3 | 7 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
2,255 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/configuration_dpt.py | transformers.models.dpt.configuration_dpt.DPTConfig | from ...utils.backbone_utils import verify_backbone_config_arguments
from ..auto.configuration_auto import CONFIG_MAPPING
from ..bit import BitConfig
import copy
from ...configuration_utils import PretrainedConfig
class DPTConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration... | null | 5 | 2 | 72 | 7 | 62 | 4 | 6 | 0.84 | 1 | 4 | 1 | 0 | 2 | 35 | 2 | 2 | 255 | 25 | 125 | 80 | 85 | 105 | 70 | 43 | 67 | 10 | 1 | 2 | 12 |
2,256 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/feature_extraction_dpt.py | transformers.models.dpt.feature_extraction_dpt.DPTFeatureExtractor | from .image_processing_dpt import DPTImageProcessor
from ...utils.import_utils import requires
import warnings
@requires(backends=('vision',))
class DPTFeatureExtractor(DPTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class DPTFeatureExtractor is deprecated and will be r... | @requires(backends=('vision',))
class DPTFeatureExtractor(DPTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 32 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
2,257 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/image_processing_dpt.py | transformers.models.dpt.image_processing_dpt.DPTImageProcessor | from ...utils.import_utils import requires
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, is_torch_available, is_torch_tensor, make_flat_list_of_images, to_numpy_array, valid_ima... | @requires(backends=('vision',))
class DPTImageProcessor(BaseImageProcessor):
'''
Constructs a DPT image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions. Can be overridden by `do_resize` in `preprocess`.
... | 15 | 8 | 43 | 3 | 29 | 11 | 4 | 0.52 | 1 | 10 | 2 | 1 | 11 | 13 | 11 | 31 | 570 | 50 | 342 | 146 | 228 | 178 | 136 | 45 | 123 | 17 | 3 | 2 | 52 |
2,258 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTAuxiliaryHead | from .configuration_dpt import DPTConfig
import torch
from torch import nn
class DPTAuxiliaryHead(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
features = config.fusion_hidden_size
self.head = nn.Sequential(nn.Conv2d(features, features, kernel_size=3, padding=1, bia... |
class DPTAuxiliaryHead(nn.Module):
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 1 | 7 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 17 | 3 | 14 | 6 | 11 | 0 | 8 | 6 | 5 | 1 | 1 | 0 | 2 |
2,259 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTDepthEstimationHead | import torch
from torch import nn
from .configuration_dpt import DPTConfig
class DPTDepthEstimationHead(nn.Module):
"""
Output head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples
the predictions to the input resolution after the first convolutional layer (... |
class DPTDepthEstimationHead(nn.Module):
'''
Output head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples
the predictions to the input resolution after the first convolutional layer (details can be found in the paper's
supplementary material).
'''
... | 3 | 1 | 16 | 4 | 12 | 1 | 2 | 0.25 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 39 | 9 | 24 | 8 | 21 | 6 | 17 | 8 | 14 | 2 | 1 | 1 | 4 |
2,260 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTFeatureFusionLayer | from .configuration_dpt import DPTConfig
from typing import Callable, Optional
import torch
from torch import nn
class DPTFeatureFusionLayer(nn.Module):
"""Feature fusion layer, merges feature maps from different stages.
Args:
config (`[DPTConfig]`):
Model configuration class defining the ... |
class DPTFeatureFusionLayer(nn.Module):
'''Feature fusion layer, merges feature maps from different stages.
Args:
config (`[DPTConfig]`):
Model configuration class defining the model architecture.
align_corners (`bool`, *optional*, defaults to `True`):
The align_corner s... | 3 | 1 | 12 | 3 | 10 | 0 | 2 | 0.35 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 35 | 8 | 20 | 7 | 17 | 7 | 16 | 7 | 13 | 3 | 1 | 2 | 4 |
2,261 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTFeatureFusionStage | from torch import nn
from .configuration_dpt import DPTConfig
class DPTFeatureFusionStage(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
self.layers = nn.ModuleList()
for _ in range(len(config.neck_hidden_sizes)):
self.layers.append(DPTFeatureFusionLayer(... |
class DPTFeatureFusionStage(nn.Module):
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 1 | 8 | 1 | 3 | 0.12 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 12 | 22 | 3 | 17 | 8 | 14 | 2 | 16 | 8 | 13 | 3 | 1 | 2 | 5 |
2,262 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTForDepthEstimation | from ...utils import ModelOutput, auto_docstring, logging, torch_int
from ...utils.backbone_utils import load_backbone
from ...utils.generic import can_return_tuple, check_model_inputs
import torch
from typing import Callable, Optional
from ...modeling_outputs import BaseModelOutput, DepthEstimatorOutput, SemanticSegme... | @auto_docstring(custom_intro='\n DPT Model with a depth estimation head on top (consisting of 3 convolutional layers) e.g. for KITTI, NYUv2.\n ')
class DPTForDepthEstimation(DPTPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_val... | 6 | 1 | 64 | 10 | 37 | 18 | 8 | 0.47 | 1 | 10 | 4 | 0 | 2 | 4 | 2 | 3 | 132 | 21 | 76 | 26 | 63 | 36 | 41 | 16 | 38 | 14 | 2 | 2 | 16 |
2,263 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTForSemanticSegmentation | import torch
from typing import Callable, Optional
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from torch.nn import CrossEntropyLoss
from .configuration_dpt import DPTConfig
from torch import nn
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import Ba... | @auto_docstring
class DPTForSemanticSegmentation(DPTPreTrainedModel):
def __init__(self, config: DPTConfig):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, labels: Optional[torch.LongTensor]=N... | 6 | 1 | 58 | 11 | 35 | 13 | 8 | 0.36 | 1 | 11 | 5 | 0 | 2 | 4 | 2 | 3 | 120 | 22 | 73 | 29 | 60 | 26 | 40 | 19 | 37 | 14 | 2 | 2 | 16 |
2,264 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTModel | from ...modeling_outputs import BaseModelOutput, DepthEstimatorOutput, SemanticSegmenterOutput
from .configuration_dpt import DPTConfig
from ...utils.generic import can_return_tuple, check_model_inputs
import torch
from torch import nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing imp... | @auto_docstring
class DPTModel(DPTPreTrainedModel):
def __init__(self, config: DPTConfig, add_pooling_layer: bool=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(self):
pas... | 8 | 2 | 19 | 3 | 14 | 3 | 4 | 0.17 | 1 | 7 | 5 | 0 | 4 | 5 | 4 | 5 | 88 | 13 | 64 | 25 | 44 | 11 | 33 | 17 | 28 | 8 | 2 | 1 | 15 |
2,265 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTNeck | from typing import Callable, Optional
from torch import nn
from .configuration_dpt import DPTConfig
import torch
class DPTNeck(nn.Module):
"""
DPTNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as
input and produces another list of tensors as out... |
class DPTNeck(nn.Module):
'''
DPTNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as
input and produces another list of tensors as output. For DPT, it includes 2 stages:
* DPTReassembleStage
* DPTFeatureFusionStage.
Args:
confi... | 3 | 2 | 19 | 4 | 11 | 5 | 4 | 0.77 | 1 | 9 | 2 | 0 | 2 | 4 | 2 | 12 | 51 | 12 | 22 | 10 | 19 | 17 | 21 | 10 | 18 | 4 | 1 | 1 | 7 |
2,266 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTPreActResidualLayer | from torch import nn
import torch
from .configuration_dpt import DPTConfig
class DPTPreActResidualLayer(nn.Module):
"""
ResidualConvUnit, pre-activate residual unit.
Args:
config (`[DPTConfig]`):
Model configuration class defining the model architecture.
"""
def __init__(self,... |
class DPTPreActResidualLayer(nn.Module):
'''
ResidualConvUnit, pre-activate residual unit.
Args:
config (`[DPTConfig]`):
Model configuration class defining the model architecture.
'''
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_... | 3 | 1 | 25 | 5 | 20 | 0 | 3 | 0.15 | 1 | 2 | 0 | 0 | 2 | 7 | 2 | 12 | 59 | 12 | 41 | 12 | 38 | 6 | 23 | 12 | 20 | 3 | 1 | 1 | 6 |
2,267 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTPreTrainedModel | from .configuration_dpt import DPTConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from torch import nn
@auto_docstring
class DPTPreTrainedModel(PreTrainedModel):
config: DPTConfig
base_model_prefix = 'dpt'
ma... | @auto_docstring
class DPTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.54 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 22 | 2 | 13 | 6 | 11 | 7 | 12 | 6 | 10 | 4 | 1 | 2 | 4 |
2,268 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTReassembleLayer | from .configuration_dpt import DPTConfig
from torch import nn
class DPTReassembleLayer(nn.Module):
def __init__(self, config: DPTConfig, channels: int, factor: int):
super().__init__()
hidden_size = _get_backbone_hidden_size(config)
self.projection = nn.Conv2d(in_channels=hidden_size, out_... |
class DPTReassembleLayer(nn.Module):
def __init__(self, config: DPTConfig, channels: int, factor: int):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 9 | 1 | 7 | 2 | 3 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 20 | 2 | 15 | 6 | 12 | 3 | 13 | 6 | 10 | 4 | 1 | 1 | 5 |
2,269 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTReassembleStage | from ...activations import ACT2FN
from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
from torch import nn
class DPTReassembleStage(nn.Module):
"""
This class reassembles the hidden states of the backbone into image-like feature representations at various
resolutions.
Thi... |
class DPTReassembleStage(nn.Module):
'''
This class reassembles the hidden states of the backbone into image-like feature representations at various
resolutions.
This happens in 3 stages:
1. Map the N + 1 tokens to a set of N tokens, by taking into account the readout ([CLS]) token according to
... | 5 | 3 | 21 | 2 | 15 | 4 | 5 | 0.44 | 1 | 7 | 1 | 0 | 4 | 4 | 4 | 14 | 102 | 14 | 61 | 21 | 56 | 27 | 52 | 21 | 47 | 8 | 1 | 3 | 20 |
2,270 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTSemanticSegmentationHead | import torch
from .configuration_dpt import DPTConfig
from torch import nn
class DPTSemanticSegmentationHead(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
self.config = config
features = config.fusion_hidden_size
self.head = nn.Sequential(nn.Conv2d(features,... |
class DPTSemanticSegmentationHead(nn.Module):
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: list[torch.Tensor]) -> torch.Tensor:
pass | 3 | 0 | 11 | 2 | 8 | 1 | 1 | 0.06 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 23 | 5 | 17 | 7 | 14 | 1 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
2,271 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTAttention | from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from typing import Callable, Optional
import torch
from .configuration_dpt import DPTConfig
from torch import nn
class DPTViTAttention(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
self.attent... |
class DPTViTAttention(nn.Module):
def __init__(self, config: DPTConfig):
pass
def prune_heads(self, heads: set[int]):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 4 | 0 | 11 | 1 | 9 | 1 | 1 | 0.17 | 1 | 8 | 3 | 0 | 3 | 3 | 3 | 13 | 39 | 6 | 29 | 16 | 20 | 5 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,272 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTEmbeddings | from torch import nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
class DPTViTEmbeddings(nn.Module):
"""
Construct the CLS token, position and patch embeddings.
"""
def __init__(self, config):
super().__init__()
self.cls_token = nn.Parameter(torch.... |
class DPTViTEmbeddings(nn.Module):
'''
Construct the CLS token, position and patch embeddings.
'''
def __init__(self, config):
pass
def _resize_pos_embed(self, posemb, grid_size_height, grid_size_width, start_index=1):
pass
def forward(self, pixel_values: torch.Tensor) -> Bas... | 4 | 1 | 16 | 4 | 11 | 1 | 1 | 0.18 | 1 | 3 | 2 | 0 | 3 | 5 | 3 | 13 | 56 | 17 | 33 | 19 | 29 | 6 | 31 | 19 | 27 | 2 | 1 | 1 | 4 |
2,273 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTEncoder | from .configuration_dpt import DPTConfig
from ...modeling_outputs import BaseModelOutput, DepthEstimatorOutput, SemanticSegmenterOutput
from typing import Callable, Optional
import torch
from torch import nn
class DPTViTEncoder(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
... |
class DPTViTEncoder(nn.Module):
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_hidden_states: bool=False) -> BaseModelOutput:
pass | 3 | 0 | 24 | 4 | 20 | 0 | 6 | 0 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 49 | 8 | 41 | 18 | 31 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
2,274 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTHybridEmbeddings | from torch import nn
from ...utils.backbone_utils import load_backbone
import torch
from .configuration_dpt import DPTConfig
from ...utils import ModelOutput, auto_docstring, logging, torch_int
import collections.abc
from typing import Callable, Optional
class DPTViTHybridEmbeddings(nn.Module):
"""
This class ... |
class DPTViTHybridEmbeddings(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 | 29 | 6 | 22 | 1 | 4 | 0.13 | 1 | 6 | 1 | 0 | 3 | 8 | 3 | 13 | 97 | 22 | 67 | 29 | 61 | 9 | 52 | 27 | 48 | 6 | 1 | 2 | 12 |
2,275 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTIntermediate | import torch
from .configuration_dpt import DPTConfig
from torch import nn
from ...activations import ACT2FN
class DPTViTIntermediate(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(con... |
class DPTViTIntermediate(nn.Module):
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 1 | 6 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 14 | 2 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
2,276 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTLayer | from torch import nn
import torch
from typing import Callable, Optional
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_dpt import DPTConfig
class DPTViTLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""
def __init__(self, con... |
class DPTViTLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 1 | 18 | 3 | 14 | 3 | 1 | 0.21 | 1 | 7 | 4 | 0 | 2 | 7 | 2 | 12 | 40 | 7 | 29 | 19 | 21 | 6 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
2,277 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTOutput | import torch
from .configuration_dpt import DPTConfig
from torch import nn
class DPTViTOutput(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
... |
class DPTViTOutput(nn.Module):
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 13 | 3 | 10 | 5 | 7 | 0 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
2,278 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTPatchEmbeddings | import torch
from .configuration_dpt import DPTConfig
import collections.abc
from torch import nn
class DPTViTPatchEmbeddings(nn.Module):
"""
Image to Patch Embedding.
"""
def __init__(self, config: DPTConfig):
super().__init__()
image_size, patch_size = (config.image_size, config.pat... |
class DPTViTPatchEmbeddings(nn.Module):
'''
Image to Patch Embedding.
'''
def __init__(self, config: DPTConfig):
pass
def forward(self, pixel_values: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 11 | 1 | 10 | 0 | 3 | 0.14 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 29 | 5 | 21 | 13 | 18 | 3 | 19 | 13 | 16 | 3 | 1 | 1 | 5 |
2,279 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTPooler | from ...activations import ACT2FN
from torch import nn
from .configuration_dpt import DPTConfig
import torch
class DPTViTPooler(nn.Module):
def __init__(self, config: DPTConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.pooler_output_size)
self.activation = ACT2... |
class DPTViTPooler(nn.Module):
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 1 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
2,280 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dpt/modeling_dpt.py | transformers.models.dpt.modeling_dpt.DPTViTSelfOutput | import torch
from .configuration_dpt import DPTConfig
from torch import nn
class DPTViTSelfOutput(nn.Module):
"""
The residual connection is defined in ViTLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, config: DPTCon... |
class DPTViTSelfOutput(nn.Module):
'''
The residual connection is defined in ViTLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: DPTConfig):
pass
def forward(self, hidden_states: torch.Tensor, inpu... | 3 | 1 | 5 | 1 | 4 | 0 | 1 | 0.44 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 16 | 3 | 9 | 5 | 6 | 4 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
2,281 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/configuration_efficientnet.py | transformers.models.efficientnet.configuration_efficientnet.EfficientNetConfig | from ...configuration_utils import PretrainedConfig
class EfficientNetConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`EfficientNetModel`]. It is used to instantiate an
EfficientNet model according to the specified arguments, defining the model architecture. I... |
class EfficientNetConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`EfficientNetModel`]. It is used to instantiate an
EfficientNet model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults w... | 2 | 1 | 49 | 1 | 48 | 0 | 1 | 1.24 | 1 | 4 | 0 | 0 | 1 | 22 | 1 | 1 | 121 | 9 | 50 | 49 | 24 | 62 | 26 | 25 | 24 | 1 | 1 | 0 | 1 |
2,282 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/configuration_efficientnet.py | transformers.models.efficientnet.configuration_efficientnet.EfficientNetOnnxConfig | from packaging import version
from collections.abc import Mapping
from ...onnx import OnnxConfig
from collections import OrderedDict
class EfficientNetOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return Or... |
class EfficientNetOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass | 5 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 0 | 2 | 2 | 14 | 2 | 12 | 6 | 7 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
2,283 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/image_processing_efficientnet.py | transformers.models.efficientnet.image_processing_efficientnet.EfficientNetImageProcessor | import numpy as np
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images, validate_preprocess_arguments
from typing import Optional, Union
from ..... |
class EfficientNetImageProcessor(BaseImageProcessor):
'''
Constructs a EfficientNet 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` i... | 6 | 4 | 69 | 5 | 40 | 24 | 8 | 0.81 | 1 | 8 | 2 | 0 | 4 | 12 | 4 | 24 | 321 | 27 | 162 | 71 | 107 | 132 | 68 | 21 | 63 | 21 | 3 | 1 | 30 |
2,284 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetBlock | from torch import nn
import torch
from .configuration_efficientnet import EfficientNetConfig
class EfficientNetBlock(nn.Module):
"""
This corresponds to the expansion and depthwise convolution phase of each block in the original implementation.
Args:
config ([`EfficientNetConfig`]):
Mo... |
class EfficientNetBlock(nn.Module):
'''
This corresponds to the expansion and depthwise convolution phase of each block in the original implementation.
Args:
config ([`EfficientNetConfig`]):
Model configuration class.
in_dim (`int`):
Number of input channels.
... | 3 | 1 | 26 | 2 | 23 | 1 | 4 | 0.55 | 1 | 10 | 5 | 0 | 2 | 6 | 2 | 12 | 79 | 6 | 47 | 22 | 33 | 26 | 19 | 11 | 16 | 5 | 1 | 1 | 7 |
2,285 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetDepthwiseConv2d | from torch import nn
class EfficientNetDepthwiseConv2d(nn.Conv2d):
def __init__(self, in_channels, depth_multiplier=1, kernel_size=3, stride=1, padding=0, dilation=1, bias=True, padding_mode='zeros'):
out_channels = in_channels * depth_multiplier
super().__init__(in_channels=in_channels, out_chann... |
class EfficientNetDepthwiseConv2d(nn.Conv2d):
def __init__(self, in_channels, depth_multiplier=1, kernel_size=3, stride=1, padding=0, dilation=1, bias=True, padding_mode='zeros'):
pass | 2 | 0 | 23 | 0 | 23 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 24 | 0 | 24 | 13 | 12 | 0 | 4 | 3 | 2 | 1 | 1 | 0 | 1 |
2,286 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetDepthwiseLayer | from torch import nn
from .configuration_efficientnet import EfficientNetConfig
import torch
from ...activations import ACT2FN
class EfficientNetDepthwiseLayer(nn.Module):
"""
This corresponds to the depthwise convolution phase of each block in the original implementation.
"""
def __init__(self, confi... |
class EfficientNetDepthwiseLayer(nn.Module):
'''
This corresponds to the depthwise convolution phase of each block in the original implementation.
'''
def __init__(self, config: EfficientNetConfig, in_dim: int, stride: int, kernel_size: int, adjust_padding: bool):
pass
def forward(self, h... | 3 | 1 | 16 | 2 | 14 | 1 | 2 | 0.14 | 1 | 6 | 2 | 0 | 2 | 5 | 2 | 12 | 37 | 5 | 28 | 17 | 18 | 4 | 17 | 10 | 14 | 2 | 1 | 1 | 4 |
2,287 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetEmbeddings | import torch
from ...activations import ACT2FN
from torch import nn
from .configuration_efficientnet import EfficientNetConfig
class EfficientNetEmbeddings(nn.Module):
"""
A module that corresponds to the stem module of the original work.
"""
def __init__(self, config: EfficientNetConfig):
sup... |
class EfficientNetEmbeddings(nn.Module):
'''
A module that corresponds to the stem module of the original work.
'''
def __init__(self, config: EfficientNetConfig):
pass
def forward(self, pixel_values: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 9 | 1 | 8 | 0 | 1 | 0.19 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 23 | 4 | 16 | 9 | 13 | 3 | 14 | 9 | 11 | 1 | 1 | 0 | 2 |
2,288 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetEncoder | from ...activations import ACT2FN
from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
import torch
from .configuration_efficientnet import EfficientNetConfig
from typing import Optional, Union
import math
from torch import nn
cl... |
class EfficientNetEncoder(nn.Module):
'''
Forward propagates the embeddings through each EfficientNet block.
Args:
config ([`EfficientNetConfig`]):
Model configuration class.
'''
def __init__(self, config: EfficientNetConfig):
pass
def round_repeats... | 4 | 1 | 27 | 3 | 23 | 1 | 4 | 0.1 | 1 | 8 | 3 | 0 | 2 | 6 | 2 | 12 | 88 | 13 | 68 | 32 | 59 | 7 | 42 | 27 | 38 | 7 | 1 | 2 | 13 |
2,289 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetExpansionLayer | from ...activations import ACT2FN
from torch import nn
import torch
from .configuration_efficientnet import EfficientNetConfig
class EfficientNetExpansionLayer(nn.Module):
"""
This corresponds to the expansion phase of each block in the original implementation.
"""
def __init__(self, config: Efficient... |
class EfficientNetExpansionLayer(nn.Module):
'''
This corresponds to the expansion phase of each block in the original implementation.
'''
def __init__(self, config: EfficientNetConfig, in_dim: int, out_dim: int, stride: int):
pass
def forward(self, hidden_states: torch.FloatTensor) -> to... | 3 | 1 | 9 | 1 | 8 | 1 | 1 | 0.24 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 24 | 3 | 17 | 6 | 14 | 4 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
2,290 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetFinalBlockLayer | from .configuration_efficientnet import EfficientNetConfig
from torch import nn
import torch
class EfficientNetFinalBlockLayer(nn.Module):
"""
This corresponds to the final phase of each block in the original implementation.
"""
def __init__(self, config: EfficientNetConfig, in_dim: int, out_dim: int,... |
class EfficientNetFinalBlockLayer(nn.Module):
'''
This corresponds to the final phase of each block in the original implementation.
'''
def __init__(self, config: EfficientNetConfig, in_dim: int, out_dim: int, stride: int, drop_rate: float, id_skip: bool):
pass
def forward(self, embedding... | 3 | 1 | 13 | 1 | 12 | 0 | 2 | 0.13 | 1 | 6 | 1 | 0 | 2 | 4 | 2 | 12 | 31 | 4 | 24 | 9 | 19 | 3 | 14 | 7 | 11 | 2 | 1 | 1 | 3 |
2,291 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetForImageClassification | from torch import nn
import torch
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from typing import Optional, Union
@auto_docstring(custom_intro='\n EfficientNet Model with an... | @auto_docstring(custom_intro='\n EfficientNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g.\n for ImageNet.\n ')
class EfficientNetForImageClassification(EfficientNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def... | 5 | 1 | 32 | 4 | 25 | 4 | 8 | 0.14 | 1 | 5 | 2 | 0 | 2 | 5 | 2 | 3 | 73 | 8 | 57 | 21 | 41 | 8 | 35 | 14 | 32 | 13 | 2 | 3 | 15 |
2,292 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetModel | from .configuration_efficientnet import EfficientNetConfig
from torch import nn
from ...utils import auto_docstring, logging
from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
@au... | @auto_docstring
class EfficientNetModel(EfficientNetPreTrainedModel):
def __init__(self, config: EfficientNetConfig):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> Union[tuple, B... | 5 | 0 | 26 | 4 | 20 | 2 | 4 | 0.08 | 1 | 7 | 4 | 0 | 2 | 4 | 2 | 3 | 61 | 8 | 49 | 17 | 33 | 4 | 24 | 11 | 21 | 5 | 2 | 1 | 8 |
2,293 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetPreTrainedModel | from ...modeling_utils import PreTrainedModel
from torch import nn
from .configuration_efficientnet import EfficientNetConfig
from ...utils import auto_docstring, logging
@auto_docstring
class EfficientNetPreTrainedModel(PreTrainedModel):
config: EfficientNetConfig
base_model_prefix = 'efficientnet'
main_i... | @auto_docstring
class EfficientNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.54 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 22 | 2 | 13 | 6 | 11 | 7 | 12 | 6 | 10 | 4 | 1 | 2 | 4 |
2,294 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/efficientnet/modeling_efficientnet.py | transformers.models.efficientnet.modeling_efficientnet.EfficientNetSqueezeExciteLayer | from ...activations import ACT2FN
from torch import nn
import torch
from .configuration_efficientnet import EfficientNetConfig
class EfficientNetSqueezeExciteLayer(nn.Module):
"""
This corresponds to the Squeeze and Excitement phase of each block in the original implementation.
"""
def __init__(self, ... |
class EfficientNetSqueezeExciteLayer(nn.Module):
'''
This corresponds to the Squeeze and Excitement phase of each block in the original implementation.
'''
def __init__(self, config: EfficientNetConfig, in_dim: int, expand_dim: int, expand: bool=False):
pass
def forward(self, hidden_state... | 3 | 1 | 16 | 2 | 14 | 0 | 2 | 0.1 | 1 | 5 | 1 | 0 | 2 | 7 | 2 | 12 | 37 | 5 | 29 | 11 | 26 | 3 | 19 | 11 | 16 | 2 | 1 | 0 | 3 |
2,295 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/configuration_electra.py | transformers.models.electra.configuration_electra.ElectraConfig | from ...configuration_utils import PretrainedConfig
class ElectraConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ElectraModel`] or a [`TFElectraModel`]. It is
used to instantiate a ELECTRA model according to the specified arguments, defining the model archite... |
class ElectraConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ElectraModel`] or a [`TFElectraModel`]. It is
used to instantiate a ELECTRA model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the de... | 2 | 1 | 48 | 2 | 46 | 0 | 1 | 1.56 | 1 | 1 | 0 | 0 | 1 | 20 | 1 | 1 | 140 | 17 | 48 | 47 | 22 | 75 | 24 | 23 | 22 | 1 | 1 | 0 | 1 |
2,296 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/configuration_electra.py | transformers.models.electra.configuration_electra.ElectraOnnxConfig | from ...onnx import OnnxConfig
from collections.abc import Mapping
from collections import OrderedDict
class ElectraOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequenc... |
class ElectraOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 14 | 0 | 14 | 4 | 11 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
2,297 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraAttention | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from typing import Callable, Optional, Union
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...processing_utils import Unpac... |
class ElectraAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None,... | 4 | 0 | 15 | 1 | 14 | 1 | 1 | 0.07 | 1 | 5 | 1 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 43 | 20 | 30 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,298 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraClassificationHead | from ...activations import ACT2FN, get_activation
from torch import nn
class ElectraClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
classifie... |
class ElectraClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 9 | 0 | 9 | 1 | 2 | 0.17 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 21 | 2 | 18 | 9 | 15 | 3 | 16 | 9 | 13 | 2 | 1 | 0 | 3 |
2,299 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraDiscriminatorPredictions | from ...activations import ACT2FN, get_activation
from torch import nn
class ElectraDiscriminatorPredictions(nn.Module):
"""Prediction module for the discriminator, made up of two dense layers."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.... |
class ElectraDiscriminatorPredictions(nn.Module):
'''Prediction module for the discriminator, made up of two dense layers.'''
def __init__(self, config):
pass
def forward(self, discriminator_hidden_states):
pass | 3 | 1 | 7 | 1 | 6 | 0 | 1 | 0.08 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 17 | 4 | 12 | 9 | 9 | 1 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.