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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,600 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/image_processing_pixtral.py | transformers.models.pixtral.image_processing_pixtral.PixtralImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
import numpy as np
from typing import Optional, Union
from ...utils import TensorType, is_vision_available, logging
from ...image_transforms import pad, resize, to_channel_dimension_format
from ...image_utils import ChannelDimension, ... |
class PixtralImageProcessor(BaseImageProcessor):
'''
Constructs a Pixtral image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
`do_resize` in the `pre... | 5 | 4 | 73 | 6 | 46 | 22 | 7 | 0.63 | 1 | 9 | 2 | 0 | 4 | 11 | 4 | 24 | 331 | 28 | 186 | 67 | 136 | 117 | 70 | 22 | 65 | 19 | 3 | 2 | 29 |
4,601 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/image_processing_pixtral_fast.py | transformers.models.pixtral.image_processing_pixtral_fast.PixtralImageProcessorFast | from typing import Optional, Union
from .image_processing_pixtral import get_resize_output_image_size
from ...image_processing_utils import BatchFeature, get_size_dict
from ...processing_utils import Unpack
from ...utils import TensorType, auto_docstring, is_torchvision_v2_available, logging
import torch
from ...image_... | @auto_docstring
class PixtralImageProcessorFast(BaseImageProcessorFast):
def __init__(self, **kwargs: Unpack[PixtralFastImageProcessorKwargs]):
pass
@auto_docstring
def preprocess(self, images: ImageInput, **kwargs: Unpack[PixtralFastImageProcessorKwargs]) -> BatchFeature:
pass
def res... | 8 | 2 | 23 | 1 | 17 | 5 | 3 | 0.27 | 1 | 13 | 4 | 0 | 5 | 0 | 5 | 39 | 143 | 12 | 103 | 63 | 62 | 28 | 53 | 28 | 47 | 5 | 4 | 2 | 13 |
4,602 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralAttention | from ...modeling_flash_attention_utils import FlashAttentionKwargs
import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...processing_utils import Unpack
from collections.abc import Callable
from typing import Optional, Union
from torch import nn
class PixtralAttention(nn.Module):
... |
class PixtralAttention(nn.Module):
'''
Multi-headed attention compatible with ALL_ATTENTION_FUNCTIONS.
'''
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_embeddings: Optional[tuple[torch.Tensor, torch.T... | 3 | 2 | 26 | 6 | 19 | 1 | 2 | 0.08 | 1 | 3 | 0 | 0 | 2 | 10 | 2 | 12 | 56 | 14 | 39 | 26 | 30 | 3 | 33 | 20 | 30 | 2 | 1 | 1 | 3 |
4,603 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralAttentionLayer | from ...modeling_layers import GradientCheckpointingLayer
import torch
from ...processing_utils import Unpack
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from typing import Optional, Union
class PixtralAttentionLayer(GradientCheckpointingLayer):
def __init__(self, config):
super()._... |
class PixtralAttentionLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, position_embeddings: Optional[tuple[torch.Tensor, torch.Tensor]]=None, output_attentions: Optional[bool]=None, **kwargs: Unpack[FlashA... | 3 | 1 | 22 | 2 | 15 | 5 | 2 | 0.32 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 12 | 46 | 5 | 31 | 16 | 22 | 10 | 20 | 10 | 17 | 2 | 1 | 1 | 3 |
4,604 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralMLP | from ...activations import ACT2FN
from torch import nn
class PixtralMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.hi... |
class PixtralMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
4,605 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralPreTrainedModel | from ...utils import auto_docstring, can_return_tuple, logging
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_pixtral import PixtralVisionConfig
@auto_docstring
class PixtralPreTrainedModel(PreTrainedModel):
config: PixtralVisionConfig
base_model... | @auto_docstring
class PixtralPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 15 | 1 | 14 | 0 | 6 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 22 | 2 | 20 | 8 | 18 | 0 | 15 | 8 | 13 | 6 | 1 | 2 | 6 |
4,606 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralRMSNorm | import torch
from torch import nn
class PixtralRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
PixtralRMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps
... |
class PixtralRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
PixtralRMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 4 | 1 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 18 | 2 | 13 | 8 | 9 | 3 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
4,607 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralRotaryEmbedding | from torch import nn
from ...modeling_rope_utils import dynamic_rope_update
import torch
class PixtralRotaryEmbedding(nn.Module):
"""
The key with pixtral embedding is just that you have a frequency for each pixel positions.
If you have height x width pixels (or embedding pixels), then the frequency used f... |
class PixtralRotaryEmbedding(nn.Module):
'''
The key with pixtral embedding is just that you have a frequency for each pixel positions.
If you have height x width pixels (or embedding pixels), then the frequency used for ROPE
is given by indexing the pre_computed frequency on the width and height.
... | 5 | 1 | 18 | 2 | 14 | 4 | 2 | 0.49 | 1 | 3 | 0 | 0 | 3 | 7 | 3 | 13 | 70 | 10 | 43 | 25 | 38 | 21 | 34 | 22 | 30 | 3 | 1 | 1 | 7 |
4,608 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralTransformer | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from typing import Optional, Union
from ...processing_utils import Unpack
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput
class PixtralTransformer(nn.Module):
def __init__(self, config):
super().__init__()... |
class PixtralTransformer(nn.Module):
def __init__(self, config):
pass
def forward(self, inputs_embeds, attention_mask: Optional[torch.Tensor]=None, position_embeddings: Optional[tuple[torch.Tensor, torch.Tensor]]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None,... | 3 | 1 | 39 | 4 | 26 | 9 | 7 | 0.34 | 1 | 7 | 2 | 0 | 2 | 3 | 2 | 12 | 80 | 9 | 53 | 20 | 42 | 18 | 29 | 12 | 26 | 12 | 1 | 2 | 14 |
4,609 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/modeling_pixtral.py | transformers.models.pixtral.modeling_pixtral.PixtralVisionModel | from ...utils import auto_docstring, can_return_tuple, logging
from ...processing_utils import Unpack
from typing import Optional, Union
from torch import nn
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...modeling_outputs import BaseModelOutput
import torch
@auto_docstring
class PixtralVisi... | @auto_docstring
class PixtralVisionModel(PixtralPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: torch.Tensor, image_sizes: Optional[torch.Tensor]=None, output_hidden_states: Op... | 7 | 0 | 21 | 2 | 17 | 3 | 1 | 0.15 | 1 | 8 | 4 | 0 | 3 | 6 | 3 | 4 | 70 | 9 | 53 | 27 | 39 | 8 | 23 | 17 | 19 | 1 | 2 | 0 | 3 |
4,610 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/processing_pixtral.py | transformers.models.pixtral.processing_pixtral.PixtralProcessor | from ...image_utils import ImageInput, is_valid_image
import numpy as np
from ...feature_extraction_utils import BatchFeature
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack
from typing import Optional, Union
from ...tokenization_utils_base import PreTokenizedInput, TextInput
c... |
class PixtralProcessor(ProcessorMixin):
'''
Constructs a Pixtral processor which wraps a Pixtral image processor and a Pixtral tokenizer into a single processor.
[`PixtralProcessor`] offers all the functionalities of [`CLIPImageProcessor`] and [`LlamaTokenizerFast`]. See the
[`~PixtralProcessor.__call_... | 6 | 3 | 27 | 2 | 17 | 8 | 3 | 0.67 | 1 | 8 | 2 | 0 | 5 | 4 | 5 | 22 | 177 | 19 | 95 | 47 | 71 | 64 | 56 | 28 | 50 | 12 | 2 | 3 | 16 |
4,611 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/processing_pixtral.py | transformers.models.pixtral.processing_pixtral.PixtralProcessorKwargs | from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack
class PixtralProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {'text_kwargs': {'padding': False, 'return_mm_token_type_ids': False}, 'images_kwargs': {}, 'common_kwargs': {'return_tensors': 'pt'}} |
class PixtralProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 0 | 10 | 2 | 9 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
4,612 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/configuration_plbart.py | transformers.models.plbart.configuration_plbart.PLBartConfig | from ...configuration_utils import PretrainedConfig
class PLBartConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PLBartModel`]. It is used to instantiate an
PLBART model according to the specified arguments, defining the model architecture. Instantiating a con... |
class PLBartConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PLBartModel`]. It is used to instantiate an
PLBART model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a simila... | 2 | 1 | 56 | 0 | 56 | 1 | 1 | 1.08 | 1 | 1 | 0 | 0 | 1 | 20 | 1 | 1 | 134 | 10 | 60 | 52 | 31 | 65 | 26 | 25 | 24 | 1 | 1 | 0 | 1 |
4,613 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/configuration_plbart.py | transformers.models.plbart.configuration_plbart.PLBartOnnxConfig | from collections import OrderedDict
from ...onnx import OnnxConfigWithPast
from collections.abc import Mapping
class PLBartOnnxConfig(OnnxConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict([('input_ids', {0: 'batch', 1: 'sequence'}), ('attention_mask', {... |
class PLBartOnnxConfig(OnnxConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 5 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 0 | 2 | 2 | 27 | 1 | 26 | 5 | 21 | 0 | 7 | 3 | 4 | 2 | 1 | 1 | 3 |
4,614 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartAttention | from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...processing_utils import Unpack
from torch import nn
from .configuration_plbart import PLBartConfig
from ...utils.deprecation import deprecate_kwarg
import torch
from ...cache_utils import Cache, D... |
class PLBartAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[PLBartConfig]=None, layer_idx: Optional[int]=None):
... | 4 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 0 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
4,615 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartClassificationHead | import torch
from torch import nn
class PLBartClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, input_dim: int, inner_dim: int, num_classes: int, pooler_dropout: float):
super().__init__()
self.dense = nn.Linear(input_dim, inner_dim)
... |
class PLBartClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, input_dim: int, inner_dim: int, num_classes: int, pooler_dropout: float):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 9 | 0 | 9 | 0 | 1 | 0.05 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 22 | 2 | 19 | 12 | 10 | 1 | 13 | 6 | 10 | 1 | 1 | 0 | 2 |
4,616 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartDecoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSequenceClassifierOutput
from torch import nn
from .configuration_plbart import PLBartConfig
import torch
from ...cache_utils import Cache, DynamicCa... |
class PLBartDecoder(PLBartPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`PLBartDecoderLayer`]
Args:
config: PLBartConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, config: PLBartConfig, embed_token... | 3 | 2 | 68 | 9 | 42 | 18 | 12 | 0.45 | 1 | 13 | 5 | 0 | 4 | 11 | 4 | 5 | 285 | 41 | 168 | 45 | 149 | 76 | 88 | 31 | 83 | 43 | 2 | 3 | 48 |
4,617 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartDecoderLayer | from ...activations import ACT2FN
from typing import Callable, Optional, Union
from torch import nn
from .configuration_plbart import PLBartConfig
from ...modeling_layers import GradientCheckpointingLayer
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils.deprecation import d... |
class PLBartDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PLBartConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=N... | 4 | 1 | 58 | 6 | 40 | 13 | 4 | 0.31 | 1 | 4 | 1 | 0 | 2 | 11 | 2 | 12 | 118 | 12 | 81 | 32 | 67 | 25 | 44 | 21 | 41 | 6 | 1 | 1 | 7 |
4,618 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartDecoderWrapper | class PLBartDecoderWrapper(PLBartPreTrainedModel):
"""
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
"""
def __init__(self, config):
super().__init__(config)
... | class PLBartDecoderWrapper(PLBartPreTrainedModel):
'''
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
'''
def __init__(self, config):
pass
def forward(self, ... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.67 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 3 | 12 | 2 | 6 | 4 | 3 | 4 | 6 | 4 | 3 | 1 | 2 | 0 | 2 |
4,619 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartEncoder | import torch
from typing import Callable, Optional, Union
import math
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSequenceClassifierOutput
from torch import nn
from .configuration_plbart import... |
class PLBartEncoder(PLBartPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`PLBartEncoderLayer`].
Args:
config: PLBartConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, config: PLBar... | 3 | 2 | 43 | 6 | 27 | 10 | 8 | 0.43 | 1 | 12 | 5 | 0 | 4 | 11 | 4 | 5 | 186 | 30 | 110 | 35 | 96 | 47 | 71 | 26 | 66 | 27 | 2 | 3 | 32 |
4,620 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartEncoderLayer | from ...activations import ACT2FN
from typing import Callable, Optional, Union
from torch import nn
from .configuration_plbart import PLBartConfig
from ...modeling_layers import GradientCheckpointingLayer
import torch
class PLBartEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PLBartConfig, l... |
class PLBartEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PLBartConfig, layer_idx: Optional[int]=None):
pass
def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, layer_head_mask: torch.FloatTensor, output_attentions: Optional[bool]=False) -> tu... | 3 | 1 | 33 | 3 | 25 | 6 | 2 | 0.22 | 1 | 3 | 1 | 0 | 2 | 9 | 2 | 12 | 68 | 7 | 50 | 22 | 41 | 11 | 32 | 16 | 29 | 3 | 1 | 1 | 4 |
4,621 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartForCausalLM | from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWi... | @auto_docstring(custom_intro='\n PLBART decoder with a language modeling head on top (linear layer with weights tied to the input embeddings).\n ')
class PLBartForCausalLM(PLBartPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
... | 9 | 1 | 19 | 3 | 9 | 8 | 2 | 0.84 | 2 | 6 | 2 | 0 | 8 | 2 | 9 | 10 | 186 | 33 | 83 | 37 | 56 | 70 | 42 | 20 | 32 | 7 | 2 | 1 | 16 |
4,622 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartForConditionalGeneration | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...generation import G... | @auto_docstring(custom_intro='\n The PLBART Model with a language modeling head. Can be used for code-to-text, text-to-code and code-to-code.\n ')
class PLBartForConditionalGeneration(PLBartPreTrainedModel, GenerationMixin):
def __init__(self, config: PLBartConfig):
pass
def get_encoder(self):
... | 10 | 1 | 11 | 1 | 10 | 1 | 2 | 0.08 | 2 | 8 | 3 | 0 | 9 | 3 | 10 | 11 | 132 | 18 | 106 | 50 | 71 | 8 | 52 | 27 | 41 | 7 | 2 | 2 | 18 |
4,623 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartForSequenceClassification | from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWi... | @auto_docstring(custom_intro='\n PLBart model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g.\n for GLUE tasks.\n ')
class PLBartForSequenceClassification(PLBartPreTrainedModel):
def __init__(self, config: PLBartConfig, **kwargs):
pass
@auto_docstri... | 5 | 1 | 55 | 4 | 48 | 4 | 8 | 0.08 | 1 | 10 | 4 | 0 | 2 | 2 | 2 | 3 | 120 | 10 | 103 | 32 | 77 | 8 | 41 | 14 | 38 | 15 | 2 | 3 | 16 |
4,624 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartLearnedPositionalEmbedding | import torch
from torch import nn
from typing import Callable, Optional, Union
class PLBartLearnedPositionalEmbedding(nn.Embedding):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, num_embeddings: int, embedding_dim: int):
self.offset = 2
... |
class PLBartLearnedPositionalEmbedding(nn.Embedding):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, num_embeddings: int, embedding_dim: int):
pass
def forward(self, input_ids: torch.Tensor, past_key_values_length: int=0, position_ids: Opti... | 3 | 2 | 7 | 1 | 5 | 2 | 1 | 0.6 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 2 | 20 | 4 | 10 | 6 | 7 | 6 | 8 | 6 | 5 | 1 | 1 | 0 | 2 |
4,625 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartModel | from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
import math
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput... | @auto_docstring
class PLBartModel(PLBartPreTrainedModel):
def __init__(self, config: PLBartConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _tie_weights(self):
pass
def get_encoder(self):
pass
@auto_do... | 9 | 1 | 15 | 1 | 13 | 1 | 3 | 0.04 | 1 | 9 | 6 | 0 | 7 | 3 | 7 | 8 | 117 | 15 | 98 | 33 | 67 | 4 | 38 | 15 | 30 | 11 | 2 | 1 | 19 |
4,626 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartPreTrainedModel | from typing import Callable, Optional, Union
from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
import torch
from .configuration_plbart import... | @auto_docstring
class PLBartPreTrainedModel(PreTrainedModel):
def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs_embeds: torch.Tensor):
pass
def _update_causal_mask(self, attention_mask: Optional[Union[torch.Tensor, 'BlockMask']], input_tensor: torch.Tensor, cache_position: ... | 7 | 1 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 7 | 1 | 0 | 1 | 1 | 16 | 1 | 15 | 7 | 13 | 0 | 14 | 7 | 12 | 5 | 1 | 2 | 5 |
4,627 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/modeling_plbart.py | transformers.models.plbart.modeling_plbart.PLBartScaledWordEmbedding | import torch
from torch import nn
from typing import Callable, Optional, Union
class PLBartScaledWordEmbedding(nn.Embedding):
"""
This module overrides nn.Embeddings' forward by multiplying with embeddings scale.
"""
def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_s... |
class PLBartScaledWordEmbedding(nn.Embedding):
'''
This module overrides nn.Embeddings' forward by multiplying with embeddings scale.
'''
def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0):
pass
def forward(self, input_ids: torc... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.5 | 1 | 4 | 0 | 0 | 2 | 1 | 2 | 2 | 11 | 2 | 6 | 4 | 3 | 3 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
4,628 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/plbart/tokenization_plbart.py | transformers.models.plbart.tokenization_plbart.PLBartTokenizer | from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer
from shutil import copyfile
import sentencepiece as spm
from ...utils.import_utils import requires
from typing import Any, Optional
import os
@requires(backends=('sentencepiece',))
class PLBartTokenizer(PreTrainedTokenizer):
"""
C... | @requires(backends=('sentencepiece',))
class PLBartTokenizer(PreTrainedTokenizer):
'''
Construct an PLBART tokenizer.
Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on
[SentencePiece](https://github.com/google/sentencepiece).
The tokenization method is `<tokens> <eos> <language code... | 27 | 11 | 13 | 1 | 9 | 3 | 2 | 0.55 | 1 | 10 | 1 | 0 | 22 | 15 | 22 | 111 | 379 | 61 | 206 | 93 | 147 | 113 | 137 | 56 | 114 | 8 | 3 | 2 | 48 |
4,629 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/configuration_poolformer.py | transformers.models.poolformer.configuration_poolformer.PoolFormerConfig | from ...configuration_utils import PretrainedConfig
class PoolFormerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of [`PoolFormerModel`]. It is used to instantiate a
PoolFormer model according to the specified arguments, defining the model architecture. Instantiat... |
class PoolFormerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of [`PoolFormerModel`]. It is used to instantiate a
PoolFormer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield... | 2 | 1 | 37 | 0 | 37 | 0 | 1 | 1.31 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 100 | 10 | 39 | 38 | 18 | 51 | 20 | 19 | 18 | 1 | 1 | 0 | 1 |
4,630 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/configuration_poolformer.py | transformers.models.poolformer.configuration_poolformer.PoolFormerOnnxConfig | from collections import OrderedDict
from packaging import version
from collections.abc import Mapping
from ...onnx import OnnxConfig
class PoolFormerOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return Orde... |
class PoolFormerOnnxConfig(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 |
4,631 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/feature_extraction_poolformer.py | transformers.models.poolformer.feature_extraction_poolformer.PoolFormerFeatureExtractor | import warnings
from .image_processing_poolformer import PoolFormerImageProcessor
from ...utils.import_utils import requires
@requires(backends=('vision',))
class PoolFormerFeatureExtractor(PoolFormerImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class PoolFormerFeatureEx... | @requires(backends=('vision',))
class PoolFormerFeatureExtractor(PoolFormerImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
4,632 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/image_processing_poolformer.py | transformers.models.poolformer.image_processing_poolformer.PoolFormerImageProcessor | import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import get_resize_output_image_size, resize, to_channel_dimension_format
from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, ChannelDimension, ImageInput, PILImageResampl... |
class PoolFormerImageProcessor(BaseImageProcessor):
'''
Constructs a PoolFormer image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
`do_resize` in th... | 5 | 3 | 84 | 6 | 52 | 25 | 11 | 0.77 | 1 | 8 | 2 | 1 | 3 | 11 | 3 | 23 | 308 | 25 | 160 | 60 | 115 | 123 | 70 | 19 | 66 | 19 | 3 | 3 | 32 |
4,633 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerDropPath | import torch
from torch import nn
from typing import Optional, Union
class PoolFormerDropPath(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_pro... |
class PoolFormerDropPath(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(se... | 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 |
4,634 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerEmbeddings | import collections.abc
from torch import nn
class PoolFormerEmbeddings(nn.Module):
"""
Construct Patch Embeddings.
"""
def __init__(self, hidden_size, num_channels, patch_size, stride, padding, norm_layer=None):
super().__init__()
patch_size = patch_size if isinstance(patch_size, colle... |
class PoolFormerEmbeddings(nn.Module):
'''
Construct Patch Embeddings.
'''
def __init__(self, hidden_size, num_channels, patch_size, stride, padding, norm_layer=None):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 6 | 1 | 6 | 0 | 3 | 0.25 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 18 | 3 | 12 | 6 | 9 | 3 | 12 | 6 | 9 | 5 | 1 | 0 | 6 |
4,635 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerEncoder | from torch import nn
import torch
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
class PoolFormerEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
dpr = [x.item() for x in torch.linspace(0, config.d... |
class PoolFormerEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, pixel_values, output_hidden_states=False, return_dict=True):
pass | 3 | 0 | 31 | 4 | 25 | 3 | 6 | 0.12 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 64 | 8 | 50 | 19 | 47 | 6 | 33 | 19 | 30 | 6 | 1 | 2 | 12 |
4,636 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerFinalPooler | from torch import nn
class PoolFormerFinalPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
def forward(self, hidden_states):
output = self.dense(hidden_states)
return output |
class PoolFormerFinalPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,637 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerForImageClassification | import torch
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
from typing import Optional, Union
from torch import nn
@auto_docstring(custom_intro='\n PoolFormer Model transformer with an image classification head on to... | @auto_docstring(custom_intro='\n PoolFormer Model transformer with an image classification head on top\n ')
class PoolFormerForImageClassification(PoolFormerPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, lab... | 5 | 1 | 34 | 5 | 25 | 5 | 7 | 0.16 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 76 | 10 | 57 | 20 | 41 | 9 | 33 | 13 | 30 | 12 | 2 | 3 | 14 |
4,638 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerGroupNorm | from torch import nn
class PoolFormerGroupNorm(nn.GroupNorm):
"""
Group Normalization with 1 group. Input: tensor in shape [B, C, H, W]
"""
def __init__(self, num_channels, **kwargs):
super().__init__(1, num_channels, **kwargs) |
class PoolFormerGroupNorm(nn.GroupNorm):
'''
Group Normalization with 1 group. Input: tensor in shape [B, C, H, W]
'''
def __init__(self, num_channels, **kwargs):
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 7 | 1 | 3 | 2 | 1 | 3 | 3 | 2 | 1 | 1 | 1 | 0 | 1 |
4,639 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerLayer | from torch import nn
import torch
class PoolFormerLayer(nn.Module):
"""This corresponds to the 'PoolFormerBlock' class in the original implementation."""
def __init__(self, config, num_channels, pool_size, hidden_size, intermediate_size, drop_path):
super().__init__()
self.pooling = PoolFormer... |
class PoolFormerLayer(nn.Module):
'''This corresponds to the 'PoolFormerBlock' class in the original implementation.'''
def __init__(self, config, num_channels, pool_size, hidden_size, intermediate_size, drop_path):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 23 | 3 | 17 | 3 | 3 | 0.17 | 1 | 5 | 4 | 0 | 2 | 8 | 2 | 12 | 49 | 8 | 35 | 16 | 32 | 6 | 30 | 16 | 27 | 3 | 1 | 1 | 5 |
4,640 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerModel | from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
@auto_docstring
class PoolFormerModel(PoolFormerPreTrainedModel):
def __init__(self, config):
super().__init__(c... | @auto_docstring
class PoolFormerModel(PoolFormerPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_hidden_states: Optional[bool]=None, return_dict: Optional[boo... | 6 | 0 | 13 | 2 | 10 | 0 | 2 | 0.03 | 1 | 5 | 2 | 0 | 3 | 2 | 3 | 4 | 49 | 8 | 40 | 14 | 23 | 1 | 18 | 8 | 14 | 5 | 2 | 1 | 7 |
4,641 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerOutput | from torch import nn
from ...activations import ACT2FN
class PoolFormerOutput(nn.Module):
def __init__(self, config, dropout_prob, hidden_size, intermediate_size):
super().__init__()
self.conv1 = nn.Conv2d(hidden_size, intermediate_size, 1)
self.conv2 = nn.Conv2d(intermediate_size, hidden_... |
class PoolFormerOutput(nn.Module):
def __init__(self, config, dropout_prob, hidden_size, intermediate_size):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 19 | 2 | 17 | 7 | 14 | 0 | 16 | 7 | 13 | 2 | 1 | 1 | 3 |
4,642 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerPooling | from torch import nn
class PoolFormerPooling(nn.Module):
def __init__(self, pool_size):
super().__init__()
self.pool = nn.AvgPool2d(pool_size, stride=1, padding=pool_size // 2, count_include_pad=False)
def forward(self, hidden_states):
return self.pool(hidden_states) - hidden_states |
class PoolFormerPooling(nn.Module):
def __init__(self, pool_size):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
4,643 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/poolformer/modeling_poolformer.py | transformers.models.poolformer.modeling_poolformer.PoolFormerPreTrainedModel | from torch import nn
from .configuration_poolformer import PoolFormerConfig
from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, logging
@auto_docstring
class PoolFormerPreTrainedModel(PreTrainedModel):
config: PoolFormerConfig
base_model_prefix = 'poolformer'
main_input_name ... | @auto_docstring
class PoolFormerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 9 | 0 | 8 | 1 | 4 | 0.38 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 20 | 2 | 13 | 6 | 11 | 5 | 12 | 6 | 10 | 4 | 1 | 2 | 4 |
4,644 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/configuration_pop2piano.py | transformers.models.pop2piano.configuration_pop2piano.Pop2PianoConfig | from ...configuration_utils import PretrainedConfig
class Pop2PianoConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Pop2PianoForConditionalGeneration`]. It is used
to instantiate a Pop2PianoForConditionalGeneration model according to the specified arguments, d... |
class Pop2PianoConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Pop2PianoForConditionalGeneration`]. It is used
to instantiate a Pop2PianoForConditionalGeneration model according to the specified arguments, defining the model
architecture. Instantiating a ... | 2 | 1 | 50 | 1 | 49 | 1 | 2 | 0.87 | 1 | 1 | 0 | 0 | 1 | 20 | 1 | 1 | 101 | 5 | 52 | 46 | 28 | 45 | 25 | 24 | 23 | 2 | 1 | 0 | 2 |
4,645 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/feature_extraction_pop2piano.py | transformers.models.pop2piano.feature_extraction_pop2piano.Pop2PianoFeatureExtractor | from ...utils.import_utils import requires
from ...audio_utils import mel_filter_bank, spectrogram
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...utils import TensorType, is_essentia_available, is_librosa_available, is_scipy_available, logging, requires_backends
import numpy as np
fro... | @requires(backends=('essentia', 'librosa', 'scipy', 'torch'))
class Pop2PianoFeatureExtractor(SequenceFeatureExtractor):
'''
Constructs a Pop2Piano feature extractor.
This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains
most of the main meth... | 10 | 7 | 45 | 5 | 28 | 12 | 4 | 0.53 | 1 | 13 | 2 | 0 | 8 | 8 | 8 | 25 | 401 | 54 | 227 | 89 | 191 | 120 | 124 | 62 | 115 | 8 | 3 | 3 | 28 |
4,646 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoAttention | import math
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from typing import Optional, Union
from .configuration_pop2piano import Pop2PianoConfig
from torch import nn
from ...utils.deprecation import dep... |
class Pop2PianoAttention(nn.Module):
def __init__(self, config: Pop2PianoConfig, 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... | 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 |
4,647 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoBlock | import torch
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
from ...utils.deprecation import deprecate_kwarg
class Pop2PianoBlock(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=N... |
class Pop2PianoBlock(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=No... | 4 | 0 | 49 | 5 | 42 | 4 | 4 | 0.08 | 1 | 5 | 3 | 0 | 2 | 2 | 2 | 12 | 100 | 11 | 84 | 26 | 66 | 7 | 33 | 11 | 30 | 6 | 1 | 2 | 8 |
4,648 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoConcatEmbeddingToMel | import torch
from torch import nn
class Pop2PianoConcatEmbeddingToMel(nn.Module):
"""Embedding Matrix for `composer` tokens."""
def __init__(self, config):
super().__init__()
self.embedding = nn.Embedding(num_embeddings=config.composer_vocab_size, embedding_dim=config.d_model)
def forward... |
class Pop2PianoConcatEmbeddingToMel(nn.Module):
'''Embedding Matrix for `composer` tokens.'''
def __init__(self, config):
pass
def forward(self, feature, index_value, embedding_offset):
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.11 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 12 | 2 | 9 | 7 | 6 | 1 | 9 | 7 | 6 | 1 | 1 | 0 | 2 |
4,649 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoDenseActDense | from .configuration_pop2piano import Pop2PianoConfig
from torch import nn
from ...activations import ACT2FN
import torch
class Pop2PianoDenseActDense(nn.Module):
def __init__(self, config: Pop2PianoConfig):
super().__init__()
self.wi = nn.Linear(config.d_model, config.d_ff, bias=False)
sel... |
class Pop2PianoDenseActDense(nn.Module):
def __init__(self, config: Pop2PianoConfig):
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 |
4,650 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoDenseGatedActDense | from ...activations import ACT2FN
from torch import nn
import torch
from .configuration_pop2piano import Pop2PianoConfig
class Pop2PianoDenseGatedActDense(nn.Module):
def __init__(self, config: Pop2PianoConfig):
super().__init__()
self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False)
... |
class Pop2PianoDenseGatedActDense(nn.Module):
def __init__(self, config: Pop2PianoConfig):
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 |
4,651 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoForConditionalGeneration | from ...generation import GenerationMixin
from torch.nn import CrossEntropyLoss
import copy
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from .configuration_pop2piano import Pop2PianoConfig
from transformers.generation import GenerationConfig
from typing import Optional, Union
from ...utils impor... | null | 12 | 3 | 26 | 3 | 17 | 7 | 3 | 0.39 | 2 | 12 | 5 | 0 | 12 | 7 | 12 | 14 | 331 | 47 | 205 | 72 | 156 | 79 | 100 | 37 | 87 | 14 | 2 | 2 | 35 |
4,652 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoLayerCrossAttention | from torch import nn
from typing import Optional, Union
from ...utils.deprecation import deprecate_kwarg
class Pop2PianoLayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
super().__init__()
self.EncDecAttention = Pop2PianoAttention(config, has_relative_atten... |
class Pop2PianoLayerCrossAttention(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=... | 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 |
4,653 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoLayerFF | from .configuration_pop2piano import Pop2PianoConfig
from torch import nn
class Pop2PianoLayerFF(nn.Module):
def __init__(self, config: Pop2PianoConfig):
super().__init__()
if config.is_gated_act:
self.DenseReluDense = Pop2PianoDenseGatedActDense(config)
else:
self.... |
class Pop2PianoLayerFF(nn.Module):
def __init__(self, config: Pop2PianoConfig):
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 |
4,654 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoLayerNorm | import torch
from torch import nn
class Pop2PianoLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Construct a layernorm module in the Pop2Piano style. No bias and no subtraction of mean.
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidde... |
class Pop2PianoLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Construct a layernorm module in the Pop2Piano 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 |
4,655 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoLayerSelfAttention | from typing import Optional, Union
from torch import nn
from ...utils.deprecation import deprecate_kwarg
class Pop2PianoLayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
super().__init__()
self.SelfAttention = Pop2PianoAtte... |
class Pop2PianoLayerSelfAttention(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, ... | 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 |
4,656 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoPreTrainedModel | from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from .configuration_pop2piano import Pop2PianoConfig
@auto_docstring
class Pop2PianoPreTrainedModel(PreTrainedModel):
config: Pop2PianoC... | @auto_docstring
class Pop2PianoPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _shift_right(self, input_ids):
pass | 4 | 1 | 35 | 2 | 28 | 6 | 9 | 0.25 | 1 | 7 | 6 | 2 | 2 | 0 | 2 | 2 | 86 | 7 | 64 | 18 | 61 | 16 | 56 | 18 | 53 | 14 | 1 | 2 | 18 |
4,657 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/modeling_pop2piano.py | transformers.models.pop2piano.modeling_pop2piano.Pop2PianoStack | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
from ...modeling_attn_mask_utils import AttentionMaskConv... |
class Pop2PianoStack(Pop2PianoPreTrainedModel):
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, inputs_embeds=None, hea... | 7 | 1 | 59 | 6 | 46 | 8 | 10 | 0.19 | 1 | 16 | 8 | 0 | 5 | 8 | 6 | 8 | 367 | 38 | 279 | 81 | 240 | 52 | 144 | 49 | 137 | 44 | 2 | 3 | 60 |
4,658 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/processing_pop2piano.py | transformers.models.pop2piano.processing_pop2piano.Pop2PianoProcessor | from ...utils.import_utils import requires
from ...tokenization_utils import BatchEncoding, PaddingStrategy, TruncationStrategy
from ...processing_utils import ProcessorMixin
from typing import Optional, Union
import numpy as np
from ...feature_extraction_utils import BatchFeature
from ...utils import TensorType
import... | @requires(backends=('essentia', 'librosa', 'pretty_midi', 'scipy', 'torch'))
class Pop2PianoProcessor(ProcessorMixin):
'''
Constructs an Pop2Piano processor which wraps a Pop2Piano Feature Extractor and Pop2Piano Tokenizer into a single
processor.
[`Pop2PianoProcessor`] offers all the functionalities of... | 8 | 3 | 14 | 1 | 11 | 2 | 2 | 0.3 | 1 | 12 | 4 | 0 | 5 | 0 | 6 | 23 | 112 | 17 | 73 | 35 | 46 | 22 | 32 | 15 | 25 | 6 | 2 | 1 | 12 |
4,659 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pop2piano/tokenization_pop2piano.py | transformers.models.pop2piano.tokenization_pop2piano.Pop2PianoTokenizer | import json
from typing import Optional, Union
from ...tokenization_utils import AddedToken, BatchEncoding, PaddingStrategy, PreTrainedTokenizer, TruncationStrategy
from ...utils.import_utils import requires
import os
from ...utils import TensorType, is_pretty_midi_available, logging, requires_backends, to_numpy
import... | @requires(backends=('pretty_midi', 'torch'))
class Pop2PianoTokenizer(PreTrainedTokenizer):
'''
Constructs a Pop2Piano tokenizer. This tokenizer does not require training.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass ... | 17 | 14 | 44 | 5 | 24 | 15 | 4 | 0.67 | 1 | 14 | 4 | 0 | 14 | 4 | 14 | 103 | 655 | 85 | 341 | 131 | 270 | 230 | 171 | 73 | 156 | 11 | 3 | 3 | 57 |
4,660 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/configuration_prophetnet.py | transformers.models.prophetnet.configuration_prophetnet.ProphetNetConfig | from typing import Callable, Optional, Union
from ...configuration_utils import PretrainedConfig
class ProphetNetConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ProphetNetModel`]. It is used to instantiate a
ProphetNet model according to the specified argumen... |
class ProphetNetConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ProphetNetModel`]. It is used to instantiate a
ProphetNet model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yie... | 6 | 1 | 24 | 1 | 22 | 1 | 1 | 0.93 | 1 | 6 | 0 | 0 | 3 | 20 | 3 | 3 | 152 | 10 | 74 | 58 | 39 | 69 | 30 | 27 | 26 | 1 | 1 | 0 | 3 |
4,661 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetAttention | from ...utils.deprecation import deprecate_kwarg
from torch import Tensor, nn
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from .configuration_prophetnet import ProphetNetConfig
class ProphetNetAttention(nn.Module):
"""Multi-headed attention fr... |
class ProphetNetAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: ProphetNetConfig, num_attn_heads: int, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def fo... | 4 | 1 | 41 | 6 | 31 | 5 | 4 | 0.16 | 1 | 7 | 1 | 0 | 3 | 8 | 3 | 13 | 127 | 20 | 93 | 37 | 77 | 15 | 62 | 25 | 58 | 11 | 1 | 1 | 13 |
4,662 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetDecoder | import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from .configuration_prophetnet import ProphetNetConfig
from torch.nn import LayerNorm
from torch import Tensor, nn
@auto_docstring(custom_intro='... | @auto_docstring(custom_intro='\n The standalone decoder part of the ProphetNetModel.\n ')
class ProphetNetDecoder(ProphetNetPreTrainedModel):
def __init__(self, config: ProphetNetConfig, word_embeddings: Optional[nn.Embedding]=None):
'''
word_embeddings (`torch.nn.Embeddings` of shape `(confi... | 10 | 2 | 50 | 7 | 36 | 7 | 7 | 0.2 | 1 | 12 | 4 | 0 | 7 | 11 | 7 | 9 | 362 | 54 | 257 | 67 | 233 | 51 | 120 | 52 | 112 | 39 | 2 | 3 | 48 |
4,663 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetDecoderLMOutput | import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro="\n Base class for model's outputs that may also contain a past key/... | @dataclass
@auto_docstring(custom_intro="\n Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).\n ")
class ProphetNetDecoderLMOutput(ModelOutput):
'''
ngram_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4.1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 59 | 8 | 10 | 10 | 9 | 41 | 10 | 10 | 9 | 0 | 1 | 0 | 0 |
4,664 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetDecoderLayer | from typing import Optional, Union
from .configuration_prophetnet import ProphetNetConfig
from torch.nn import LayerNorm
from ...modeling_layers import GradientCheckpointingLayer
from ...utils.deprecation import deprecate_kwarg
import torch
class ProphetNetDecoderLayer(GradientCheckpointingLayer):
"""
Decoder ... |
class ProphetNetDecoderLayer(GradientCheckpointingLayer):
'''
Decoder block for Prophetnet
'''
def __init__(self, config: ProphetNetConfig, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_ma... | 4 | 1 | 38 | 5 | 29 | 5 | 4 | 0.2 | 1 | 6 | 4 | 0 | 2 | 6 | 2 | 12 | 82 | 11 | 59 | 31 | 41 | 12 | 28 | 16 | 25 | 6 | 1 | 1 | 8 |
4,665 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetDecoderModelOutput | from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from dataclasses import dataclass
import torch
@dataclass
@auto_docstring(custom_intro="\n Base class for model's outputs that may also contain a past key/... | @dataclass
@auto_docstring(custom_intro="\n Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).\n ")
class ProphetNetDecoderModelOutput(ModelOutput):
'''
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, decoder_sequence_length, hidden_size... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 57 | 9 | 9 | 8 | 8 | 39 | 9 | 8 | 8 | 0 | 1 | 0 | 0 |
4,666 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetDecoderWrapper | from .configuration_prophetnet import ProphetNetConfig
from torch import Tensor, nn
class ProphetNetDecoderWrapper(ProphetNetPreTrainedModel):
"""
This is a wrapper class, so that [`ProphetNetForCausalLM`] can correctly be loaded from pretrained prophetnet
classes.
"""
def __init__(self, config: P... |
class ProphetNetDecoderWrapper(ProphetNetPreTrainedModel):
'''
This is a wrapper class, so that [`ProphetNetForCausalLM`] can correctly be loaded from pretrained prophetnet
classes.
'''
def __init__(self, config: ProphetNetConfig):
pass
def _tie_weights(self):
pass
de... | 4 | 1 | 4 | 1 | 3 | 0 | 1 | 0.5 | 1 | 3 | 2 | 0 | 3 | 2 | 3 | 5 | 20 | 5 | 10 | 6 | 6 | 5 | 10 | 6 | 6 | 1 | 2 | 0 | 3 |
4,667 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetEncoder | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput
from .configuration_prophetnet import ProphetNetConfig
from torch.nn import LayerNorm
from torch import Tensor, nn
import torch
from ...utils import ModelOutput, auto_docstring, logging
@auto_docstring(custom_intro='\n The standalone... | @auto_docstring(custom_intro='\n The standalone encoder part of the ProphetNetModel.\n ')
class ProphetNetEncoder(ProphetNetPreTrainedModel):
def __init__(self, config: ProphetNetConfig, word_embeddings: nn.Embedding=None):
'''
word_embeddings (`torch.nn.Embeddings` of shape `(config.vocab_si... | 7 | 2 | 29 | 5 | 21 | 4 | 6 | 0.24 | 1 | 11 | 4 | 0 | 4 | 5 | 4 | 6 | 128 | 23 | 85 | 27 | 69 | 20 | 47 | 17 | 42 | 19 | 2 | 2 | 23 |
4,668 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetEncoderLayer | from torch.nn import LayerNorm
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_prophetnet import ProphetNetConfig
class ProphetNetEncoderLayer(GradientCheckpointingLayer):
"""
Encoder block for Prophetnet
"""
def __init__(self, config: ProphetNetConfig):
super()._... |
class ProphetNetEncoderLayer(GradientCheckpointingLayer):
'''
Encoder block for Prophetnet
'''
def __init__(self, config: ProphetNetConfig):
pass
def forward(self, hidden_states, attention_mask, layer_head_mask, output_attentions: bool=False):
pass | 3 | 1 | 18 | 3 | 13 | 2 | 2 | 0.26 | 1 | 5 | 3 | 0 | 2 | 4 | 2 | 12 | 41 | 7 | 27 | 16 | 18 | 7 | 16 | 10 | 13 | 2 | 1 | 1 | 3 |
4,669 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetFeedForward | from torch import Tensor, nn
from ...activations import ACT2FN
from .configuration_prophetnet import ProphetNetConfig
class ProphetNetFeedForward(nn.Module):
"""
This is the residual two feed-forward layer block based on the original Transformer implementation.
"""
def __init__(self, config: ProphetNe... |
class ProphetNetFeedForward(nn.Module):
'''
This is the residual two feed-forward layer block based on the original Transformer implementation.
'''
def __init__(self, config: ProphetNetConfig, ffn_dim: int):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 8 | 1 | 7 | 0 | 1 | 0.2 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 21 | 3 | 15 | 8 | 12 | 3 | 15 | 8 | 12 | 1 | 1 | 0 | 2 |
4,670 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetForCausalLM | import torch
import copy
from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from .configuration_prophetnet import ProphetNetConfig
from ...generation import GenerationMixin
from torch import Tensor, nn
@auto_d... | @auto_docstring(custom_intro='\n The standalone decoder part of the ProphetNetModel with a lm head on top. The model can be used for causal\n ')
class ProphetNetForCausalLM(ProphetNetPreTrainedModel, GenerationMixin):
def __init__(self, config: ProphetNetConfig):
pass
def get_input_embeddings(se... | 12 | 1 | 18 | 3 | 11 | 5 | 2 | 0.47 | 2 | 8 | 3 | 0 | 11 | 4 | 12 | 14 | 242 | 43 | 136 | 60 | 97 | 64 | 70 | 35 | 57 | 7 | 2 | 2 | 25 |
4,671 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetForConditionalGeneration | from .configuration_prophetnet import ProphetNetConfig
from ...generation import GenerationMixin
from torch import Tensor, nn
import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
@auto_docstring(cus... | @auto_docstring(custom_intro='\n The ProphetNet Model with a language modeling head. Can be used for sequence generation tasks.\n ')
class ProphetNetForConditionalGeneration(ProphetNetPreTrainedModel, GenerationMixin):
def __init__(self, config: ProphetNetConfig):
pass
def _tie_weights(self):
... | 11 | 1 | 15 | 2 | 11 | 2 | 2 | 0.19 | 2 | 8 | 3 | 0 | 10 | 4 | 11 | 13 | 181 | 32 | 125 | 54 | 92 | 24 | 65 | 34 | 53 | 9 | 2 | 2 | 24 |
4,672 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetModel | import copy
from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from .configuration_prophetnet import ProphetNetConfig
from torch import Tensor, nn
import torch
@auto_docstring
class ProphetNetModel(ProphetNetP... | @auto_docstring
class ProphetNetModel(ProphetNetPreTrainedModel):
def __init__(self, config: ProphetNetConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _tie_weights(self):
pass
def get_encoder(self):
pass
... | 9 | 1 | 17 | 2 | 13 | 2 | 2 | 0.18 | 1 | 7 | 4 | 0 | 7 | 3 | 7 | 9 | 128 | 18 | 93 | 33 | 66 | 17 | 39 | 15 | 31 | 7 | 2 | 1 | 14 |
4,673 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetNgramSelfAttention | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from .configuration_prophetnet import ProphetNetConfig
from ...utils.deprecation import deprecate_kwarg
from torch import Tensor, nn
import torch
class ProphetNetNgramSelfAttention(nn.Module):
def __init__(self,... |
class ProphetNetNgramSelfAttention(nn.Module):
def __init__(self, config: ProphetNetConfig, layer_idx=None):
pass
def _shape(self, tensor, seq_len, batch_size):
pass
def prepare_for_onnx_export_(self):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', versio... | 8 | 0 | 52 | 8 | 34 | 10 | 2 | 0.3 | 1 | 4 | 1 | 0 | 6 | 14 | 6 | 16 | 317 | 51 | 205 | 74 | 184 | 61 | 126 | 60 | 119 | 6 | 1 | 1 | 13 |
4,674 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetPositionalEmbeddings | from .configuration_prophetnet import ProphetNetConfig
import torch
from torch import Tensor, nn
class ProphetNetPositionalEmbeddings(nn.Embedding):
"""
This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting
based on padding_idx or by setting paddi... |
class ProphetNetPositionalEmbeddings(nn.Embedding):
'''
This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting
based on padding_idx or by setting padding_idx to None and ensuring that the appropriate position ids are passed to
the forward funct... | 4 | 1 | 11 | 1 | 8 | 1 | 2 | 0.36 | 1 | 3 | 1 | 0 | 3 | 1 | 3 | 3 | 41 | 7 | 25 | 7 | 21 | 9 | 18 | 7 | 14 | 4 | 1 | 3 | 6 |
4,675 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetPreTrainedModel | from torch import Tensor, nn
import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_utils import PreTrainedModel
from .configuration_prophetnet import ProphetNetConfig
@auto_docstring
class ProphetNetPreTrainedModel(PreTrainedModel):
config: ProphetNetConfig
base_model_prefix =... | @auto_docstring
class ProphetNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
def _shift_right(self, input_ids):
pass | 4 | 0 | 15 | 3 | 12 | 1 | 3 | 0.07 | 1 | 0 | 0 | 6 | 2 | 0 | 2 | 2 | 36 | 7 | 27 | 9 | 24 | 2 | 23 | 9 | 20 | 5 | 1 | 2 | 6 |
4,676 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetSeq2SeqLMOutput | from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from dataclasses import dataclass
import warnings
import torch
@dataclass
@auto_docstring(custom_intro='\n Base class for sequence-to-sequence language mod... | @dataclass
@auto_docstring(custom_intro='\n Base class for sequence-to-sequence language models outputs.\n ')
class ProphetNetSeq2SeqLMOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss.
logits (`torch.Flo... | 5 | 1 | 7 | 0 | 7 | 0 | 1 | 2.43 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 82 | 10 | 21 | 15 | 18 | 51 | 16 | 14 | 14 | 1 | 1 | 0 | 1 |
4,677 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/modeling_prophetnet.py | transformers.models.prophetnet.modeling_prophetnet.ProphetNetSeq2SeqModelOutput | from ...utils import ModelOutput, auto_docstring, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from dataclasses import dataclass
import warnings
import torch
@dataclass
@auto_docstring(custom_intro="\n Base class for model encoder's outputs that also... | @dataclass
@auto_docstring(custom_intro="\n Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential\n decoding.\n ")
class ProphetNetSeq2SeqModelOutput(ModelOutput):
'''
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, decoder_seq... | 5 | 1 | 7 | 0 | 7 | 0 | 1 | 2.55 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 83 | 12 | 20 | 13 | 17 | 51 | 15 | 12 | 13 | 1 | 1 | 0 | 1 |
4,678 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/prophetnet/tokenization_prophetnet.py | transformers.models.prophetnet.tokenization_prophetnet.ProphetNetTokenizer | import collections
import os
from collections.abc import Iterable
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from typing import Optional
class ProphetNetTokenizer(PreTrainedTokenizer):
"""
Construct a ProphetNetTokenizer. Based on WordPiece.
This to... |
class ProphetNetTokenizer(PreTrainedTokenizer):
'''
Construct a ProphetNetTokenizer. 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:
vo... | 12 | 6 | 16 | 1 | 10 | 4 | 2 | 0.76 | 1 | 9 | 2 | 0 | 11 | 5 | 11 | 100 | 234 | 27 | 118 | 53 | 81 | 90 | 62 | 27 | 50 | 6 | 3 | 3 | 25 |
4,679 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/configuration_pvt.py | transformers.models.pvt.configuration_pvt.PvtConfig | from typing import Callable
from ...configuration_utils import PretrainedConfig
from collections.abc import Mapping
class PvtConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PvtModel`]. It is used to instantiate an Pvt
model according to the specified argument... |
class PvtConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PvtModel`]. It is used to instantiate an Pvt
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configu... | 2 | 1 | 42 | 1 | 41 | 0 | 1 | 1.3 | 1 | 5 | 0 | 0 | 1 | 18 | 1 | 1 | 108 | 9 | 43 | 42 | 20 | 56 | 22 | 21 | 20 | 1 | 1 | 0 | 1 |
4,680 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/configuration_pvt.py | transformers.models.pvt.configuration_pvt.PvtOnnxConfig | from ...onnx import OnnxConfig
from collections.abc import Mapping
from packaging import version
from collections import OrderedDict
class PvtOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict... |
class PvtOnnxConfig(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 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 3 | 0 | 3 | 3 | 18 | 3 | 15 | 8 | 8 | 0 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
4,681 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/image_processing_pvt.py | transformers.models.pvt.image_processing_pvt.PvtImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...utils import TensorType, filter_out_non_signature_kwargs, logging
from ...image_transforms import resize, to_channel_dimension_format
from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, ChannelDimension, Im... |
class PvtImageProcessor(BaseImageProcessor):
'''
Constructs a PVT image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `(size["height"],
size["width"])`. Can be overridden by the ... | 5 | 3 | 65 | 5 | 37 | 23 | 7 | 0.85 | 1 | 8 | 2 | 0 | 3 | 8 | 3 | 23 | 232 | 19 | 115 | 50 | 77 | 98 | 48 | 16 | 44 | 15 | 3 | 1 | 21 |
4,682 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtAttention | from .configuration_pvt import PvtConfig
import torch
from torch import nn
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
import torch.nn.functional as F
class PvtAttention(nn.Module):
def __init__(self, config: PvtConfig, hidden_size: int, num_attention_heads: int, sequences_re... |
class PvtAttention(nn.Module):
def __init__(self, config: PvtConfig, hidden_size: int, num_attention_heads: int, sequences_reduction_ratio: float):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, height: int, width: int, output_attentions: bool=Fals... | 4 | 0 | 12 | 1 | 11 | 1 | 1 | 0.09 | 1 | 9 | 3 | 0 | 3 | 3 | 3 | 13 | 40 | 5 | 33 | 15 | 25 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
4,683 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtDropPath | import torch
import torch.nn.functional as F
from typing import Optional, Union
from torch import nn
class PvtDropPath(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_... |
class PvtDropPath(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 |
4,684 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtEfficientSelfAttention | import torch.nn.functional as F
import math
from .configuration_pvt import PvtConfig
from torch import nn
import torch
class PvtEfficientSelfAttention(nn.Module):
"""Efficient self-attention mechanism with reduction of the sequence [PvT paper](https://huggingface.co/papers/2102.12122)."""
def __init__(self, c... |
class PvtEfficientSelfAttention(nn.Module):
'''Efficient self-attention mechanism with reduction of the sequence [PvT paper](https://huggingface.co/papers/2102.12122).'''
def __init__(self, config: PvtConfig, hidden_size: int, num_attention_heads: int, sequences_reduction_ratio: float):
pass
def ... | 4 | 1 | 25 | 5 | 18 | 2 | 2 | 0.15 | 1 | 7 | 1 | 0 | 3 | 11 | 3 | 13 | 80 | 18 | 54 | 33 | 42 | 8 | 41 | 25 | 37 | 3 | 1 | 1 | 7 |
4,685 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtEncoder | from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from .configuration_pvt import PvtConfig
import torch.nn.functional as F
from typing import Optional, Union
class PvtEncoder(nn.Module):
def __init__(self, config: PvtConfig):
super().__init__()
... |
class PvtEncoder(nn.Module):
def __init__(self, config: PvtConfig):
pass
def forward(self, pixel_values: torch.FloatTensor, output_attentions: Optional[bool]=False, output_hidden_states: Optional[bool]=False, return_dict: Optional[bool]=True) -> Union[tuple, BaseModelOutput]:
pass | 3 | 0 | 43 | 4 | 36 | 4 | 9 | 0.1 | 1 | 10 | 4 | 0 | 2 | 4 | 2 | 12 | 87 | 8 | 72 | 29 | 63 | 7 | 43 | 23 | 40 | 10 | 1 | 3 | 17 |
4,686 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtFFN | import torch.nn.functional as F
from typing import Optional, Union
from torch import nn
from .configuration_pvt import PvtConfig
import torch
from ...activations import ACT2FN
class PvtFFN(nn.Module):
def __init__(self, config: PvtConfig, in_features: int, hidden_features: Optional[int]=None, out_features: Option... |
class PvtFFN(nn.Module):
def __init__(self, config: PvtConfig, in_features: int, hidden_features: Optional[int]=None, out_features: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 5 | 1 | 0 | 2 | 4 | 2 | 12 | 25 | 1 | 24 | 13 | 15 | 0 | 17 | 7 | 14 | 3 | 1 | 1 | 4 |
4,687 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtForImageClassification | from .configuration_pvt import PvtConfig
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
from typing import Optional, Union
from ...utils import auto_docstring, logging
from torch import nn
import torch
import torch.nn.functional as F
@auto_docstring(custom_intro='\n Pvt Model transformer wit... | @auto_docstring(custom_intro='\n Pvt Model transformer with an image classification head on top (a linear layer on top of the final hidden state of\n the [CLS] token) e.g. for ImageNet.\n ')
class PvtForImageClassification(PvtPreTrainedModel):
def __init__(self, config: PvtConfig) -> None:
pass
... | 5 | 1 | 37 | 5 | 28 | 4 | 7 | 0.13 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 82 | 11 | 63 | 20 | 46 | 8 | 32 | 12 | 29 | 12 | 2 | 3 | 14 |
4,688 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtLayer | import torch.nn.functional as F
import torch
from .configuration_pvt import PvtConfig
from torch import nn
class PvtLayer(nn.Module):
def __init__(self, config: PvtConfig, hidden_size: int, num_attention_heads: int, drop_path: float, sequences_reduction_ratio: float, mlp_ratio: float):
super().__init__()
... |
class PvtLayer(nn.Module):
def __init__(self, config: PvtConfig, hidden_size: int, num_attention_heads: int, drop_path: float, sequences_reduction_ratio: float, mlp_ratio: float):
pass
def forward(self, hidden_states: torch.Tensor, height: int, width: int, output_attentions: bool=False):
pass | 3 | 0 | 21 | 3 | 19 | 0 | 2 | 0 | 1 | 9 | 4 | 0 | 2 | 5 | 2 | 12 | 44 | 6 | 38 | 22 | 27 | 0 | 20 | 14 | 17 | 2 | 1 | 0 | 3 |
4,689 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtModel | from typing import Optional, Union
import torch
from ...utils import auto_docstring, logging
from .configuration_pvt import PvtConfig
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput
import torch.nn.functional as F
@auto_docstring
class PvtModel(PvtPreTrainedModel):
def __init__(self, config... | @auto_docstring
class PvtModel(PvtPreTrainedModel):
def __init__(self, config: PvtConfig):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} See base
class PreTrainedModel
... | 6 | 1 | 15 | 2 | 11 | 2 | 3 | 0.14 | 1 | 5 | 3 | 0 | 3 | 2 | 3 | 4 | 56 | 7 | 43 | 16 | 25 | 6 | 18 | 9 | 14 | 5 | 2 | 1 | 8 |
4,690 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtPatchEmbeddings | from torch import nn
import torch.nn.functional as F
from .configuration_pvt import PvtConfig
import torch
from collections.abc import Iterable
import collections
from typing import Optional, Union
class PvtPatchEmbeddings(nn.Module):
"""
This class turns `pixel_values` of shape `(batch_size, num_channels, hei... |
class PvtPatchEmbeddings(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: Pvt... | 4 | 1 | 19 | 1 | 18 | 0 | 3 | 0.11 | 1 | 6 | 1 | 0 | 3 | 10 | 3 | 13 | 66 | 6 | 54 | 31 | 41 | 6 | 40 | 22 | 36 | 5 | 1 | 1 | 10 |
4,691 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtPreTrainedModel | from ...modeling_utils import PreTrainedModel
from .configuration_pvt import PvtConfig
from ...utils import auto_docstring, logging
from torch import nn
@auto_docstring
class PvtPreTrainedModel(PreTrainedModel):
config: PvtConfig
base_model_prefix = 'pvt'
main_input_name = 'pixel_values'
_no_split_modu... | @auto_docstring
class PvtPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 23 | 0 | 20 | 3 | 6 | 0.28 | 1 | 1 | 1 | 2 | 1 | 0 | 1 | 1 | 34 | 2 | 25 | 6 | 23 | 7 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
4,692 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt/modeling_pvt.py | transformers.models.pvt.modeling_pvt.PvtSelfOutput | from torch import nn
import torch.nn.functional as F
import torch
from .configuration_pvt import PvtConfig
class PvtSelfOutput(nn.Module):
def __init__(self, config: PvtConfig, hidden_size: int):
super().__init__()
self.dense = nn.Linear(hidden_size, hidden_size)
self.dropout = nn.Dropout(... |
class PvtSelfOutput(nn.Module):
def __init__(self, config: PvtConfig, hidden_size: int):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 10 | 1 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
4,693 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/configuration_pvt_v2.py | transformers.models.pvt_v2.configuration_pvt_v2.PvtV2Config | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from typing import Callable, Union
from ...configuration_utils import PretrainedConfig
class PvtV2Config(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of ... |
class PvtV2Config(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PvtV2Model`]. It is used to instantiate a Pvt V2
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults w... | 2 | 1 | 50 | 2 | 48 | 0 | 2 | 1.3 | 2 | 6 | 0 | 0 | 1 | 21 | 1 | 6 | 125 | 10 | 50 | 46 | 25 | 65 | 25 | 23 | 23 | 2 | 1 | 0 | 2 |
4,694 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2Backbone | from ...utils.backbone_utils import BackboneMixin
from typing import Optional, Union
from ...utils import auto_docstring, logging
from .configuration_pvt_v2 import PvtV2Config
from ...modeling_outputs import BackboneOutput, BaseModelOutput, ImageClassifierOutput
import torch
@auto_docstring(custom_intro='\n PVTv2 b... | @auto_docstring(custom_intro='\n PVTv2 backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class PvtV2Backbone(PvtV2Model, BackboneMixin):
def __init__(self, config: PvtV2Config):
pass
@auto_docstring
def forward(self, pixel_values: torch.FloatTensor, output_attentions: Option... | 5 | 1 | 34 | 6 | 18 | 10 | 5 | 0.51 | 2 | 5 | 2 | 0 | 2 | 1 | 2 | 18 | 71 | 12 | 39 | 16 | 28 | 20 | 20 | 9 | 17 | 8 | 3 | 2 | 9 |
4,695 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2BlockLayer | from .configuration_pvt_v2 import PvtV2Config
from torch import nn
import torch
class PvtV2BlockLayer(nn.Module):
def __init__(self, config: PvtV2Config, layer_idx: int, drop_path: float=0.0):
super().__init__()
hidden_size: int = config.hidden_sizes[layer_idx]
num_attention_heads: int = c... |
class PvtV2BlockLayer(nn.Module):
def __init__(self, config: PvtV2Config, layer_idx: int, drop_path: float=0.0):
pass
def forward(self, hidden_states: torch.Tensor, height: int, width: int, output_attentions: bool=False):
pass | 3 | 0 | 19 | 3 | 17 | 0 | 2 | 0 | 1 | 9 | 4 | 0 | 2 | 5 | 2 | 12 | 40 | 6 | 34 | 18 | 31 | 0 | 24 | 18 | 21 | 2 | 1 | 0 | 3 |
4,696 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2ConvFeedForwardNetwork | from torch import nn
from typing import Optional, Union
from ...activations import ACT2FN
import torch
from .configuration_pvt_v2 import PvtV2Config
class PvtV2ConvFeedForwardNetwork(nn.Module):
def __init__(self, config: PvtV2Config, in_features: int, hidden_features: Optional[int]=None, out_features: Optional[i... |
class PvtV2ConvFeedForwardNetwork(nn.Module):
def __init__(self, config: PvtV2Config, in_features: int, hidden_features: Optional[int]=None, out_features: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor, height, width) -> torch.Tensor:
pass | 3 | 0 | 14 | 0 | 14 | 0 | 3 | 0 | 1 | 6 | 2 | 0 | 2 | 6 | 2 | 12 | 29 | 1 | 28 | 15 | 19 | 0 | 21 | 9 | 18 | 4 | 1 | 1 | 5 |
4,697 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2DepthWiseConv | from .configuration_pvt_v2 import PvtV2Config
from torch import nn
class PvtV2DepthWiseConv(nn.Module):
"""
Depth-wise (DW) convolution to infuse positional information using zero-padding. Depth-wise convolutions
have an equal number of groups to the number of input channels, meaning one filter per input c... |
class PvtV2DepthWiseConv(nn.Module):
'''
Depth-wise (DW) convolution to infuse positional information using zero-padding. Depth-wise convolutions
have an equal number of groups to the number of input channels, meaning one filter per input channel. This
reduces the overall parameters and compute costs s... | 3 | 1 | 5 | 1 | 5 | 0 | 1 | 0.5 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 18 | 3 | 10 | 5 | 7 | 5 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
4,698 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2DropPath | from torch import nn
from typing import Optional, Union
import torch
class PvtV2DropPath(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 = d... |
class PvtV2DropPath(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 |
4,699 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2Encoder | from torch import nn
from typing import Optional, Union
from .configuration_pvt_v2 import PvtV2Config
from ...modeling_outputs import BackboneOutput, BaseModelOutput, ImageClassifierOutput
import torch
class PvtV2Encoder(nn.Module):
def __init__(self, config: PvtV2Config):
super().__init__()
self.... |
class PvtV2Encoder(nn.Module):
def __init__(self, config: PvtV2Config):
pass
def forward(self, pixel_values: torch.FloatTensor, output_attentions: Optional[bool]=False, output_hidden_states: Optional[bool]=False, return_dict: Optional[bool]=True) -> Union[tuple, BaseModelOutput]:
pass | 3 | 0 | 20 | 1 | 18 | 1 | 5 | 0.06 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 12 | 41 | 3 | 36 | 19 | 27 | 2 | 25 | 13 | 22 | 8 | 1 | 2 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.