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,900 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertPooler | import torch
from torch import nn
class RemBertPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
first_tok... |
class RemBertPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
4,901 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertPreTrainedModel | from .configuration_rembert import RemBertConfig
from ...utils import auto_docstring, logging
from torch import nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class RemBertPreTrainedModel(PreTrainedModel):
config: RemBertConfig
base_model_prefix = 'rembert'
supports_gradient_checkpointing... | @auto_docstring
class RemBertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.41 | 1 | 0 | 0 | 7 | 1 | 0 | 1 | 1 | 26 | 2 | 17 | 6 | 15 | 7 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
4,902 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertPredictionHeadTransform | import torch
from ...activations import ACT2FN
from torch import nn
class RemBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
if isinstance(config.hidden_act, str):
self.transfo... |
class RemBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
4,903 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertSelfAttention | from torch import nn
import torch
from ...utils.deprecation import deprecate_kwarg
import math
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
class RemBertSelfAttention(nn.Module):
def __init__(self, config, layer_idx=None):
super().__init__()
... |
class RemBertSelfAttention(nn.Module):
def __init__(self, config, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTen... | 4 | 0 | 33 | 6 | 22 | 6 | 4 | 0.25 | 1 | 5 | 0 | 0 | 3 | 8 | 3 | 13 | 103 | 19 | 67 | 32 | 54 | 17 | 52 | 23 | 48 | 9 | 1 | 1 | 12 |
4,904 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertSelfOutput | import torch
from torch import nn
class RemBertSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout... |
class RemBertSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
4,905 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/tokenization_rembert.py | transformers.models.rembert.tokenization_rembert.RemBertTokenizer | import os
from ...utils.import_utils import requires
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from shutil import copyfile
import sentencepiece as spm
from typing import Optional
@requires(backends=('sentencepiece',))
class RemBertTokenizer(PreTrainedTokenizer):
"""
Construct a RemBERT ... | @requires(backends=('sentencepiece',))
class RemBertTokenizer(PreTrainedTokenizer):
'''
Construct a RemBERT 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... | 15 | 6 | 13 | 1 | 8 | 4 | 2 | 0.81 | 1 | 6 | 0 | 0 | 13 | 6 | 13 | 102 | 231 | 41 | 105 | 53 | 70 | 85 | 66 | 31 | 52 | 5 | 3 | 2 | 24 |
4,906 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/tokenization_rembert_fast.py | transformers.models.rembert.tokenization_rembert_fast.RemBertTokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
import os
from shutil import copyfile
from ...tokenization_utils import AddedToken
class RemBertTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" RemBert tokenizer (backed by HuggingFace's *tokenizers* libra... |
class RemBertTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" RemBert 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... | 5 | 3 | 23 | 3 | 13 | 7 | 3 | 1.02 | 1 | 5 | 0 | 0 | 6 | 4 | 6 | 94 | 192 | 28 | 81 | 40 | 52 | 83 | 40 | 18 | 33 | 5 | 3 | 2 | 17 |
4,907 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/configuration_resnet.py | transformers.models.resnet.configuration_resnet.ResNetConfig | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from ...configuration_utils import PretrainedConfig
class ResNetConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ResNetModel`]. It is used to i... |
class ResNetConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ResNetModel`]. It is used to instantiate an
ResNet model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the default... | 2 | 1 | 29 | 0 | 29 | 0 | 2 | 1.47 | 2 | 3 | 0 | 0 | 1 | 11 | 1 | 6 | 87 | 8 | 32 | 27 | 17 | 47 | 17 | 14 | 15 | 2 | 1 | 1 | 2 |
4,908 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/configuration_resnet.py | transformers.models.resnet.configuration_resnet.ResNetOnnxConfig | from packaging import version
from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
class ResNetOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedD... |
class ResNetOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass | 5 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 0 | 2 | 2 | 14 | 2 | 12 | 6 | 7 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
4,909 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/convert_resnet_to_pytorch.py | transformers.models.resnet.convert_resnet_to_pytorch.ModuleTransfer | from dataclasses import dataclass, field
import torch.nn as nn
from torch import Tensor
@dataclass
class ModuleTransfer:
src: nn.Module
dest: nn.Module
verbose: int = 0
src_skip: list = field(default_factory=list)
dest_skip: list = field(default_factory=list)
def __call__(self, x: Tensor):
... | @dataclass
class ModuleTransfer:
def __call__(self, x: Tensor):
'''
Transfer the weights of `self.src` to `self.dest` by performing a forward pass using `x` as input. Under the
hood we tracked all the operations in both modules.
'''
pass | 3 | 1 | 21 | 3 | 14 | 4 | 4 | 0.2 | 0 | 7 | 1 | 0 | 1 | 0 | 1 | 1 | 28 | 4 | 20 | 8 | 18 | 4 | 17 | 8 | 15 | 4 | 0 | 2 | 4 |
4,910 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/convert_resnet_to_pytorch.py | transformers.models.resnet.convert_resnet_to_pytorch.Tracker | from dataclasses import dataclass, field
import torch.nn as nn
from torch import Tensor
@dataclass
class Tracker:
module: nn.Module
traced: list[nn.Module] = field(default_factory=list)
handles: list = field(default_factory=list)
def _forward_hook(self, m, inputs: Tensor, outputs: Tensor):
has... | @dataclass
class Tracker:
def _forward_hook(self, m, inputs: Tensor, outputs: Tensor):
pass
def __call__(self, x: Tensor):
pass
@property
def parametrized(self):
pass | 6 | 0 | 4 | 0 | 4 | 0 | 2 | 0.06 | 0 | 3 | 0 | 0 | 3 | 0 | 3 | 3 | 21 | 3 | 17 | 9 | 12 | 1 | 16 | 8 | 12 | 2 | 0 | 1 | 5 |
4,911 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetBackbone | from torch import Tensor, nn
from ...utils import auto_docstring, logging
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from typing import Optional
from ...utils.backbone_utils import BackboneMixin
@auto_do... | @auto_docstring(custom_intro='\n ResNet backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class ResNetBackbone(ResNetPreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Tensor, output_hidden_states: Optional[bool]... | 5 | 1 | 33 | 7 | 16 | 11 | 5 | 0.62 | 2 | 7 | 3 | 0 | 2 | 3 | 2 | 15 | 70 | 15 | 34 | 15 | 27 | 21 | 24 | 12 | 21 | 8 | 2 | 2 | 9 |
4,912 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetBasicLayer | from ...activations import ACT2FN
from torch import Tensor, nn
class ResNetBasicLayer(nn.Module):
"""
A classic ResNet's residual layer composed by two `3x3` convolutions.
"""
def __init__(self, in_channels: int, out_channels: int, stride: int=1, activation: str='relu'):
super().__init__()
... |
class ResNetBasicLayer(nn.Module):
'''
A classic ResNet's residual layer composed by two `3x3` convolutions.
'''
def __init__(self, in_channels: int, out_channels: int, stride: int=1, activation: str='relu'):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 9 | 0 | 9 | 0 | 2 | 0.16 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 12 | 24 | 2 | 19 | 8 | 16 | 3 | 14 | 8 | 11 | 2 | 1 | 0 | 3 |
4,913 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetBottleNeckLayer | from ...activations import ACT2FN
from torch import Tensor, nn
class ResNetBottleNeckLayer(nn.Module):
"""
A classic ResNet's bottleneck layer composed by three `3x3` convolutions.
The first `1x1` convolution reduces the input by a factor of `reduction` in order to make the second `3x3`
convolution fa... |
class ResNetBottleNeckLayer(nn.Module):
'''
A classic ResNet's bottleneck layer composed by three `3x3` convolutions.
The first `1x1` convolution reduces the input by a factor of `reduction` in order to make the second `3x3`
convolution faster. The last `1x1` convolution remaps the reduced features to ... | 3 | 1 | 15 | 0 | 15 | 0 | 3 | 0.19 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 40 | 3 | 31 | 17 | 20 | 6 | 15 | 9 | 12 | 4 | 1 | 0 | 5 |
4,914 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetConvLayer | from ...activations import ACT2FN
from torch import Tensor, nn
class ResNetConvLayer(nn.Module):
def __init__(self, in_channels: int, out_channels: int, kernel_size: int=3, stride: int=1, activation: str='relu'):
super().__init__()
self.convolution = nn.Conv2d(in_channels, out_channels, kernel_siz... |
class ResNetConvLayer(nn.Module):
def __init__(self, in_channels: int, out_channels: int, kernel_size: int=3, stride: int=1, activation: str='relu'):
pass
def forward(self, input: Tensor) -> Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 16 | 1 | 15 | 9 | 10 | 0 | 11 | 7 | 8 | 2 | 1 | 0 | 3 |
4,915 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetEmbeddings | from .configuration_resnet import ResNetConfig
from torch import Tensor, nn
class ResNetEmbeddings(nn.Module):
"""
ResNet Embeddings (stem) composed of a single aggressive convolution.
"""
def __init__(self, config: ResNetConfig):
super().__init__()
self.embedder = ResNetConvLayer(conf... |
class ResNetEmbeddings(nn.Module):
'''
ResNet Embeddings (stem) composed of a single aggressive convolution.
'''
def __init__(self, config: ResNetConfig):
pass
def forward(self, pixel_values: Tensor) -> Tensor:
pass | 3 | 1 | 8 | 0 | 8 | 0 | 2 | 0.18 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 12 | 22 | 2 | 17 | 8 | 14 | 3 | 13 | 8 | 10 | 2 | 1 | 1 | 3 |
4,916 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetEncoder | from .configuration_resnet import ResNetConfig
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from torch import Tensor, nn
class ResNetEncoder(nn.Module):
def __init__(self, config: ResNetConfig):
... |
class ResNetEncoder(nn.Module):
def __init__(self, config: ResNetConfig):
pass
def forward(self, hidden_state: Tensor, output_hidden_states: bool=False, return_dict: bool=True) -> BaseModelOutputWithNoAttention:
pass | 3 | 0 | 19 | 3 | 16 | 1 | 5 | 0.03 | 1 | 8 | 3 | 0 | 2 | 1 | 2 | 12 | 39 | 6 | 32 | 10 | 27 | 1 | 19 | 8 | 16 | 6 | 1 | 2 | 9 |
4,917 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetForImageClassification | from ...utils import auto_docstring, logging
from typing import Optional
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from torch import Tensor, nn
import torch
@auto_docstring(custom_intro='\n ResNet Mo... | @auto_docstring(custom_intro='\n ResNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n ImageNet.\n ')
class ResNetForImageClassification(ResNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pix... | 5 | 1 | 30 | 4 | 23 | 4 | 8 | 0.13 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 68 | 8 | 53 | 19 | 37 | 7 | 32 | 12 | 29 | 13 | 2 | 3 | 15 |
4,918 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetModel | from torch import Tensor, nn
from ...utils import auto_docstring, logging
from typing import Optional
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
@auto_docstring
class ResNetModel(ResNetPreTrainedModel):
... | @auto_docstring
class ResNetModel(ResNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Tensor, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> BaseModelOutputWithPoolingAndNoAttention:
pass | 5 | 0 | 17 | 3 | 14 | 1 | 3 | 0.03 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 44 | 7 | 36 | 14 | 23 | 1 | 18 | 11 | 15 | 4 | 2 | 1 | 5 |
4,919 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetPreTrainedModel | from ...modeling_utils import PreTrainedModel
from .configuration_resnet import ResNetConfig
import math
from torch import Tensor, nn
from ...utils import auto_docstring, logging
@auto_docstring
class ResNetPreTrainedModel(PreTrainedModel):
config: ResNetConfig
base_model_prefix = 'resnet'
main_input_name ... | @auto_docstring
class ResNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 13 | 0 | 12 | 1 | 6 | 0.29 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 24 | 2 | 17 | 8 | 15 | 5 | 15 | 8 | 13 | 6 | 1 | 2 | 6 |
4,920 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetShortCut | from torch import Tensor, nn
class ResNetShortCut(nn.Module):
"""
ResNet shortcut, used to project the residual features to the correct size. If needed, it is also used to
downsample the input using `stride=2`.
"""
def __init__(self, in_channels: int, out_channels: int, stride: int=2):
sup... |
class ResNetShortCut(nn.Module):
'''
ResNet shortcut, used to project the residual features to the correct size. If needed, it is also used to
downsample the input using `stride=2`.
'''
def __init__(self, in_channels: int, out_channels: int, stride: int=2):
pass
def forward(self, inpu... | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.44 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 15 | 2 | 9 | 6 | 6 | 4 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,921 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/resnet/modeling_resnet.py | transformers.models.resnet.modeling_resnet.ResNetStage | from torch import Tensor, nn
from .configuration_resnet import ResNetConfig
class ResNetStage(nn.Module):
"""
A ResNet stage composed by stacked layers.
"""
def __init__(self, config: ResNetConfig, in_channels: int, out_channels: int, stride: int=2, depth: int=2):
super().__init__()
la... |
class ResNetStage(nn.Module):
'''
A ResNet stage composed by stacked layers.
'''
def __init__(self, config: ResNetConfig, in_channels: int, out_channels: int, stride: int=2, depth: int=2):
pass
def forward(self, input: Tensor) -> Tensor:
pass | 3 | 1 | 15 | 1 | 14 | 0 | 3 | 0.1 | 1 | 7 | 3 | 0 | 2 | 1 | 2 | 12 | 36 | 4 | 29 | 16 | 19 | 3 | 13 | 8 | 10 | 3 | 1 | 1 | 5 |
4,922 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/configuration_roberta.py | transformers.models.roberta.configuration_roberta.RobertaConfig | from ...configuration_utils import PretrainedConfig
class RobertaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`RobertaModel`] or a [`TFRobertaModel`]. It is
used to instantiate a RoBERTa model according to the specified arguments, defining the model archite... |
class RobertaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`RobertaModel`] or a [`TFRobertaModel`]. It is
used to instantiate a RoBERTa model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the de... | 2 | 1 | 39 | 1 | 38 | 0 | 1 | 1.45 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 109 | 11 | 40 | 39 | 17 | 58 | 19 | 18 | 17 | 1 | 1 | 0 | 1 |
4,923 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/configuration_roberta.py | transformers.models.roberta.configuration_roberta.RobertaOnnxConfig | from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
class RobertaOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequenc... |
class RobertaOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 11 | 0 | 11 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 13 | 0 | 13 | 4 | 10 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
4,924 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaAttention | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...cache_utils import Cache, EncoderDecoderCache
from typing import Callable, Optional, Union
import torch.nn as nn
from ...processing_utils import Unpack
import torch
from ...utils import TransformersKwarg... |
class RobertaAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None,... | 4 | 0 | 15 | 1 | 14 | 1 | 1 | 0.07 | 1 | 5 | 1 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 43 | 20 | 30 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
4,925 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaClassificationHead | import torch.nn as nn
import torch
class RobertaClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
classifier_dropout = config.classifier_dropou... |
class RobertaClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 8 | 0 | 8 | 1 | 2 | 0.12 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 2 | 17 | 8 | 14 | 2 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
4,926 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaEmbeddings | import torch.nn as nn
from typing import Callable, Optional, Union
import torch
class RobertaEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size... |
class RobertaEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor... | 7 | 3 | 26 | 3 | 18 | 5 | 3 | 0.32 | 1 | 1 | 0 | 0 | 3 | 7 | 3 | 13 | 87 | 13 | 56 | 23 | 50 | 18 | 43 | 21 | 39 | 8 | 1 | 2 | 10 |
4,927 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaEncoder | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...processing_utils import Unpack
from... |
class RobertaEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: Optional[tor... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
4,928 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaForCausalLM | from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
i... | @auto_docstring(custom_intro='\n RoBERTa Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class RobertaForCausalLM(RobertaPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, n... | 8 | 1 | 26 | 3 | 15 | 7 | 2 | 0.45 | 2 | 7 | 3 | 0 | 5 | 2 | 5 | 6 | 138 | 22 | 80 | 34 | 55 | 36 | 33 | 16 | 27 | 6 | 2 | 1 | 12 |
4,929 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaForMaskedLM | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClas... | @auto_docstring
class RobertaForMaskedLM(RobertaPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.... | 8 | 1 | 19 | 2 | 15 | 3 | 2 | 0.14 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 91 | 11 | 70 | 29 | 42 | 10 | 27 | 14 | 22 | 5 | 2 | 1 | 9 |
4,930 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaForMultipleChoice | from typing import Callable, Optional, Union
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils.generic import can_return_tuple, check_model_inputs
import torch.nn as nn
from ...proce... | @auto_docstring
class RobertaForMultipleChoice(RobertaPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=N... | 6 | 1 | 38 | 4 | 30 | 4 | 6 | 0.12 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 83 | 9 | 66 | 32 | 45 | 8 | 29 | 19 | 26 | 11 | 2 | 1 | 12 |
4,931 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaForQuestionAnswering | from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutpu... | @auto_docstring
class RobertaForQuestionAnswering(RobertaPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor... | 6 | 1 | 41 | 5 | 30 | 7 | 4 | 0.19 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 92 | 10 | 69 | 30 | 45 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
4,932 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaForSequenceClassification | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils.generic import can_return_tup... | @auto_docstring(custom_intro='\n RoBERTa Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ')
class RobertaForSequenceClassification(RobertaPreTrainedModel):
def __init__(self, config):
pass
@can_return... | 6 | 1 | 40 | 4 | 33 | 4 | 7 | 0.11 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 3 | 90 | 8 | 74 | 26 | 51 | 8 | 34 | 13 | 31 | 12 | 2 | 3 | 13 |
4,933 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaForTokenClassification | from ...utils.generic import can_return_tuple, check_model_inputs
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, ... | @auto_docstring
class RobertaForTokenClassification(RobertaPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTens... | 6 | 1 | 33 | 4 | 26 | 3 | 4 | 0.1 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 76 | 9 | 61 | 27 | 38 | 6 | 24 | 14 | 21 | 5 | 2 | 1 | 7 |
4,934 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaIntermediate | import torch
import torch.nn as nn
from ...activations import ACT2FN, gelu
class RobertaIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.inter... |
class RobertaIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
4,935 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaLMHead | import torch
from ...activations import ACT2FN, gelu
import torch.nn as nn
class RobertaLMHead(nn.Module):
"""Roberta Head for masked language modeling."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.layer_norm = nn... |
class RobertaLMHead(nn.Module):
'''Roberta Head for masked language modeling.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass
def _tie_weights(self):
pass | 4 | 1 | 8 | 1 | 6 | 1 | 1 | 0.21 | 1 | 1 | 0 | 0 | 3 | 4 | 3 | 13 | 29 | 6 | 19 | 9 | 15 | 4 | 18 | 9 | 14 | 2 | 1 | 1 | 4 |
4,936 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaLayer | import torch
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...cache_utils import Cache, EncoderDecoderCache
from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
fr... |
class RobertaLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encod... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.1 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 84 | 9 | 70 | 32 | 57 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
4,937 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaModel | from ...processing_utils import Unpack
import torch
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, M... | null | 12 | 2 | 37 | 4 | 25 | 8 | 5 | 0.35 | 1 | 8 | 4 | 0 | 5 | 6 | 5 | 6 | 211 | 29 | 135 | 45 | 108 | 47 | 65 | 29 | 59 | 21 | 2 | 2 | 27 |
4,938 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaOutput | import torch.nn as nn
import torch
class RobertaOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Drop... |
class RobertaOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
4,939 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaPooler | import torch.nn as nn
import torch
class RobertaPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
first_to... |
class RobertaPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
4,940 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaPreTrainedModel | from .configuration_roberta import RobertaConfig
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch.nn as nn
@auto_docstring
class RobertaPreTrainedModel(PreTrainedModel):
config_class = ... | @auto_docstring
class RobertaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.44 | 1 | 0 | 0 | 7 | 1 | 0 | 1 | 1 | 28 | 2 | 18 | 7 | 16 | 8 | 16 | 7 | 14 | 6 | 1 | 2 | 6 |
4,941 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaSelfAttention | import torch
from ...cache_utils import Cache, EncoderDecoderCache
import torch.nn as nn
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_... |
class RobertaSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_value: Optional... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 1 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
4,942 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/modeling_roberta.py | transformers.models.roberta.modeling_roberta.RobertaSelfOutput | import torch.nn as nn
import torch
class RobertaSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropou... |
class RobertaSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
4,943 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/tokenization_roberta.py | transformers.models.roberta.tokenization_roberta.RobertaTokenizer | from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import regex as re
from typing import Optional
import os
import json
class RobertaTokenizer(PreTrainedTokenizer):
"""
Constructs a RoBERTa tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding.
This tokenizer has ... |
class RobertaTokenizer(PreTrainedTokenizer):
'''
Constructs a RoBERTa tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be encoded differently whether it is... | 15 | 8 | 18 | 2 | 13 | 4 | 3 | 0.61 | 1 | 11 | 0 | 0 | 13 | 9 | 13 | 102 | 325 | 52 | 171 | 71 | 136 | 105 | 122 | 46 | 108 | 9 | 3 | 3 | 39 |
4,944 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta/tokenization_roberta_fast.py | transformers.models.roberta.tokenization_roberta_fast.RobertaTokenizerFast | from .tokenization_roberta import RobertaTokenizer
from tokenizers import processors
import json
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
from ...tokenization_utils_base import AddedToken, BatchEncoding
class RobertaTokenizerFast(PreTrainedTokenizerFast):
"""
C... |
class RobertaTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" RoBERTa tokenizer (backed by HuggingFace's *tokenizers* library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sente... | 11 | 4 | 17 | 2 | 12 | 3 | 3 | 0.83 | 1 | 5 | 1 | 0 | 8 | 1 | 8 | 96 | 229 | 42 | 102 | 45 | 73 | 85 | 57 | 25 | 48 | 8 | 3 | 2 | 20 |
4,945 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/configuration_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.configuration_roberta_prelayernorm.RobertaPreLayerNormConfig | from ...configuration_utils import PretrainedConfig
class RobertaPreLayerNormConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`RobertaPreLayerNormModel`] or a [`TFRobertaPreLayerNormModel`]. It is
used to instantiate a RoBERTa-PreLayerNorm model according to th... |
class RobertaPreLayerNormConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`RobertaPreLayerNormModel`] or a [`TFRobertaPreLayerNormModel`]. It is
used to instantiate a RoBERTa-PreLayerNorm model according to the specified arguments, defining the model architectu... | 2 | 1 | 39 | 1 | 38 | 0 | 1 | 1.45 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 109 | 11 | 40 | 39 | 17 | 58 | 19 | 18 | 17 | 1 | 1 | 0 | 1 |
4,946 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/configuration_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.configuration_roberta_prelayernorm.RobertaPreLayerNormOnnxConfig | from collections import OrderedDict
from ...onnx import OnnxConfig
from collections.abc import Mapping
class RobertaPreLayerNormOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice',... |
class RobertaPreLayerNormOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 11 | 0 | 11 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 13 | 0 | 13 | 4 | 10 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
4,947 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormAttention | from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torc... |
class RobertaPreLayerNormAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatT... | 4 | 0 | 15 | 1 | 14 | 1 | 1 | 0.09 | 1 | 6 | 2 | 0 | 3 | 4 | 3 | 13 | 50 | 4 | 43 | 22 | 30 | 4 | 24 | 13 | 20 | 2 | 1 | 1 | 4 |
4,948 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormClassificationHead | import torch
from torch import nn
class RobertaPreLayerNormClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
classifier_dropout = config.classi... |
class RobertaPreLayerNormClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 8 | 0 | 8 | 1 | 2 | 0.12 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 2 | 17 | 8 | 14 | 2 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
4,949 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormEmbeddings | from typing import Callable, Optional, Union
from torch import nn
import torch
class RobertaPreLayerNormEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config... |
class RobertaPreLayerNormEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torc... | 7 | 3 | 26 | 3 | 18 | 5 | 3 | 0.32 | 1 | 1 | 0 | 0 | 3 | 7 | 3 | 13 | 87 | 13 | 56 | 23 | 50 | 18 | 43 | 21 | 39 | 8 | 1 | 2 | 10 |
4,950 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormEncoder | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...processing_utils import Unpack
from torch import nn
import torch
from typing import Callable, Optional, Union
from ...cache_utils import Cache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutputWithPa... |
class RobertaPreLayerNormEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: ... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
4,951 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormForCausalLM | from typing import Callable, Optional, Union
from ...generation import GenerationMixin
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from ...utils.generic import can_return_tuple, check_model_inputs
from ...processing_utils import Unpack
from ...modeling_out... | @auto_docstring(custom_intro='\n RoBERTa-PreLayerNorm Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class RobertaPreLayerNormForCausalLM(RobertaPreLayerNormPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
... | 8 | 1 | 26 | 3 | 16 | 7 | 2 | 0.44 | 2 | 7 | 3 | 0 | 5 | 2 | 5 | 6 | 140 | 22 | 82 | 34 | 57 | 36 | 33 | 16 | 27 | 6 | 2 | 1 | 12 |
4,952 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormForMaskedLM | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch.nn import BCEWithLogitsLoss, Cro... | @auto_docstring(custom_intro='\n RoBERTa-PreLayerNorm Model with a `language modeling` head on top.\n ')
class RobertaPreLayerNormForMaskedLM(RobertaPreLayerNormPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, n... | 8 | 1 | 19 | 2 | 15 | 3 | 2 | 0.17 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 93 | 11 | 70 | 29 | 42 | 12 | 27 | 14 | 22 | 5 | 2 | 1 | 9 |
4,953 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormForMultipleChoice | from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...utils.generic import can_return_tuple, check_model_inputs
from torch import nn
import torch
from torch.nn import BCEWithLogitsLoss, C... | @auto_docstring
class RobertaPreLayerNormForMultipleChoice(RobertaPreLayerNormPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, attention_mask: Optio... | 6 | 1 | 38 | 4 | 30 | 4 | 6 | 0.12 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 85 | 9 | 68 | 34 | 45 | 8 | 29 | 19 | 26 | 11 | 2 | 1 | 12 |
4,954 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormForQuestionAnswering | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from typing import Callable, Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...processing_utils import Unpack
from ...utils.generic import can_return_tuple, check_model_inp... | @auto_docstring
class RobertaPreLayerNormForQuestionAnswering(RobertaPreLayerNormPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: O... | 6 | 1 | 41 | 5 | 30 | 7 | 4 | 0.21 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 91 | 10 | 67 | 30 | 45 | 14 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
4,955 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormForSequenceClassification | from typing import Callable, Optional, Union
import torch
from ...utils.generic import can_return_tuple, check_model_inputs
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_outputs import Bas... | @auto_docstring(custom_intro='\n RoBERTa-PreLayerNorm Model transformer with a sequence classification/regression head on top (a linear layer on top\n of the pooled output) e.g. for GLUE tasks.\n ')
class RobertaPreLayerNormForSequenceClassification(RobertaPreLayerNormPreTrainedModel):
def __init__(self, ... | 6 | 1 | 40 | 4 | 33 | 4 | 7 | 0.13 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 3 | 89 | 8 | 72 | 26 | 51 | 9 | 34 | 13 | 31 | 12 | 2 | 3 | 13 |
4,956 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormForTokenClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torch
from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from torch import nn
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...utils.generic import can_return_t... | @auto_docstring
class RobertaPreLayerNormForTokenClassification(RobertaPreLayerNormPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids:... | 6 | 1 | 33 | 4 | 26 | 3 | 4 | 0.12 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 75 | 9 | 59 | 27 | 38 | 7 | 24 | 14 | 21 | 5 | 2 | 1 | 7 |
4,957 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormIntermediate | from ...activations import ACT2FN, gelu
from torch import nn
import torch
class RobertaPreLayerNormIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dense = nn.Linear(config.hidden_size,... |
class RobertaPreLayerNormIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
4,958 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormLMHead | from torch import nn
import torch
from ...activations import ACT2FN, gelu
class RobertaPreLayerNormLMHead(nn.Module):
"""RobertaPreLayerNorm Head for masked language modeling."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
... |
class RobertaPreLayerNormLMHead(nn.Module):
'''RobertaPreLayerNorm Head for masked language modeling.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass
def _tie_weights(self):
pass | 4 | 1 | 8 | 1 | 6 | 1 | 1 | 0.21 | 1 | 1 | 0 | 0 | 3 | 4 | 3 | 13 | 29 | 6 | 19 | 9 | 15 | 4 | 18 | 9 | 14 | 2 | 1 | 1 | 4 |
4,959 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormLayer | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from ...modeling_layers import GradientCheckpointingLayer
from t... |
class RobertaPreLayerNormLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.1 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 84 | 9 | 70 | 32 | 57 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
4,960 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormModel | from ...cache_utils import Cache, EncoderDecoderCache
import torch
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAtte... | null | 12 | 3 | 31 | 3 | 21 | 7 | 5 | 0.39 | 1 | 8 | 4 | 0 | 5 | 5 | 5 | 6 | 179 | 26 | 110 | 42 | 83 | 43 | 57 | 26 | 51 | 18 | 2 | 2 | 24 |
4,961 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormOutput | import torch
from torch import nn
class RobertaPreLayerNormOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, hidden_states: torc... |
class RobertaPreLayerNormOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 1 | 10 | 5 | 7 | 0 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
4,962 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormPooler | from torch import nn
import torch
class RobertaPreLayerNormPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
... |
class RobertaPreLayerNormPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
4,963 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormPreTrainedModel | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from .configuration_roberta_prelayernorm import RobertaPreLayerNormConfig
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class RobertaPreLayerNormPreTrainedModel(P... | @auto_docstring
class RobertaPreLayerNormPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.47 | 1 | 0 | 0 | 7 | 1 | 0 | 1 | 1 | 27 | 2 | 17 | 6 | 15 | 8 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
4,964 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormSelfAttention | from ...cache_utils import Cache, EncoderDecoderCache
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from typing import Callable, Optional, Union
import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
fro... |
class RobertaPreLayerNormSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_val... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 0 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
4,965 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py | transformers.models.roberta_prelayernorm.modeling_roberta_prelayernorm.RobertaPreLayerNormSelfOutput | import torch
from torch import nn
class RobertaPreLayerNormSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, hidden_states: torch.... |
class RobertaPreLayerNormSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 1 | 10 | 5 | 7 | 0 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
4,966 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/configuration_roc_bert.py | transformers.models.roc_bert.configuration_roc_bert.RoCBertConfig | from ...configuration_utils import PretrainedConfig
class RoCBertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`RoCBertModel`]. It is used to instantiate a
RoCBert model according to the specified arguments, defining the model architecture. Instantiating a c... |
class RoCBertConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`RoCBertModel`]. It is used to instantiate a
RoCBert model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a simi... | 2 | 1 | 50 | 0 | 50 | 0 | 1 | 1.46 | 1 | 1 | 0 | 0 | 1 | 22 | 1 | 1 | 137 | 9 | 52 | 51 | 24 | 76 | 26 | 25 | 24 | 1 | 1 | 0 | 1 |
4,967 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertAttention | from torch import nn
from ...processing_utils import Unpack
import torch
from ...cache_utils import Cache, EncoderDecoderCache
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_li... |
class RoCBertAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None,... | 4 | 0 | 15 | 1 | 14 | 1 | 1 | 0.07 | 1 | 5 | 1 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 43 | 20 | 30 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
4,968 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertEmbeddings | from torch import nn
import torch
class RoCBertEmbeddings(nn.Module):
"""Construct the embeddings from word, position, shape, pronunciation and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, pa... |
class RoCBertEmbeddings(nn.Module):
'''Construct the embeddings from word, position, shape, pronunciation and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, input_shape_ids=None, input_pronunciation_ids=None, token_type_ids=None, position_ids=None, in... | 3 | 1 | 63 | 7 | 53 | 4 | 10 | 0.08 | 1 | 1 | 0 | 0 | 2 | 11 | 2 | 12 | 129 | 16 | 106 | 38 | 94 | 9 | 83 | 29 | 80 | 16 | 1 | 3 | 20 |
4,969 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertEncoder | from torch import nn
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, Token... |
class RoCBertEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: Optional[tor... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
4,970 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertForCausalLM | from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput,... | @auto_docstring(custom_intro='\n RoCBert Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class RoCBertForCausalLM(RoCBertPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, n... | 9 | 1 | 30 | 4 | 18 | 8 | 3 | 0.45 | 2 | 7 | 3 | 0 | 6 | 2 | 6 | 7 | 191 | 29 | 112 | 48 | 76 | 50 | 46 | 20 | 39 | 6 | 2 | 2 | 17 |
4,971 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertForMaskedLM | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...processing_utils import Unpack
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils.generic import can_return_tuple, check_model_inputs
from typing import Callable, Optional, Union
import to... | @auto_docstring
class RoCBertForMaskedLM(RoCBertPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.... | 11 | 2 | 25 | 3 | 17 | 5 | 3 | 0.31 | 1 | 7 | 3 | 0 | 5 | 2 | 5 | 6 | 136 | 22 | 88 | 37 | 63 | 27 | 40 | 18 | 34 | 5 | 2 | 1 | 13 |
4,972 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertForMultipleChoice | from torch import nn
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, Quest... | @auto_docstring
class RoCBertForMultipleChoice(RoCBertPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, input_shape_ids: Optional[torch.Tensor]=None, input_pronunciation_ids: Optional[torch.Tensor]=None... | 6 | 1 | 44 | 5 | 36 | 4 | 8 | 0.1 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 98 | 10 | 80 | 32 | 55 | 8 | 31 | 15 | 28 | 13 | 2 | 1 | 15 |
4,973 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertForPreTraining | from ...utils.generic import can_return_tuple, check_model_inputs
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import to... | @auto_docstring(custom_intro='\n RoCBert Model with contrastive loss and masked_lm_loss during the pretraining.\n ')
class RoCBertForPreTraining(RoCBertPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embedd... | 8 | 1 | 43 | 6 | 25 | 13 | 2 | 0.53 | 1 | 8 | 3 | 0 | 4 | 2 | 4 | 5 | 183 | 26 | 104 | 54 | 73 | 55 | 43 | 29 | 38 | 6 | 2 | 2 | 9 |
4,974 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertForQuestionAnswering | from torch import nn
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWit... | @auto_docstring
class RoCBertForQuestionAnswering(RoCBertPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, input_shape_ids: Optional[torch.Tensor]=None, input_pronunciation_ids: Optional[torch.Tensor]=N... | 6 | 1 | 43 | 5 | 32 | 7 | 4 | 0.19 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 99 | 10 | 75 | 32 | 47 | 14 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
4,975 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertForSequenceClassification | from torch import nn
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, Sequ... | @auto_docstring(custom_intro='\n RoCBert Model transformer with a sequence classification/regression head on top (a linear layer on top of\n the pooled output) e.g. for GLUE tasks.\n ')
class RoCBertForSequenceClassification(RoCBertPreTrainedModel):
def __init__(self, config):
pass
@can_return... | 6 | 1 | 44 | 4 | 37 | 4 | 7 | 0.1 | 1 | 6 | 2 | 0 | 2 | 5 | 2 | 3 | 99 | 9 | 82 | 30 | 57 | 8 | 36 | 15 | 33 | 12 | 2 | 3 | 14 |
4,976 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertForTokenClassification | from torch import nn
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from ...u... | @auto_docstring
class RoCBertForTokenClassification(RoCBertPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, input_shape_ids: Optional[torch.Tensor]=None, input_pronunciation_ids: Optional[torch.Tensor]... | 6 | 1 | 34 | 4 | 28 | 3 | 4 | 0.09 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 79 | 9 | 64 | 29 | 39 | 6 | 23 | 14 | 20 | 5 | 2 | 1 | 7 |
4,977 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertIntermediate | from torch import nn
import torch
from ...activations import ACT2FN
class RoCBertIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.intermediate... |
class RoCBertIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
4,978 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertLMPredictionHead | from torch import nn
import torch
class RoCBertLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = RoCBertPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.bias = nn.Parameter(to... |
class RoCBertLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def _tie_weights(self):
pass
def forward(self, hidden_states):
pass | 4 | 0 | 6 | 1 | 4 | 1 | 1 | 0.23 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 21 | 5 | 13 | 7 | 9 | 3 | 13 | 7 | 9 | 1 | 1 | 0 | 3 |
4,979 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertLayer | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...modeling_layers import G... |
class RoCBertLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encod... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.1 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 84 | 9 | 70 | 32 | 57 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
4,980 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertModel | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from ...cache_utils import Cac... | null | 16 | 3 | 18 | 2 | 13 | 4 | 3 | 0.38 | 1 | 8 | 4 | 0 | 9 | 4 | 9 | 10 | 194 | 27 | 121 | 47 | 87 | 46 | 63 | 29 | 53 | 18 | 2 | 2 | 28 |
4,981 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertOnlyMLMHead | from torch import nn
import torch
class RoCBertOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = RoCBertLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predictions(sequence_outp... |
class RoCBertOnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,982 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertOutput | from torch import nn
import torch
class RoCBertOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropo... |
class RoCBertOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
4,983 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertPooler | from torch import nn
import torch
class RoCBertPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
first_tok... |
class RoCBertPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
4,984 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertPreTrainedModel | from torch import nn
from .configuration_roc_bert import RoCBertConfig
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class RoCBertPreTrainedModel(PreTrainedModel):
config_class = ... | @auto_docstring
class RoCBertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.41 | 1 | 0 | 0 | 8 | 1 | 0 | 1 | 1 | 26 | 2 | 17 | 6 | 15 | 7 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
4,985 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertPredictionHeadTransform | from torch import nn
from ...activations import ACT2FN
import torch
class RoCBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
if isinstance(config.hidden_act, str):
self.transfo... |
class RoCBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
4,986 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertSelfAttention | from torch import nn
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from ...cache_utils import Cache, EncoderDecoderCache
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
from ...processing_ut... |
class RoCBertSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_value: Optional... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 0 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
4,987 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/modeling_roc_bert.py | transformers.models.roc_bert.modeling_roc_bert.RoCBertSelfOutput | from torch import nn
import torch
class RoCBertSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout... |
class RoCBertSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
4,988 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/tokenization_roc_bert.py | transformers.models.roc_bert.tokenization_roc_bert.RoCBertBasicTokenizer | from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import unicodedata
class RoCBertBasicTokenizer:
"""
Constructs a RoCBertBasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *opt... |
class RoCBertBasicTokenizer:
'''
Constructs a RoCBertBasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
never_split (`It... | 8 | 7 | 19 | 1 | 14 | 5 | 4 | 0.55 | 0 | 2 | 0 | 0 | 7 | 5 | 7 | 7 | 159 | 14 | 98 | 39 | 83 | 54 | 78 | 32 | 70 | 8 | 0 | 4 | 27 |
4,989 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/tokenization_roc_bert.py | transformers.models.roc_bert.tokenization_roc_bert.RoCBertTokenizer | import json
import os
from ...utils import add_end_docstrings, logging
from ...tokenization_utils_base import ENCODE_KWARGS_DOCSTRING, ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING, BatchEncoding, EncodedInput, EncodedInputPair, PaddingStrategy, PreTokenizedInput, PreTokenizedInputPair, TensorType, TextInput, TextInputPair, ... |
class RoCBertTokenizer(PreTrainedTokenizer):
'''
Args:
Construct a RoCBert tokenizer. Based on WordPiece. This tokenizer inherits from [`PreTrainedTokenizer`] which
contains most of the main methods. Users should refer to this superclass for more information regarding those
methods.
vocab_f... | 27 | 10 | 35 | 3 | 29 | 4 | 4 | 0.25 | 1 | 16 | 4 | 0 | 21 | 7 | 21 | 110 | 827 | 84 | 603 | 222 | 449 | 148 | 260 | 90 | 236 | 19 | 3 | 4 | 101 |
4,990 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roc_bert/tokenization_roc_bert.py | transformers.models.roc_bert.tokenization_roc_bert.RoCBertWordpieceTokenizer | class RoCBertWordpieceTokenizer:
"""Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
self.vocab = vocab
self.unk_token = unk_token
self.max_input_chars_per_word = max_input_chars_per_word
def tokenize(self, text):
"""
... | class RoCBertWordpieceTokenizer:
'''Runs WordPiece tokenization.'''
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
pass
def tokenize(self, text):
'''
Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform
... | 3 | 2 | 26 | 3 | 18 | 6 | 5 | 0.33 | 0 | 1 | 0 | 0 | 2 | 3 | 2 | 2 | 55 | 8 | 36 | 15 | 33 | 12 | 35 | 15 | 32 | 9 | 0 | 4 | 10 |
4,991 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/configuration_roformer.py | transformers.models.roformer.configuration_roformer.RoFormerConfig | from ...configuration_utils import PretrainedConfig
class RoFormerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`RoFormerModel`]. It is used to instantiate an
RoFormer model according to the specified arguments, defining the model architecture. Instantiating... |
class RoFormerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`RoFormerModel`]. It is used to instantiate an
RoFormer model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a ... | 2 | 1 | 37 | 1 | 36 | 0 | 2 | 1.42 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 103 | 11 | 38 | 37 | 17 | 54 | 19 | 18 | 17 | 2 | 1 | 0 | 2 |
4,992 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/configuration_roformer.py | transformers.models.roformer.configuration_roformer.RoFormerOnnxConfig | from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
class RoFormerOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequen... |
class RoFormerOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 13 | 0 | 13 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 15 | 0 | 15 | 4 | 12 | 0 | 7 | 3 | 5 | 2 | 1 | 1 | 2 |
4,993 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/modeling_roformer.py | transformers.models.roformer.modeling_roformer.RoFormerAttention | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils.deprecation import deprecate_kwarg
from torch import nn
class RoFormerAttention(nn.Module):
def __init__(self, config, layer_idx=None):
super().__init__()
self.self = RoFormer... |
class RoFormerAttention(nn.Module):
def __init__(self, config, layer_idx=None):
pass
def prune_heads(self, heads):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, sinusoidal_pos=None, head_mask=N... | 5 | 0 | 15 | 1 | 14 | 1 | 1 | 0.12 | 1 | 4 | 2 | 0 | 3 | 3 | 3 | 13 | 51 | 4 | 43 | 21 | 29 | 5 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
4,994 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/modeling_roformer.py | transformers.models.roformer.modeling_roformer.RoFormerClassificationHead | from torch import nn
from ...activations import ACT2FN, get_activation
class RoFormerClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.dro... |
class RoFormerClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 8 | 1 | 7 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 19 | 3 | 15 | 8 | 12 | 2 | 15 | 8 | 12 | 1 | 1 | 0 | 2 |
4,995 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/modeling_roformer.py | transformers.models.roformer.modeling_roformer.RoFormerEmbeddings | from torch import nn
import torch
class RoFormerEmbeddings(nn.Module):
"""Construct the embeddings from word and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.embedding_size, padding_idx=config.pad_token_i... |
class RoFormerEmbeddings(nn.Module):
'''Construct the embeddings from word and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, token_type_ids=None, inputs_embeds=None):
pass | 3 | 1 | 14 | 3 | 10 | 1 | 3 | 0.14 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 32 | 8 | 21 | 10 | 18 | 3 | 20 | 10 | 17 | 4 | 1 | 1 | 5 |
4,996 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/modeling_roformer.py | transformers.models.roformer.modeling_roformer.RoFormerEncoder | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
... |
class RoFormerEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, past_key_values=None, use_cache=None, output_attentions=False, output_hidden_states=False, return_dict=True... | 3 | 0 | 49 | 4 | 45 | 1 | 10 | 0.01 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 12 | 100 | 9 | 90 | 29 | 75 | 1 | 38 | 17 | 35 | 18 | 1 | 3 | 19 |
4,997 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/modeling_roformer.py | transformers.models.roformer.modeling_roformer.RoFormerForCausalLM | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenCla... | @auto_docstring(custom_intro='\n RoFormer Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class RoFormerForCausalLM(RoFormerPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self... | 7 | 1 | 25 | 3 | 15 | 7 | 2 | 0.45 | 2 | 7 | 3 | 0 | 5 | 2 | 5 | 6 | 133 | 20 | 78 | 34 | 53 | 35 | 31 | 16 | 25 | 5 | 2 | 1 | 11 |
4,998 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/modeling_roformer.py | transformers.models.roformer.modeling_roformer.RoFormerForMaskedLM | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Call... | @auto_docstring
class RoFormerForMaskedLM(RoFormerPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, at... | 8 | 1 | 17 | 2 | 13 | 2 | 2 | 0.12 | 1 | 6 | 3 | 0 | 5 | 2 | 5 | 6 | 98 | 15 | 75 | 32 | 50 | 9 | 35 | 18 | 29 | 5 | 2 | 1 | 10 |
4,999 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/roformer/modeling_roformer.py | transformers.models.roformer.modeling_roformer.RoFormerForMultipleChoice | import torch
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docst... | @auto_docstring
class RoFormerForMultipleChoice(RoFormerPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, head_mask: Opti... | 5 | 1 | 36 | 5 | 28 | 4 | 6 | 0.11 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 82 | 11 | 64 | 29 | 42 | 7 | 27 | 15 | 24 | 10 | 2 | 1 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.