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,400 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForRegressionOutput | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from transformers.utils import ModelOutput
from dataclasses import dataclass
import torch.nn as nn
import torch
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForRegressionOutput`].\n ')
class Patc... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForRegressionOutput`].\n ')
class PatchTSMixerForRegressionOutput(ModelOutput):
'''
loss (*optional*, returned when `y` is provided, `torch.FloatTensor` of shape `()`):
Total loss.
regression_outputs (`torch.FloatTensor` ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 62 | 19 | 2 | 5 | 5 | 4 | 12 | 5 | 5 | 4 | 0 | 4 | 0 | 0 |
4,401 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForTimeSeriesClassification | import torch.nn as nn
import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
class PatchTSMixerForTimeSeriesClassification(PatchTSMixerPreTrainedModel):
"""
`PatchTSMixer` for classification application.
... |
class PatchTSMixerForTimeSeriesClassification(PatchTSMixerPreTrainedModel):
'''
`PatchTSMixer` for classification application.
Args:
config (`PatchTSMixerConfig`):
Configuration.
Returns:
`None`.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
@... | 4 | 2 | 45 | 8 | 29 | 11 | 5 | 0.48 | 1 | 10 | 6 | 0 | 2 | 4 | 2 | 130 | 107 | 19 | 63 | 19 | 48 | 30 | 26 | 11 | 23 | 6 | 3 | 1 | 9 |
4,402 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForTimeSeriesClassificationOutput | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from transformers.utils import ModelOutput
from dataclasses import dataclass
import torch.nn as nn
import torch
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForTimeSeriesClassificationOutput`].\n ... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForTimeSeriesClassificationOutput`].\n ')
class PatchTSMixerForTimeSeriesClassificationOutput(ModelOutput):
'''
loss (*optional*, returned when `y` is provided, `torch.FloatTensor` of shape `()`):
Total loss.
prediction_o... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 62 | 19 | 2 | 5 | 5 | 4 | 12 | 5 | 5 | 4 | 0 | 4 | 0 | 0 |
4,403 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerGatedAttention | import torch.nn as nn
class PatchTSMixerGatedAttention(nn.Module):
"""
Module that applies gated attention to input data.
Args:
in_size (`int`): The input size.
out_size (`int`): The output size.
"""
def __init__(self, in_size: int, out_size: int):
super().__init__()
... |
class PatchTSMixerGatedAttention(nn.Module):
'''
Module that applies gated attention to input data.
Args:
in_size (`int`): The input size.
out_size (`int`): The output size.
'''
def __init__(self, in_size: int, out_size: int):
pass
def forward(self, inputs):
pa... | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.67 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 18 | 3 | 9 | 6 | 6 | 6 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,404 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerLayer | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
import torch
class PatchTSMixerLayer(nn.Module):
"""
The `PatchTSMixer` layer that does all three kinds of mixing.
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, confi... |
class PatchTSMixerLayer(nn.Module):
'''
The `PatchTSMixer` layer that does all three kinds of mixing.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, hidden: torch.Tensor):
'''
... | 3 | 2 | 13 | 3 | 7 | 4 | 2 | 1 | 1 | 6 | 4 | 0 | 2 | 4 | 2 | 12 | 36 | 9 | 14 | 7 | 11 | 14 | 14 | 7 | 11 | 2 | 1 | 1 | 4 |
4,405 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerLinearHead | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerLinearHead(nn.Module):
"""Linear head for Classification and Regression.
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, config: PatchTSMixerC... |
class PatchTSMixerLinearHead(nn.Module):
'''Linear head for Classification and Regression.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig, distribution_output=None):
pass
def forward(self, hidden_features):
... | 3 | 2 | 30 | 4 | 20 | 7 | 5 | 0.44 | 1 | 2 | 1 | 0 | 2 | 6 | 2 | 12 | 69 | 11 | 41 | 10 | 38 | 18 | 29 | 10 | 26 | 6 | 1 | 1 | 10 |
4,406 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerMLP | import torch.nn as nn
import torch
class PatchTSMixerMLP(nn.Module):
def __init__(self, in_features, out_features, config):
super().__init__()
num_hidden = in_features * config.expansion_factor
self.fc1 = nn.Linear(in_features, num_hidden)
self.dropout1 = nn.Dropout(config.dropout)... |
class PatchTSMixerMLP(nn.Module):
def __init__(self, in_features, out_features, config):
pass
def forward(self, inputs: torch.Tensor):
'''
Args:
inputs (`torch.Tensor` of shape `((batch_size, num_channels, num_patches, d_model))`):
Input to the MLP layer.
... | 3 | 1 | 10 | 0 | 6 | 4 | 1 | 0.54 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 21 | 1 | 13 | 8 | 10 | 7 | 13 | 8 | 10 | 1 | 1 | 0 | 2 |
4,407 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerMasking | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerMasking(nn.Module):
"""
Class to perform random or forecast masking.
Parameters:
config (`PatchTSMixerConfig`): model config
Returns:
x_mask (`torch.Tensor` of shape `(batch_... |
class PatchTSMixerMasking(nn.Module):
'''
Class to perform random or forecast masking.
Parameters:
config (`PatchTSMixerConfig`): model config
Returns:
x_mask (`torch.Tensor` of shape `(batch_size, num_channels, num_patches, patch_length)`)
Masked patched input
mask ... | 3 | 2 | 22 | 2 | 15 | 6 | 3 | 0.68 | 1 | 4 | 1 | 0 | 2 | 6 | 2 | 12 | 58 | 6 | 31 | 10 | 28 | 21 | 18 | 10 | 15 | 3 | 1 | 1 | 5 |
4,408 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerMeanScaler | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerMeanScaler(nn.Module):
"""
Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data
accordingly.
"""
def __init__(self, config: Pat... |
class PatchTSMixerMeanScaler(nn.Module):
'''
Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data
accordingly.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, data: torch.Tensor, observed_indicator: ... | 3 | 2 | 23 | 3 | 12 | 8 | 4 | 0.76 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 52 | 8 | 25 | 16 | 20 | 19 | 22 | 14 | 19 | 5 | 1 | 1 | 8 |
4,409 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerModel | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
import torch.nn as nn
import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
@auto_docstring(custom_intro='\n The PatchTSMixer Model for time-series forecasting.\n ')
class PatchTSMixerModel(PatchTSMixerPre... | @auto_docstring(custom_intro='\n The PatchTSMixer Model for time-series forecasting.\n ')
class PatchTSMixerModel(PatchTSMixerPreTrainedModel):
def __init__(self, config: PatchTSMixerConfig, mask_input: bool=False):
'''
mask_input (bool, *optional*, defaults to `False`):
Whether t... | 5 | 2 | 42 | 7 | 30 | 6 | 6 | 0.19 | 1 | 13 | 9 | 0 | 2 | 5 | 2 | 130 | 88 | 14 | 63 | 20 | 52 | 12 | 31 | 13 | 28 | 6 | 3 | 1 | 11 |
4,410 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerNOPScaler | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
from typing import Callable, Optional, Union
import torch
class PatchTSMixerNOPScaler(nn.Module):
"""
Assigns a scaling factor equal to 1 along the first dimension, and therefore applies no scaling to the input data.
"""
... |
class PatchTSMixerNOPScaler(nn.Module):
'''
Assigns a scaling factor equal to 1 along the first dimension, and therefore applies no scaling to the input data.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, data: torch.Tensor, observed_indicator: Optional[torch.... | 3 | 2 | 10 | 0 | 5 | 5 | 2 | 1.09 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 25 | 2 | 11 | 9 | 6 | 12 | 9 | 7 | 6 | 3 | 1 | 0 | 4 |
4,411 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerNormLayer | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerNormLayer(nn.Module):
"""Normalization block
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, config: PatchTSMixerConfig):
super().__in... |
class PatchTSMixerNormLayer(nn.Module):
'''Normalization block
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, inputs: torch.Tensor):
'''
Args:
inputs (`torch.Ten... | 3 | 2 | 19 | 3 | 11 | 6 | 2 | 0.7 | 1 | 4 | 2 | 0 | 2 | 2 | 2 | 12 | 47 | 9 | 23 | 6 | 20 | 16 | 14 | 6 | 11 | 2 | 1 | 1 | 4 |
4,412 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerPatchify | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
import torch
class PatchTSMixerPatchify(nn.Module):
"""
A class to patchify the time series sequence into different patches
Returns:
`torch.Tensor` of shape `(batch_size, num_channels, num_patches, patch_length)`
... |
class PatchTSMixerPatchify(nn.Module):
'''
A class to patchify the time series sequence into different patches
Returns:
`torch.Tensor` of shape `(batch_size, num_channels, num_patches, patch_length)`
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, pa... | 3 | 2 | 19 | 2 | 11 | 6 | 2 | 0.7 | 1 | 4 | 1 | 0 | 2 | 5 | 2 | 12 | 46 | 7 | 23 | 11 | 20 | 16 | 19 | 11 | 16 | 2 | 1 | 1 | 4 |
4,413 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerPositionalEncoding | import math
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
import torch
class PatchTSMixerPositionalEncoding(nn.Module):
"""
Class for positional encoding
"""
def __init__(self, config: PatchTSMixerConfig):
super().__init__()
if config.use_positional_e... |
class PatchTSMixerPositionalEncoding(nn.Module):
'''
Class for positional encoding
'''
def __init__(self, config: PatchTSMixerConfig):
pass
@staticmethod
def _init_pe(config: PatchTSMixerConfig) -> nn.Parameter:
pass
def forward(self, patch_input: torch.Tensor):
pa... | 5 | 1 | 10 | 0 | 9 | 1 | 2 | 0.21 | 1 | 4 | 1 | 0 | 2 | 1 | 3 | 13 | 37 | 3 | 28 | 10 | 23 | 6 | 22 | 9 | 18 | 3 | 1 | 1 | 6 |
4,414 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerPreTrainedModel | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
from transformers.modeling_utils import PreTrainedModel
from ...utils import auto_docstring, logging
@auto_docstring
class PatchTSMixerPreTrainedModel(PreTrainedModel):
config: PatchTSMixerConfig
base_model_prefix = 'model'
ma... | @auto_docstring
class PatchTSMixerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize weights'''
pass | 3 | 1 | 16 | 0 | 14 | 2 | 7 | 0.16 | 1 | 2 | 2 | 6 | 1 | 0 | 1 | 128 | 23 | 1 | 19 | 6 | 17 | 3 | 16 | 6 | 14 | 7 | 2 | 2 | 7 |
4,415 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerPretrainHead | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerPretrainHead(nn.Module):
"""Pretraining head.
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, config: PatchTSMixerConfig):
super().__init__()
... |
class PatchTSMixerPretrainHead(nn.Module):
'''Pretraining head.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, hidden_features):
'''
Args:
hidden_features (`torc... | 3 | 2 | 10 | 2 | 4 | 5 | 1 | 1.56 | 1 | 2 | 1 | 0 | 2 | 2 | 2 | 12 | 28 | 6 | 9 | 6 | 6 | 14 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,416 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerStdScaler | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerStdScaler(nn.Module):
"""
Standardize features by calculating the mean and scaling along the first dimension, and then normalizes it by
subtracting from the mean and dividing by the standard devi... |
class PatchTSMixerStdScaler(nn.Module):
'''
Standardize features by calculating the mean and scaling along the first dimension, and then normalizes it by
subtracting from the mean and dividing by the standard deviation.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forw... | 3 | 2 | 13 | 1 | 7 | 6 | 3 | 1 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 33 | 3 | 15 | 12 | 10 | 15 | 13 | 10 | 10 | 4 | 1 | 0 | 5 |
4,417 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/configuration_patchtst.py | transformers.models.patchtst.configuration_patchtst.PatchTSTConfig | from transformers.configuration_utils import PretrainedConfig
from typing import Optional, Union
class PatchTSTConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`PatchTSTModel`]. It is used to instantiate an
PatchTST model according to the specified arguments, ... |
class PatchTSTConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`PatchTSTModel`]. It is used to instantiate an
PatchTST model according to the specified arguments, defining the model architecture.
[ibm/patchtst](https://huggingface.co/ibm/patchtst) architec... | 2 | 1 | 106 | 8 | 84 | 17 | 1 | 1.35 | 1 | 5 | 0 | 0 | 1 | 39 | 1 | 33 | 228 | 17 | 91 | 85 | 47 | 123 | 45 | 43 | 43 | 1 | 2 | 0 | 1 |
4,418 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTAttention | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from .configuration_patchtst import PatchTSTConfig
from torch import nn
from ...processing_utils import Unpack
class PatchT... |
class PatchTSTAttention(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[PatchTSTConfig]=None):
pass
def forward(s... | 3 | 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,419 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTBatchNorm | import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
class PatchTSTBatchNorm(nn.Module):
"""
Compute batch normalization over the sequence length (time) dimension.
"""
def __init__(self, config: PatchTSTConfig):
super().__init__()
self.batchnorm = nn.Bat... |
class PatchTSTBatchNorm(nn.Module):
'''
Compute batch normalization over the sequence length (time) dimension.
'''
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, inputs: torch.Tensor):
'''
Parameters:
inputs (`torch.Tensor` of shape `(batch_... | 3 | 2 | 7 | 0 | 4 | 4 | 1 | 1.38 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 20 | 2 | 8 | 5 | 5 | 11 | 8 | 5 | 5 | 1 | 1 | 0 | 2 |
4,420 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTClassificationHead | import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
class PatchTSTClassificationHead(nn.Module):
def __init__(self, config: PatchTSTConfig):
super().__init__()
self.use_cls_token = config.use_cls_token
self.pooling_type = config.pooling_type
self.fl... |
class PatchTSTClassificationHead(nn.Module):
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, embedding: torch.Tensor):
'''
Parameters:
embedding (`torch.Tensor` of shape `(bs, num_channels, num_patches, d_model)` or
`(bs, num_channel... | 3 | 1 | 17 | 1 | 10 | 7 | 3 | 0.65 | 1 | 4 | 1 | 0 | 2 | 5 | 2 | 12 | 35 | 2 | 20 | 10 | 17 | 13 | 17 | 10 | 14 | 4 | 1 | 1 | 6 |
4,421 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTEmbedding | from torch import nn
import torch
from .configuration_patchtst import PatchTSTConfig
class PatchTSTEmbedding(nn.Module):
def __init__(self, config: PatchTSTConfig):
super().__init__()
self.num_input_channels = config.num_input_channels
self.share_embedding = config.share_embedding
... |
class PatchTSTEmbedding(nn.Module):
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, patch_input: torch.Tensor):
'''
Parameters:
patch_input (`torch.Tensor` of shape `(batch_size, num_channels, num_patches, patch_length)`, *required*):
Pat... | 3 | 1 | 16 | 0 | 12 | 5 | 3 | 0.42 | 1 | 5 | 1 | 0 | 2 | 3 | 2 | 12 | 34 | 1 | 24 | 9 | 21 | 10 | 19 | 9 | 16 | 3 | 1 | 2 | 6 |
4,422 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTEncoder | from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
from ...modeling_outputs import BaseModelOutput
from typing import Callable, Optional, Union
class PatchTSTEncoder(PatchTSTPreTrainedModel):
"""
PatchTST Encoder
"""
def __init__(self, config: PatchTSTConfig, num_patc... |
class PatchTSTEncoder(PatchTSTPreTrainedModel):
'''
PatchTST Encoder
'''
def __init__(self, config: PatchTSTConfig, num_patches: int):
pass
def forward(self, patch_input: torch.Tensor, output_hidden_states: Optional[bool]=None, output_attentions: Optional[bool]=None) -> BaseModelOutput:
... | 3 | 2 | 27 | 3 | 15 | 10 | 5 | 0.73 | 1 | 10 | 5 | 0 | 2 | 4 | 2 | 4 | 60 | 8 | 30 | 17 | 22 | 22 | 23 | 12 | 20 | 8 | 2 | 2 | 9 |
4,423 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTEncoderLayer | from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
from typing import Callable, Optional, Union
from ...activations import ACT2CLS
class PatchTSTEncoderLayer(nn.Module):
"""
PatchTST encoder layer
"""
def __init__(self, config: PatchTSTConfig):
super().__init_... |
class PatchTSTEncoderLayer(nn.Module):
'''
PatchTST encoder layer
'''
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, hidden_state: torch.Tensor, output_attentions: Optional[bool]=None):
'''
Parameters:
hidden_state (`torch.Tensor` of shape `... | 3 | 2 | 65 | 8 | 38 | 19 | 10 | 0.53 | 1 | 7 | 3 | 0 | 2 | 10 | 2 | 12 | 136 | 18 | 77 | 17 | 74 | 41 | 51 | 17 | 48 | 12 | 1 | 2 | 19 |
4,424 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForClassification | from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
from ...utils import ModelOutput, auto_docstring, logging
from typing import Callable, Optional, Union
@auto_docstring(custom_intro='\n The PatchTST for classification model.\n ')
class PatchTSTForClassification(PatchTSTPreTrain... | @auto_docstring(custom_intro='\n The PatchTST for classification model.\n ')
class PatchTSTForClassification(PatchTSTPreTrainedModel):
def __init__(self, config: PatchTSTConfig):
pass
@auto_docstring
def forward(self, past_values: torch.Tensor, target_values: Optional[torch.Tensor]=None, past... | 5 | 1 | 47 | 7 | 20 | 20 | 4 | 0.98 | 1 | 8 | 4 | 0 | 2 | 2 | 2 | 4 | 95 | 14 | 41 | 18 | 30 | 40 | 22 | 10 | 19 | 5 | 2 | 1 | 7 |
4,425 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForClassificationOutput | from ...utils import ModelOutput, auto_docstring, logging
import torch
from dataclasses import dataclass
from typing import Callable, Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForClassification`].\n ')
class PatchTSTForClassificationOutput(ModelOutput):
"""
loss... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForClassification`].\n ')
class PatchTSTForClassificationOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
Total loss as the sum of the masked language modeling l... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 27 | 4 | 5 | 5 | 4 | 18 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
4,426 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForPrediction | from ...time_series_utils import NegativeBinomialOutput, NormalOutput, StudentTOutput
from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
from ...utils import ModelOutput, auto_docstring, logging
from typing import Callable, Optional, Union
@auto_docstring(custom_intro='\n The Patch... | @auto_docstring(custom_intro='\n The PatchTST for prediction model.\n ')
class PatchTSTForPrediction(PatchTSTPreTrainedModel):
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, past_values: torch.Tensor, past_observed_mask: Optional[torch.Tensor]=None, future_values: Optional[to... | 6 | 2 | 61 | 9 | 30 | 22 | 5 | 0.74 | 1 | 13 | 8 | 0 | 3 | 3 | 3 | 5 | 185 | 28 | 90 | 32 | 74 | 67 | 47 | 20 | 43 | 7 | 2 | 2 | 15 |
4,427 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForPredictionOutput | from ...utils import ModelOutput, auto_docstring, logging
from dataclasses import dataclass
import torch
from typing import Callable, Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForPrediction`].\n ')
class PatchTSTForPredictionOutput(ModelOutput):
"""
loss (*optio... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForPrediction`].\n ')
class PatchTSTForPredictionOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
MSE loss.
prediction_outputs (`torch.FloatTensor` of shape ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 32 | 4 | 7 | 7 | 6 | 21 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
4,428 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForPretraining | from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
from ...utils import ModelOutput, auto_docstring, logging
from typing import Callable, Optional, Union
@auto_docstring(custom_intro='\n The PatchTST for pretrain model.\n ')
class PatchTSTForPretraining(PatchTSTPreTrainedModel):... | @auto_docstring(custom_intro='\n The PatchTST for pretrain model.\n ')
class PatchTSTForPretraining(PatchTSTPreTrainedModel):
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, past_values: torch.Tensor, past_observed_mask: Optional[torch.Tensor]=None, output_hidden_states: Optio... | 4 | 1 | 54 | 8 | 17 | 29 | 3 | 1.66 | 1 | 7 | 4 | 0 | 2 | 2 | 2 | 4 | 109 | 16 | 35 | 19 | 25 | 58 | 20 | 12 | 17 | 4 | 2 | 1 | 5 |
4,429 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForPretrainingOutput | from ...utils import ModelOutput, auto_docstring, logging
import torch
from dataclasses import dataclass
from typing import Callable, Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForPretraining`].\n ')
class PatchTSTForPretrainingOutput(ModelOutput):
"""
loss (*opt... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForPretraining`].\n ')
class PatchTSTForPretrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
MSE loss.
prediction_output (`torch.FloatTensor` of shape... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 4 | 5 | 5 | 4 | 17 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
4,430 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForRegression | from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
from ...utils import ModelOutput, auto_docstring, logging
from typing import Callable, Optional, Union
from ...time_series_utils import NegativeBinomialOutput, NormalOutput, StudentTOutput
@auto_docstring(custom_intro='\n The Patch... | @auto_docstring(custom_intro='\n The PatchTST for regression model.\n ')
class PatchTSTForRegression(PatchTSTPreTrainedModel):
def __init__(self, config: PatchTSTConfig):
pass
@auto_docstring
def forward(self, past_values: torch.Tensor, target_values: Optional[torch.Tensor]=None, past_observe... | 7 | 2 | 49 | 6 | 24 | 18 | 4 | 0.74 | 1 | 14 | 8 | 0 | 3 | 3 | 3 | 5 | 150 | 21 | 74 | 28 | 58 | 55 | 41 | 16 | 37 | 6 | 2 | 2 | 13 |
4,431 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTForRegressionOutput | from ...utils import ModelOutput, auto_docstring, logging
import torch
from dataclasses import dataclass
from typing import Callable, Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForRegression`].\n ')
class PatchTSTForRegressionOutput(ModelOutput):
"""
loss (*optio... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSTForRegression`].\n ')
class PatchTSTForRegressionOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
MSE loss.
regression_outputs (`torch.FloatTensor` of shape ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 4 | 5 | 5 | 4 | 17 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
4,432 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTMaskPretrainHead | from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
class PatchTSTMaskPretrainHead(nn.Module):
"""
Pretraining head for mask modelling
"""
def __init__(self, config: PatchTSTConfig):
super().__init__()
self.dropout = nn.Dropout(config.head_dropout) if c... |
class PatchTSTMaskPretrainHead(nn.Module):
'''
Pretraining head for mask modelling
'''
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, embedding: torch.Tensor) -> torch.Tensor:
'''
Parameters:
embedding (`torch.Tensor` of shape `(bs, num_chan... | 3 | 2 | 10 | 1 | 5 | 6 | 2 | 1.27 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 26 | 3 | 11 | 6 | 8 | 14 | 11 | 6 | 8 | 2 | 1 | 1 | 4 |
4,433 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTMasking | from torch import nn
import torch
from .configuration_patchtst import PatchTSTConfig
class PatchTSTMasking(nn.Module):
"""
Class to perform random or forecast masking.
Parameters:
config (`PatchTSTConfig`): model config
Returns:
x_mask (`torch.Tensor` of shape `(batch_size, num_channel... |
class PatchTSTMasking(nn.Module):
'''
Class to perform random or forecast masking.
Parameters:
config (`PatchTSTConfig`): model config
Returns:
x_mask (`torch.Tensor` of shape `(batch_size, num_channels, num_patches, patch_length)`)
Masked patched input
mask (`torch.... | 3 | 2 | 22 | 2 | 15 | 6 | 3 | 0.68 | 1 | 4 | 1 | 0 | 2 | 6 | 2 | 12 | 58 | 6 | 31 | 10 | 28 | 21 | 18 | 10 | 15 | 3 | 1 | 1 | 5 |
4,434 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTMeanScaler | import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
class PatchTSTMeanScaler(nn.Module):
"""
Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data
accordingly.
"""
def __init__(self, config: PatchTSTConfig):... |
class PatchTSTMeanScaler(nn.Module):
'''
Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data
accordingly.
'''
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, data: torch.Tensor, observed_indicator: torch.Te... | 3 | 2 | 23 | 3 | 12 | 8 | 4 | 0.76 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 52 | 8 | 25 | 16 | 20 | 19 | 22 | 14 | 19 | 5 | 1 | 1 | 8 |
4,435 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTModel | from torch import nn
from .configuration_patchtst import PatchTSTConfig
import torch
from ...utils import ModelOutput, auto_docstring, logging
from typing import Callable, Optional, Union
@auto_docstring
class PatchTSTModel(PatchTSTPreTrainedModel):
def __init__(self, config: PatchTSTConfig):
super().__in... | @auto_docstring
class PatchTSTModel(PatchTSTPreTrainedModel):
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, past_values: torch.Tensor, past_observed_mask: Optional[torch.Tensor]=None, future_values: Optional[torch.Tensor]=None, output_hidden_states: Optional[bool]=None, output_att... | 4 | 1 | 54 | 9 | 25 | 20 | 5 | 0.78 | 1 | 10 | 6 | 0 | 2 | 5 | 2 | 4 | 110 | 19 | 51 | 22 | 40 | 40 | 29 | 14 | 26 | 7 | 2 | 1 | 9 |
4,436 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTModelOutput | from ...utils import ModelOutput, auto_docstring, logging
import torch
from dataclasses import dataclass
from typing import Callable, Optional, Union
@dataclass
@auto_docstring(custom_intro="\n Base class for model's outputs, with potential hidden states.\n ")
class PatchTSTModelOutput(ModelOutput):
"""
... | @dataclass
@auto_docstring(custom_intro="\n Base class for model's outputs, with potential hidden states.\n ")
class PatchTSTModelOutput(ModelOutput):
'''
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_channels, num_patches, patch_length)`):
Sequence of hidden-states at the outp... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 28 | 2 | 8 | 8 | 7 | 18 | 8 | 8 | 7 | 0 | 1 | 0 | 0 |
4,437 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTNOPScaler | import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
from typing import Callable, Optional, Union
class PatchTSTNOPScaler(nn.Module):
"""
Assigns a scaling factor equal to 1 along the first dimension, and therefore applies no scaling to the input data.
"""
def __init__(... |
class PatchTSTNOPScaler(nn.Module):
'''
Assigns a scaling factor equal to 1 along the first dimension, and therefore applies no scaling to the input data.
'''
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, data: torch.Tensor, observed_indicator: Optional[torch.Tensor]=... | 3 | 2 | 10 | 0 | 5 | 5 | 2 | 1.09 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 25 | 2 | 11 | 9 | 6 | 12 | 9 | 7 | 6 | 3 | 1 | 0 | 4 |
4,438 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTPatchify | import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
class PatchTSTPatchify(nn.Module):
"""
A class to patchify the time series sequence into different patches
Returns:
`torch.Tensor` of shape `(batch_size, num_channels, num_patches, patch_length)`
"""
def ... |
class PatchTSTPatchify(nn.Module):
'''
A class to patchify the time series sequence into different patches
Returns:
`torch.Tensor` of shape `(batch_size, num_channels, num_patches, patch_length)`
'''
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, past_value... | 3 | 2 | 19 | 2 | 11 | 6 | 2 | 0.7 | 1 | 4 | 1 | 0 | 2 | 5 | 2 | 12 | 46 | 7 | 23 | 11 | 20 | 16 | 19 | 11 | 16 | 2 | 1 | 1 | 4 |
4,439 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTPositionalEncoding | import math
import torch
from .configuration_patchtst import PatchTSTConfig
from torch import nn
class PatchTSTPositionalEncoding(nn.Module):
"""
Class for positional encoding
"""
def __init__(self, config: PatchTSTConfig, num_patches: int):
super().__init__()
self.use_cls_token = conf... |
class PatchTSTPositionalEncoding(nn.Module):
'''
Class for positional encoding
'''
def __init__(self, config: PatchTSTConfig, num_patches: int):
pass
@staticmethod
def _init_pe(config: PatchTSTConfig, num_patches: int) -> nn.Parameter:
pass
def forward(self, patch_input: t... | 5 | 1 | 15 | 0 | 12 | 3 | 3 | 0.31 | 1 | 5 | 1 | 0 | 2 | 5 | 3 | 13 | 54 | 3 | 39 | 16 | 34 | 12 | 31 | 15 | 27 | 3 | 1 | 1 | 8 |
4,440 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTPreTrainedModel | from ...utils import ModelOutput, auto_docstring, logging
from .configuration_patchtst import PatchTSTConfig
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class PatchTSTPreTrainedModel(PreTrainedModel):
config: PatchTSTConfig
base_model_prefix = 'mo... | @auto_docstring
class PatchTSTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''
Initialize weights
'''
pass
def _set_gradient_checkpointing(self, module, value=False):
pass | 4 | 1 | 12 | 0 | 10 | 3 | 5 | 0.21 | 1 | 3 | 3 | 6 | 2 | 0 | 2 | 2 | 31 | 2 | 24 | 7 | 21 | 5 | 21 | 7 | 18 | 8 | 1 | 2 | 10 |
4,441 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTPredictionHead | from ...utils import ModelOutput, auto_docstring, logging
import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
@auto_docstring(custom_intro='\n The PatchTST for regression Model.\n ')
class PatchTSTPredictionHead(nn.Module):
def __init__(self, config: PatchTSTConfig, num_patc... | @auto_docstring(custom_intro='\n The PatchTST for regression Model.\n ')
class PatchTSTPredictionHead(nn.Module):
def __init__(self, config: PatchTSTConfig, num_patches: int, distribution_output=None):
'''
num_patches (`int`):
The number of patches in the input sequence.
d... | 4 | 2 | 43 | 3 | 28 | 14 | 8 | 0.48 | 1 | 5 | 1 | 0 | 2 | 10 | 2 | 12 | 88 | 6 | 56 | 18 | 53 | 27 | 47 | 18 | 44 | 8 | 1 | 3 | 15 |
4,442 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTRegressionHead | import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
class PatchTSTRegressionHead(nn.Module):
"""
Regression head
"""
def __init__(self, config: PatchTSTConfig, distribution_output=None):
super().__init__()
self.y_range = config.output_range
self... |
class PatchTSTRegressionHead(nn.Module):
'''
Regression head
'''
def __init__(self, config: PatchTSTConfig, distribution_output=None):
pass
def forward(self, embedding: torch.Tensor):
'''
Parameters:
embedding (`torch.Tensor` of shape `(bs, num_channels, num_pa... | 3 | 2 | 24 | 2 | 14 | 9 | 4 | 0.71 | 1 | 4 | 1 | 0 | 2 | 7 | 2 | 12 | 53 | 6 | 28 | 13 | 25 | 20 | 24 | 13 | 21 | 5 | 1 | 1 | 8 |
4,443 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTScaler | import torch
from torch import nn
from .configuration_patchtst import PatchTSTConfig
class PatchTSTScaler(nn.Module):
def __init__(self, config: PatchTSTConfig):
super().__init__()
if config.scaling == 'mean' or config.scaling is True:
self.scaler = PatchTSTMeanScaler(config)
e... |
class PatchTSTScaler(nn.Module):
def __init__(self, config: PatchTSTConfig):
pass
def forward(self, data: torch.Tensor, observed_indicator: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
'''
Parameters:
data (`torch.Tensor` of shape `(batch_size, sequenc... | 3 | 1 | 12 | 0 | 7 | 6 | 2 | 0.79 | 1 | 6 | 4 | 0 | 2 | 1 | 2 | 12 | 26 | 1 | 14 | 7 | 9 | 11 | 10 | 5 | 7 | 3 | 1 | 1 | 4 |
4,444 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtst/modeling_patchtst.py | transformers.models.patchtst.modeling_patchtst.PatchTSTStdScaler | import torch
from .configuration_patchtst import PatchTSTConfig
from torch import nn
class PatchTSTStdScaler(nn.Module):
"""
Standardize features by calculating the mean and scaling along the first dimension, and then normalizes it by
subtracting from the mean and dividing by the standard deviation.
""... |
class PatchTSTStdScaler(nn.Module):
'''
Standardize features by calculating the mean and scaling along the first dimension, and then normalizes it by
subtracting from the mean and dividing by the standard deviation.
'''
def __init__(self, config: PatchTSTConfig):
pass
def forward(self... | 3 | 2 | 13 | 1 | 7 | 6 | 3 | 1 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 33 | 3 | 15 | 12 | 10 | 15 | 13 | 10 | 10 | 4 | 1 | 0 | 5 |
4,445 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/configuration_pegasus.py | transformers.models.pegasus.configuration_pegasus.PegasusConfig | from ...configuration_utils import PretrainedConfig
class PegasusConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PegasusModel`]. It is used to instantiate an
PEGASUS model according to the specified arguments, defining the model architecture. Instantiating a ... |
class PegasusConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PegasusModel`]. It is used to instantiate an
PEGASUS model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a sim... | 6 | 1 | 19 | 0 | 19 | 0 | 1 | 0.98 | 1 | 2 | 0 | 0 | 3 | 19 | 3 | 3 | 138 | 12 | 64 | 54 | 32 | 63 | 29 | 26 | 25 | 1 | 1 | 0 | 3 |
4,446 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusAttention | from ...utils.deprecation import deprecate_kwarg
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...processing_utils import Unpack
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from typing import Callable, Optional, Union
from .configura... |
class PegasusAttention(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[PegasusConfig]=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,447 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusDecoder | import torch
from .configuration_pegasus import PegasusConfig
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLM... |
class PegasusDecoder(PegasusPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`PegasusDecoderLayer`]
Args:
config: PegasusConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, config: PegasusConfig, embed_... | 5 | 4 | 45 | 6 | 26 | 13 | 7 | 0.54 | 1 | 11 | 4 | 0 | 6 | 10 | 6 | 7 | 281 | 43 | 155 | 45 | 134 | 83 | 84 | 31 | 77 | 37 | 2 | 3 | 44 |
4,448 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusDecoderLayer | from typing import Callable, Optional, Union
from .configuration_pegasus import PegasusConfig
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils.deprecation import deprecate_kwarg
from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
import torch
from ...activatio... |
class PegasusDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PegasusConfig, 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]... | 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,449 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusDecoderWrapper | class PegasusDecoderWrapper(PegasusPreTrainedModel):
"""
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 PegasusDecoderWrapper(PegasusPreTrainedModel):
'''
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,450 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusEncoder | from torch import nn
from typing import Callable, Optional, Union
from .configuration_pegasus import PegasusConfig
import torch
import math
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
class PegasusEnc... |
class PegasusEncoder(PegasusPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`PegasusEncoderLayer`].
Args:
config: PegasusConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, config: P... | 5 | 4 | 47 | 7 | 27 | 13 | 7 | 0.53 | 1 | 10 | 4 | 0 | 4 | 10 | 4 | 5 | 199 | 32 | 110 | 34 | 96 | 58 | 69 | 25 | 64 | 24 | 2 | 3 | 29 |
4,451 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusEncoderLayer | from torch import nn
from ...activations import ACT2FN
from .configuration_pegasus import PegasusConfig
from ...modeling_layers import GradientCheckpointingLayer
import torch
class PegasusEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PegasusConfig):
super().__init__()
self.e... |
class PegasusEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PegasusConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor:
'''
Args:
hidd... | 3 | 1 | 33 | 3 | 25 | 6 | 2 | 0.22 | 1 | 4 | 1 | 0 | 2 | 9 | 2 | 12 | 68 | 7 | 50 | 22 | 41 | 11 | 32 | 16 | 29 | 3 | 1 | 1 | 4 |
4,452 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusForCausalLM | import torch
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...generation import GenerationMixin
import copy
f... |
class PegasusForCausalLM(PegasusPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def set_decoder(self, decoder):
pass
def get_decoder(self):
pass
def... | 10 | 3 | 18 | 2 | 8 | 8 | 2 | 0.97 | 2 | 7 | 2 | 0 | 10 | 2 | 11 | 12 | 209 | 36 | 88 | 39 | 59 | 85 | 47 | 22 | 35 | 7 | 2 | 1 | 18 |
4,453 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusForConditionalGeneration | from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from .configuration_pegasus import PegasusConfig
from ..... | @auto_docstring(custom_intro='\n The PEGASUS Model with a language modeling head. Can be used for summarization.\n ')
class PegasusForConditionalGeneration(PegasusPreTrainedModel, GenerationMixin):
def __init__(self, config: PegasusConfig):
pass
def get_encoder(self):
pass
def get_d... | 12 | 3 | 12 | 1 | 9 | 2 | 2 | 0.2 | 2 | 8 | 3 | 0 | 11 | 3 | 12 | 13 | 160 | 21 | 116 | 52 | 79 | 23 | 60 | 29 | 47 | 8 | 2 | 2 | 21 |
4,454 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusModel | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch
from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, C... | @auto_docstring
class PegasusModel(PegasusPreTrainedModel):
def __init__(self, config: PegasusConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def get_encoder(self):
pass
def resize_position_embeddings(self, new_num_p... | 10 | 3 | 17 | 2 | 11 | 4 | 2 | 0.33 | 1 | 9 | 5 | 0 | 8 | 3 | 8 | 9 | 146 | 22 | 93 | 33 | 65 | 31 | 37 | 15 | 28 | 10 | 2 | 1 | 17 |
4,455 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_pegasus import PegasusConfig
import torch
from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
from ...cache_utils import Cache, DynamicCache, EncoderDeco... | @auto_docstring
class PegasusPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs_embeds: torch.Tensor):
pass
def _update_causal_mask(self, attention_mask: Optional[Union[torch.Tensor, 'BlockM... | 8 | 1 | 12 | 0 | 12 | 0 | 6 | 0 | 1 | 1 | 1 | 6 | 1 | 0 | 1 | 1 | 17 | 1 | 16 | 6 | 14 | 0 | 14 | 6 | 12 | 6 | 1 | 2 | 6 |
4,456 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/modeling_pegasus.py | transformers.models.pegasus.modeling_pegasus.PegasusSinusoidalPositionalEmbedding | from typing import Callable, Optional, Union
import numpy as np
from torch import nn
import torch
class PegasusSinusoidalPositionalEmbedding(nn.Embedding):
"""This module produces sinusoidal positional embeddings of any length."""
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optiona... |
class PegasusSinusoidalPositionalEmbedding(nn.Embedding):
'''This module produces sinusoidal positional embeddings of any length.'''
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None) -> None:
pass
def _init_weight(self):
'''
Identical to t... | 5 | 3 | 8 | 0 | 7 | 2 | 1 | 0.3 | 1 | 4 | 0 | 0 | 2 | 1 | 3 | 3 | 32 | 3 | 23 | 12 | 17 | 7 | 17 | 10 | 13 | 2 | 1 | 0 | 4 |
4,457 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/tokenization_pegasus.py | transformers.models.pegasus.tokenization_pegasus.PegasusTokenizer | import sentencepiece as spm
from typing import Any, Optional
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils.import_utils import requires
from shutil import copyfile
import os
@requires(backends=('sentencepiece',))
class PegasusTokenizer(PreTrainedTokenizer):
"""
Construct a PEG... | @requires(backends=('sentencepiece',))
class PegasusTokenizer(PreTrainedTokenizer):
'''
Construct a PEGASUS tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
th... | 17 | 8 | 13 | 1 | 10 | 2 | 2 | 0.55 | 1 | 11 | 0 | 0 | 14 | 7 | 14 | 103 | 252 | 40 | 139 | 52 | 109 | 76 | 92 | 36 | 77 | 9 | 3 | 2 | 34 |
4,458 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus/tokenization_pegasus_fast.py | transformers.models.pegasus.tokenization_pegasus_fast.PegasusTokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
from shutil import copyfile
import os
from typing import Optional
class PegasusTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" PEGASUS tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://huggingfa... |
class PegasusTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" PEGASUS tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models).
This tokenizer inherits from [`PreTrainedToken... | 6 | 3 | 21 | 2 | 16 | 3 | 4 | 0.57 | 1 | 10 | 0 | 0 | 6 | 2 | 6 | 94 | 178 | 27 | 98 | 31 | 76 | 56 | 48 | 16 | 41 | 6 | 3 | 2 | 21 |
4,459 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/configuration_pegasus_x.py | transformers.models.pegasus_x.configuration_pegasus_x.PegasusXConfig | from ...configuration_utils import PretrainedConfig
class PegasusXConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PegasusXModel`]. It is used to instantiate a
PEGASUS-X model according to the specified arguments, defining the model architecture. Instantiating... |
class PegasusXConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PegasusXModel`]. It is used to instantiate a
PEGASUS-X model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a ... | 6 | 1 | 22 | 1 | 21 | 0 | 1 | 0.97 | 1 | 2 | 0 | 0 | 3 | 22 | 3 | 3 | 151 | 14 | 70 | 60 | 35 | 68 | 32 | 29 | 28 | 1 | 1 | 0 | 3 |
4,460 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.DimensionInfo | from dataclasses import dataclass
@dataclass
class DimensionInfo:
"""Wrapper for dimension info."""
batch_size: int
seq_len: int
block_size: int
num_heads: int
hidden_dim: int
dim_per_head: int
num_blocks: int
global_len: int
padded_seq_len: int | @dataclass
class DimensionInfo:
'''Wrapper for dimension info.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 10 | 1 | 9 | 10 | 10 | 1 | 9 | 0 | 0 | 0 | 0 |
4,461 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXAttention | from ...utils.deprecation import deprecate_kwarg
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from torch import nn
from .configuration_pegasus_x import PegasusXConfig
from ...cache_utils import Cache, DynamicCa... |
class PegasusXAttention(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[PegasusXConfig]=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,462 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXDecoder | from .configuration_pegasus_x import PegasusXConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
import torch
from torch import nn
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
impor... | null | 3 | 2 | 53 | 8 | 32 | 14 | 9 | 0.47 | 1 | 10 | 5 | 0 | 4 | 8 | 4 | 5 | 225 | 37 | 128 | 40 | 111 | 60 | 74 | 28 | 69 | 30 | 2 | 3 | 35 |
4,463 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXDecoderLayer | from torch import nn
import torch
from ...modeling_layers import GradientCheckpointingLayer
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from .configuration_pegasus_x import PegasusXConfig
from ...activations import ACT2FN
from ...utils.deprecation import deprecate_kwarg
from typing import Callab... |
class PegasusXDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PegasusXConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tenso... | 4 | 1 | 54 | 6 | 38 | 11 | 4 | 0.29 | 1 | 5 | 2 | 0 | 2 | 11 | 2 | 12 | 110 | 12 | 76 | 30 | 64 | 22 | 44 | 21 | 41 | 6 | 1 | 1 | 7 |
4,464 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXDecoderWrapper | class PegasusXDecoderWrapper(PegasusXPreTrainedModel):
"""
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 PegasusXDecoderWrapper(PegasusXPreTrainedModel):
'''
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(se... | 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,465 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXEncoder | import torch
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from torch import nn
import math
from .configuration_pegasus_x import PegasusXConfig
class PegasusXEncoder(PegasusXPreTrainedModel):
... |
class PegasusXEncoder(PegasusXPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`PegasusXEncoderLayer`].
Args:
config: PegasusXConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, confi... | 5 | 4 | 49 | 7 | 30 | 12 | 7 | 0.45 | 1 | 12 | 5 | 0 | 4 | 9 | 4 | 5 | 210 | 34 | 122 | 39 | 109 | 55 | 79 | 31 | 74 | 21 | 2 | 3 | 26 |
4,466 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXEncoderLayer | from torch import nn
import torch
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_pegasus_x import PegasusXConfig
from ...activations import ACT2FN
class PegasusXEncoderLayer(GradientCheckpointingLayer):
def __init__(self, stagger_blocks_this_layer: bool, config: PegasusXConfig):
... |
class PegasusXEncoderLayer(GradientCheckpointingLayer):
def __init__(self, stagger_blocks_this_layer: bool, config: PegasusXConfig):
pass
def forward(self, hidden_states: torch.Tensor, global_hidden_states: torch.Tensor, attention_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor:
... | 7 | 1 | 27 | 3 | 21 | 4 | 2 | 0.18 | 1 | 5 | 2 | 0 | 2 | 12 | 4 | 14 | 113 | 13 | 85 | 34 | 72 | 15 | 56 | 26 | 51 | 4 | 1 | 1 | 7 |
4,467 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXForConditionalGeneration | import torch
from torch.nn import CrossEntropyLoss
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from .configuration_pegasus_x import PegasusXConfig
from ...generation import GenerationMixin
from ...cache_utils import Cache, DynamicCache,... | @auto_docstring(custom_intro='\n The PEGASUS-X for conditional generation (e.g. summarization).\n ')
class PegasusXForConditionalGeneration(PegasusXPreTrainedModel, GenerationMixin):
def __init__(self, config: PegasusXConfig):
pass
def get_encoder(self):
pass
def get_decoder(self):
... | 10 | 3 | 12 | 1 | 9 | 2 | 2 | 0.24 | 2 | 8 | 3 | 0 | 9 | 2 | 10 | 11 | 136 | 19 | 94 | 39 | 64 | 23 | 47 | 22 | 36 | 8 | 2 | 2 | 18 |
4,468 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXGlobalLocalAttention | import torch
from typing import Callable, Optional, Union
from torch import nn
class PegasusXGlobalLocalAttention(nn.Module):
"""Global + Local attention. For use with Encoder only."""
def __init__(self, embed_dim: int, num_heads: int, block_size: int, dropout: float=0.0, is_decoder: bool=False):
supe... |
class PegasusXGlobalLocalAttention(nn.Module):
'''Global + Local attention. For use with Encoder only.'''
def __init__(self, embed_dim: int, num_heads: int, block_size: int, dropout: float=0.0, is_decoder: bool=False):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
p... | 6 | 4 | 45 | 4 | 28 | 13 | 1 | 0.45 | 1 | 7 | 1 | 0 | 5 | 11 | 5 | 15 | 232 | 27 | 141 | 63 | 118 | 64 | 64 | 46 | 58 | 2 | 1 | 1 | 7 |
4,469 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXModel | from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from torch import nn
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from .configuration_pegasus_x import PegasusXConfig
import math
import torch
from ...... | @auto_docstring
class PegasusXModel(PegasusXPreTrainedModel):
def __init__(self, config: PegasusXConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def get_encoder(self):
pass
def resize_position_embeddings(self, new_nu... | 10 | 3 | 17 | 2 | 11 | 4 | 2 | 0.34 | 1 | 10 | 6 | 0 | 8 | 3 | 8 | 9 | 144 | 22 | 91 | 32 | 66 | 31 | 39 | 17 | 30 | 10 | 2 | 1 | 18 |
4,470 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXPreTrainedModel | import torch
from torch import nn
from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch... | @auto_docstring
class PegasusXPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs_embeds: torch.Tensor):
pass
def _update_causal_mask(self, attention_mask: Optional[Union[torch.Tensor, 'Block... | 8 | 1 | 8 | 0 | 8 | 0 | 4 | 0 | 1 | 0 | 0 | 5 | 1 | 0 | 1 | 1 | 14 | 1 | 13 | 7 | 11 | 0 | 12 | 7 | 10 | 4 | 1 | 2 | 4 |
4,471 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXScaledWordEmbedding | import torch
from torch import nn
from typing import Callable, Optional, Union
class PegasusXScaledWordEmbedding(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... |
class PegasusXScaledWordEmbedding(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: to... | 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,472 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pegasus_x/modeling_pegasus_x.py | transformers.models.pegasus_x.modeling_pegasus_x.PegasusXSinusoidalPositionalEmbedding | import numpy as np
from torch import nn
from typing import Callable, Optional, Union
import torch
class PegasusXSinusoidalPositionalEmbedding(nn.Module):
"""This module produces sinusoidal positional embeddings of any length."""
def __init__(self, embed_dim, max_scale: int=10000.0):
super().__init__()... |
class PegasusXSinusoidalPositionalEmbedding(nn.Module):
'''This module produces sinusoidal positional embeddings of any length.'''
def __init__(self, embed_dim, max_scale: int=10000.0):
pass
@torch.no_grad()
def forward(self, input_embeds: torch.Tensor, past_key_values_length: int=0, position_... | 4 | 2 | 10 | 0 | 9 | 1 | 1 | 0.1 | 1 | 4 | 0 | 0 | 2 | 2 | 2 | 12 | 24 | 2 | 20 | 11 | 16 | 2 | 14 | 10 | 11 | 1 | 1 | 0 | 2 |
4,473 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/configuration_perceiver.py | transformers.models.perceiver.configuration_perceiver.PerceiverConfig | from ...configuration_utils import PretrainedConfig
class PerceiverConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PerceiverModel`]. It is used to instantiate an
Perceiver model according to the specified arguments, defining the model architecture. Instantiat... |
class PerceiverConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PerceiverModel`]. It is used to instantiate an
Perceiver model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield... | 2 | 1 | 64 | 1 | 59 | 4 | 1 | 1.31 | 1 | 1 | 0 | 0 | 1 | 27 | 1 | 1 | 151 | 10 | 61 | 60 | 29 | 80 | 31 | 30 | 29 | 1 | 1 | 0 | 1 |
4,474 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/configuration_perceiver.py | transformers.models.perceiver.configuration_perceiver.PerceiverOnnxConfig | from ...feature_extraction_utils import FeatureExtractionMixin
from collections import OrderedDict
from ...onnx.utils import compute_effective_axis_dimension
from ...onnx import OnnxConfig
from collections.abc import Mapping
from typing import Any, Union
from ...tokenization_utils_base import PreTrainedTokenizerBase
c... |
class PerceiverOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass
def generate_dummy_inputs(self, preprocessor: Union['PreTrainedTokenizerBase', 'FeatureExtractionMixin'], batch_size: i... | 6 | 0 | 18 | 0 | 16 | 2 | 2 | 0.1 | 1 | 10 | 2 | 0 | 3 | 0 | 3 | 3 | 58 | 3 | 50 | 21 | 33 | 5 | 23 | 8 | 19 | 3 | 1 | 1 | 6 |
4,475 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/feature_extraction_perceiver.py | transformers.models.perceiver.feature_extraction_perceiver.PerceiverFeatureExtractor | import warnings
from .image_processing_perceiver import PerceiverImageProcessor
from ...utils.import_utils import requires
@requires(backends=('vision',))
class PerceiverFeatureExtractor(PerceiverImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class PerceiverFeatureExtract... | @requires(backends=('vision',))
class PerceiverFeatureExtractor(PerceiverImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 25 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
4,476 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/image_processing_perceiver.py | transformers.models.perceiver.image_processing_perceiver.PerceiverImageProcessor | import numpy as np
from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import center_crop, resize, to_channel_dimension_format
from typing import Optional, Union
from... | @requires(backends=('vision',))
class PerceiverImageProcessor(BaseImageProcessor):
'''
Constructs a Perceiver image processor.
Args:
do_center_crop (`bool`, `optional`, defaults to `True`):
Whether or not to center crop the image. If the input size if smaller than `crop_size` along any e... | 7 | 4 | 65 | 5 | 38 | 22 | 7 | 0.79 | 1 | 8 | 2 | 1 | 4 | 10 | 4 | 24 | 302 | 24 | 155 | 68 | 104 | 123 | 66 | 22 | 61 | 18 | 3 | 1 | 27 |
4,477 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.AbstractPreprocessor | from torch import nn
class AbstractPreprocessor(nn.Module):
@property
def num_channels(self) -> int:
"""Returns size of preprocessor output."""
raise NotImplementedError() |
class AbstractPreprocessor(nn.Module):
@property
def num_channels(self) -> int:
'''Returns size of preprocessor output.'''
pass | 3 | 1 | 3 | 0 | 2 | 1 | 1 | 0.25 | 1 | 2 | 0 | 5 | 1 | 0 | 1 | 11 | 5 | 0 | 4 | 3 | 1 | 1 | 3 | 2 | 1 | 1 | 1 | 0 | 1 |
4,478 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.Conv2DDownsample | import torch
from torch import nn
class Conv2DDownsample(nn.Module):
"""Downsamples 4x by applying a 2D convolution and doing max pooling."""
def __init__(self, num_layers: int=1, in_channels: int=3, out_channels: int=64, use_batchnorm: bool=True):
"""
Constructs a Conv2DDownsample model.
... |
class Conv2DDownsample(nn.Module):
'''Downsamples 4x by applying a 2D convolution and doing max pooling.'''
def __init__(self, num_layers: int=1, in_channels: int=3, out_channels: int=64, use_batchnorm: bool=True):
'''
Constructs a Conv2DDownsample model.
Args:
in_channels (`... | 3 | 2 | 16 | 1 | 10 | 5 | 2 | 0.52 | 1 | 5 | 1 | 0 | 2 | 4 | 2 | 12 | 36 | 4 | 21 | 14 | 12 | 11 | 13 | 8 | 10 | 2 | 1 | 0 | 3 |
4,479 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.Conv2dSamePadding | from functools import reduce
from torch import nn
from operator import __add__
class Conv2dSamePadding(nn.Conv2d):
"""
Conv2d layer with padding="same" support. Source:
https://gist.github.com/sumanmichael/4de9dee93f972d47c80c4ade8e149ea6
"""
def __init__(self, *args, **kwargs):
super().__... |
class Conv2dSamePadding(nn.Conv2d):
'''
Conv2d layer with padding="same" support. Source:
https://gist.github.com/sumanmichael/4de9dee93f972d47c80c4ade8e149ea6
'''
def __init__(self, *args, **kwargs):
pass
def forward(self, input):
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.5 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 14 | 2 | 8 | 4 | 5 | 4 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
4,480 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverAbstractDecoder | import abc
from torch import nn
class PerceiverAbstractDecoder(nn.Module, metaclass=abc.ABCMeta):
"""Perceiver abstract decoder."""
@abc.abstractmethod
def decoder_query(self, inputs, modality_sizes=None, inputs_without_pos=None, subsampled_points=None):
raise NotImplementedError
@property
... |
class PerceiverAbstractDecoder(nn.Module, metaclass=abc.ABCMeta):
'''Perceiver abstract decoder.'''
@abc.abstractmethod
def decoder_query(self, inputs, modality_sizes=None, inputs_without_pos=None, subsampled_points=None):
pass
@property
@abc.abstractmethod
def num_query_channels(self):... | 8 | 1 | 2 | 0 | 2 | 0 | 1 | 0.09 | 2 | 1 | 0 | 6 | 3 | 0 | 3 | 33 | 15 | 3 | 11 | 7 | 3 | 1 | 7 | 4 | 3 | 1 | 3 | 0 | 3 |
4,481 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverAbstractPositionEncoding | import abc
from torch import nn
class PerceiverAbstractPositionEncoding(nn.Module, metaclass=abc.ABCMeta):
"""Perceiver abstract position encoding."""
@property
@abc.abstractmethod
def num_dimensions(self) -> int:
raise NotImplementedError
@abc.abstractmethod
def output_size(self, *ar... |
class PerceiverAbstractPositionEncoding(nn.Module, metaclass=abc.ABCMeta):
'''Perceiver abstract position encoding.'''
@property
@abc.abstractmethod
def num_dimensions(self) -> int:
pass
@abc.abstractmethod
def output_size(self, *args, **kwargs) -> int:
pass
@abc.abstractmet... | 8 | 1 | 2 | 0 | 2 | 0 | 1 | 0.09 | 2 | 2 | 0 | 2 | 3 | 0 | 3 | 33 | 15 | 3 | 11 | 7 | 3 | 1 | 7 | 4 | 3 | 1 | 3 | 0 | 3 |
4,482 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverAttention | from typing import Any, Callable, Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
import torch
from torch import nn
class PerceiverAttention(nn.Module):
"""Attention module, including a dense block."""
def __init__(self, co... |
class PerceiverAttention(nn.Module):
'''Attention module, including a dense block.'''
def __init__(self, config, is_cross_attention=False, qk_channels=None, v_channels=None, num_heads=1, q_dim=None, kv_dim=None, use_query_residual=True):
pass
def prune_heads(self, heads):
pass
def fo... | 4 | 1 | 31 | 2 | 27 | 3 | 4 | 0.12 | 1 | 7 | 2 | 0 | 3 | 4 | 3 | 13 | 98 | 8 | 81 | 31 | 59 | 10 | 39 | 13 | 35 | 8 | 1 | 2 | 12 |
4,483 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverAudioPostprocessor | import torch
from torch import nn
from .configuration_perceiver import PerceiverConfig
from typing import Any, Callable, Optional, Union
class PerceiverAudioPostprocessor(nn.Module):
"""
Audio postprocessing for Perceiver. Can be used to convert the decoder output to audio features.
Args:
config (... |
class PerceiverAudioPostprocessor(nn.Module):
'''
Audio postprocessing for Perceiver. Can be used to convert the decoder output to audio features.
Args:
config ([*PerceiverConfig*]):
Model configuration.
in_channels (`int`):
Number of channels in the input.
p... | 3 | 1 | 6 | 1 | 4 | 1 | 2 | 1.33 | 1 | 6 | 1 | 0 | 2 | 1 | 2 | 12 | 25 | 5 | 9 | 5 | 6 | 12 | 9 | 5 | 6 | 2 | 1 | 1 | 3 |
4,484 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverAudioPreprocessor | import torch
from typing import Any, Callable, Optional, Union
class PerceiverAudioPreprocessor(AbstractPreprocessor):
"""
Audio preprocessing for Perceiver Encoder.
Args:
config ([*PerceiverConfig*]):
Model configuration.
prep_type (`str`, *optional*, defaults to `"patches"`):... |
class PerceiverAudioPreprocessor(AbstractPreprocessor):
'''
Audio preprocessing for Perceiver Encoder.
Args:
config ([*PerceiverConfig*]):
Model configuration.
prep_type (`str`, *optional*, defaults to `"patches"`):
Preprocessor type to use. Only "patches" is support... | 6 | 2 | 19 | 3 | 15 | 2 | 3 | 0.43 | 1 | 6 | 0 | 0 | 4 | 7 | 4 | 15 | 101 | 15 | 61 | 35 | 39 | 26 | 36 | 18 | 31 | 5 | 2 | 1 | 12 |
4,485 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverBasicDecoder | from typing import Any, Callable, Optional, Union
from .configuration_perceiver import PerceiverConfig
from torch import nn
import torch
import numpy as np
class PerceiverBasicDecoder(PerceiverAbstractDecoder):
"""
Cross-attention-based decoder. This class can be used to decode the final hidden states of the l... |
class PerceiverBasicDecoder(PerceiverAbstractDecoder):
'''
Cross-attention-based decoder. This class can be used to decode the final hidden states of the latents using a
cross-attention operation, in which the latents produce keys and values.
The shape of the output of this class depends on how one def... | 6 | 1 | 36 | 3 | 28 | 5 | 6 | 0.46 | 1 | 9 | 3 | 0 | 4 | 13 | 4 | 37 | 184 | 18 | 115 | 51 | 86 | 53 | 63 | 27 | 58 | 9 | 4 | 2 | 22 |
4,486 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverBasicVideoAutoencodingDecoder | import torch
from .configuration_perceiver import PerceiverConfig
from typing import Any, Callable, Optional, Union
class PerceiverBasicVideoAutoencodingDecoder(PerceiverAbstractDecoder):
"""
Cross-attention based video-autoencoding decoder. Light-weight wrapper of [*PerceiverBasicDecoder*] with video
resh... |
class PerceiverBasicVideoAutoencodingDecoder(PerceiverAbstractDecoder):
'''
Cross-attention based video-autoencoding decoder. Light-weight wrapper of [*PerceiverBasicDecoder*] with video
reshaping logic.
Args:
config ([*PerceiverConfig*]):
Model configuration.
output_shape (... | 6 | 1 | 8 | 1 | 8 | 1 | 1 | 0.44 | 1 | 8 | 3 | 0 | 4 | 3 | 4 | 37 | 51 | 7 | 32 | 15 | 22 | 14 | 17 | 10 | 12 | 2 | 4 | 1 | 5 |
4,487 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverClassificationDecoder | import torch
from typing import Any, Callable, Optional, Union
class PerceiverClassificationDecoder(PerceiverAbstractDecoder):
"""
Cross-attention based classification decoder. Light-weight wrapper of [`PerceiverBasicDecoder`] for logit output.
Will turn the output of the Perceiver encoder which is of shap... |
class PerceiverClassificationDecoder(PerceiverAbstractDecoder):
'''
Cross-attention based classification decoder. Light-weight wrapper of [`PerceiverBasicDecoder`] for logit output.
Will turn the output of the Perceiver encoder which is of shape (batch_size, num_latents, d_latents) to a tensor of
shape... | 6 | 1 | 7 | 1 | 6 | 1 | 1 | 0.37 | 1 | 6 | 2 | 0 | 4 | 2 | 4 | 37 | 44 | 8 | 27 | 16 | 15 | 10 | 13 | 9 | 8 | 1 | 4 | 0 | 4 |
4,488 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverClassificationPostprocessor | import torch
from torch import nn
from typing import Any, Callable, Optional, Union
from .configuration_perceiver import PerceiverConfig
class PerceiverClassificationPostprocessor(nn.Module):
"""
Classification postprocessing for Perceiver. Can be used to convert the decoder output to classification logits.
... |
class PerceiverClassificationPostprocessor(nn.Module):
'''
Classification postprocessing for Perceiver. Can be used to convert the decoder output to classification logits.
Args:
config ([*PerceiverConfig*]):
Model configuration.
in_channels (`int`):
Number of channel... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 1.14 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 12 | 18 | 3 | 7 | 5 | 4 | 8 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,489 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverEmbeddingDecoder | import torch
from torch import nn
from .configuration_perceiver import PerceiverConfig
class PerceiverEmbeddingDecoder(nn.Module):
"""
Module to decode embeddings (for masked language modeling).
Args:
config ([`PerceiverConfig`]):
Model configuration.
"""
def __init__(self, co... |
class PerceiverEmbeddingDecoder(nn.Module):
'''
Module to decode embeddings (for masked language modeling).
Args:
config ([`PerceiverConfig`]):
Model configuration.
'''
def __init__(self, config: PerceiverConfig) -> None:
pass
def forward(self, hidden_states: torch... | 3 | 1 | 6 | 1 | 5 | 1 | 1 | 0.64 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 22 | 4 | 11 | 8 | 8 | 7 | 11 | 8 | 8 | 1 | 1 | 0 | 2 |
4,490 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverEmbeddings | import torch
from torch import nn
class PerceiverEmbeddings(nn.Module):
"""Construct the latent embeddings."""
def __init__(self, config):
super().__init__()
self.latents = nn.Parameter(torch.randn(config.num_latents, config.d_latents))
def forward(self, batch_size: int):
return s... |
class PerceiverEmbeddings(nn.Module):
'''Construct the latent embeddings.'''
def __init__(self, config):
pass
def forward(self, batch_size: int):
pass | 3 | 1 | 3 | 0 | 3 | 1 | 1 | 0.33 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 2 | 6 | 4 | 3 | 2 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
4,491 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverEncoder | from ...modeling_outputs import BaseModelOutputWithCrossAttentions
import torch
from torch import nn
from typing import Any, Callable, Optional, Union
class PerceiverEncoder(nn.Module):
"""The Perceiver Encoder: a scalable, fully attentional encoder."""
def __init__(self, config, kv_dim=None):
super()... |
class PerceiverEncoder(nn.Module):
'''The Perceiver Encoder: a scalable, fully attentional encoder.'''
def __init__(self, config, kv_dim=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, inputs... | 3 | 1 | 55 | 6 | 46 | 3 | 8 | 0.08 | 1 | 9 | 2 | 0 | 2 | 3 | 2 | 12 | 113 | 14 | 92 | 26 | 79 | 7 | 36 | 16 | 33 | 12 | 1 | 3 | 16 |
4,492 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverForImageClassificationConvProcessing | import torch
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@auto_docstring(custom_intro='\n Example use of Perceiver for image classification, for tasks such as ImageNet.\n\n This model uses a 2D conv+maxpool preprocessing network. As s... | @auto_docstring(custom_intro='\n Example use of Perceiver for image classification, for tasks such as ImageNet.\n\n This model uses a 2D conv+maxpool preprocessing network. As shown in the paper, this model can achieve a top-1 accuracy\n of 82.1 on ImageNet.\n\n [`PerceiverForImageClassificationLearned`... | 5 | 1 | 62 | 8 | 42 | 13 | 8 | 0.3 | 1 | 9 | 4 | 0 | 2 | 2 | 2 | 3 | 128 | 16 | 86 | 23 | 71 | 26 | 35 | 12 | 32 | 15 | 2 | 3 | 16 |
4,493 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverForImageClassificationFourier | from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
from typing import Any, Callable, Optional, Union
@auto_docstring(custom_intro='\n Example use of Perceiver for image classification, for tasks such as ImageNet.\n\n This model uses fixed 2D Fourier position embeddings. As show... | @auto_docstring(custom_intro='\n Example use of Perceiver for image classification, for tasks such as ImageNet.\n\n This model uses fixed 2D Fourier position embeddings. As shown in the paper, this model can achieve a top-1 accuracy of\n 79.0 on ImageNet, and 84.5 when pre-trained on a large-scale dataset ... | 5 | 1 | 62 | 8 | 41 | 13 | 8 | 0.31 | 1 | 9 | 4 | 0 | 2 | 2 | 2 | 3 | 127 | 16 | 85 | 23 | 70 | 26 | 35 | 12 | 32 | 15 | 2 | 3 | 16 |
4,494 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverForImageClassificationLearned | import torch
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@auto_docstring(custom_intro='\n Example use of Perceiver for image classification, for tasks such as ImageNet.\n\n This model uses learned position embeddings. In other words, ... | @auto_docstring(custom_intro='\n Example use of Perceiver for image classification, for tasks such as ImageNet.\n\n This model uses learned position embeddings. In other words, this model is not given any privileged information about\n the structure of images. As shown in the paper, this model can achieve ... | 5 | 1 | 63 | 8 | 42 | 13 | 8 | 0.3 | 1 | 9 | 4 | 0 | 2 | 2 | 2 | 3 | 129 | 17 | 86 | 24 | 70 | 26 | 35 | 12 | 32 | 15 | 2 | 3 | 16 |
4,495 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverForMaskedLM | from .configuration_perceiver import PerceiverConfig
import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Any, Callable, Optional, Union
@auto_docstring(custom_intro='\n Example use of Perceiver for mas... | @auto_docstring(custom_intro='\n Example use of Perceiver for masked language modeling.\n ')
class PerceiverForMaskedLM(PerceiverPreTrainedModel):
def __init__(self, config: PerceiverConfig):
pass
@auto_docstring
def forward(self, inputs: Optional[torch.Tensor]=None, attention_mask: Optional[... | 5 | 1 | 64 | 11 | 33 | 22 | 5 | 0.62 | 1 | 10 | 6 | 0 | 2 | 2 | 2 | 3 | 132 | 22 | 69 | 23 | 54 | 43 | 23 | 12 | 20 | 8 | 2 | 1 | 9 |
4,496 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverForMultimodalAutoencoding | from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
from typing import Any, Callable, Optional, Union
from .configuration_perceiver import PerceiverConfig
@auto_docstring(custom_intro='\n Example use of Perceiver for multimodal (video) autoencoding, for tasks such as Kinetics-700.\... | null | 5 | 1 | 100 | 10 | 68 | 22 | 4 | 0.32 | 1 | 20 | 15 | 0 | 2 | 1 | 2 | 3 | 203 | 21 | 138 | 24 | 123 | 44 | 21 | 13 | 18 | 6 | 2 | 1 | 7 |
4,497 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverForOpticalFlow | import torch
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@auto_docstring(custom_intro='\n Example use of Perceiver for optical flow, for tasks such as Sintel and KITTI. [`PerceiverForOpticalFlow`] uses\n [`~models.perceiver.modeling_p... | @auto_docstring(custom_intro='\n Example use of Perceiver for optical flow, for tasks such as Sintel and KITTI. [`PerceiverForOpticalFlow`] uses\n [`~models.perceiver.modeling_perceiver.PerceiverImagePreprocessor`] (with *prep_type="patches"*) to preprocess the\n input images, and [`~models.perceiver.model... | 5 | 1 | 55 | 7 | 36 | 12 | 4 | 0.32 | 1 | 8 | 4 | 0 | 2 | 1 | 2 | 3 | 113 | 14 | 75 | 21 | 61 | 24 | 19 | 11 | 16 | 6 | 2 | 1 | 7 |
4,498 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverForSequenceClassification | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@auto_docstring(custom_intro='\n Example use of Perceiver for text classification.\n ')
class PerceiverForSequenceC... | @auto_docstring(custom_intro='\n Example use of Perceiver for text classification.\n ')
class PerceiverForSequenceClassification(PerceiverPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, inputs: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Te... | 5 | 1 | 53 | 8 | 36 | 10 | 8 | 0.26 | 1 | 9 | 4 | 0 | 2 | 2 | 2 | 3 | 109 | 16 | 74 | 22 | 59 | 19 | 34 | 11 | 31 | 15 | 2 | 3 | 16 |
4,499 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverFourierPositionEncoding | import torch
from typing import Any, Callable, Optional, Union
class PerceiverFourierPositionEncoding(PerceiverAbstractPositionEncoding):
"""Fourier (Sinusoidal) position encoding."""
def __init__(self, num_bands, max_resolution, concat_pos=True, sine_only=False):
super().__init__()
self.num_b... |
class PerceiverFourierPositionEncoding(PerceiverAbstractPositionEncoding):
'''Fourier (Sinusoidal) position encoding.'''
def __init__(self, num_bands, max_resolution, concat_pos=True, sine_only=False):
pass
@property
def num_dimensions(self) -> int:
pass
def output_size(self):
... | 6 | 2 | 9 | 0 | 8 | 0 | 2 | 0.06 | 1 | 2 | 0 | 0 | 4 | 4 | 4 | 37 | 42 | 5 | 35 | 20 | 22 | 2 | 21 | 12 | 16 | 3 | 4 | 1 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.