id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,600 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetEncoder | import torch
from typing import Optional, Union
from torch import nn
class FocalNetEncoder(nn.Module):
def __init__(self, config, grid_size):
super().__init__()
self.num_stages = len(config.depths)
self.config = config
self.stages = nn.ModuleList([FocalNetStage(config=config, index... |
class FocalNetEncoder(nn.Module):
def __init__(self, config, grid_size):
pass
def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int], output_hidden_states: Optional[bool]=False, output_hidden_states_before_downsampling: Optional[bool]=False, return_dict: Optional[bool]=True)... | 3 | 0 | 39 | 5 | 33 | 2 | 5 | 0.06 | 1 | 9 | 2 | 0 | 2 | 4 | 2 | 12 | 80 | 10 | 66 | 22 | 56 | 4 | 38 | 15 | 35 | 9 | 1 | 2 | 10 |
2,601 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetEncoderOutput | from ...utils import ModelOutput, auto_docstring, logging
import torch
from dataclasses import dataclass
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro="\n FocalNet encoder's outputs, with potential hidden states.\n ")
class FocalNetEncoderOutput(ModelOutput):
"""
reshaped_hid... | @dataclass
@auto_docstring(custom_intro="\n FocalNet encoder's outputs, with potential hidden states.\n ")
class FocalNetEncoderOutput(ModelOutput):
'''
reshaped_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 24 | 5 | 4 | 4 | 3 | 15 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
2,602 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetForImageClassification | from torch import nn
import torch
from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
@auto_docstring(custom_intro='\n FocalNet Model with an image classification head on top (a linear layer on top of the pooled output) e.g. for\n ImageNet.\n ')
class FocalNetForImageC... | @auto_docstring(custom_intro='\n FocalNet Model with an image classification head on top (a linear layer on top of the pooled output) e.g. for\n ImageNet.\n ')
class FocalNetForImageClassification(FocalNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, ... | 5 | 1 | 36 | 5 | 27 | 4 | 7 | 0.15 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 81 | 11 | 61 | 19 | 45 | 9 | 32 | 12 | 29 | 12 | 2 | 3 | 14 |
2,603 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetForMaskedImageModeling | from ...utils import ModelOutput, auto_docstring, logging
import math
from torch import nn
from typing import Optional, Union
import torch
@auto_docstring(custom_intro='\n FocalNet Model with a decoder on top for masked image modeling.\n\n This follows the same implementation as in [SimMIM](https://huggingface.c... | @auto_docstring(custom_intro='\n FocalNet Model with a decoder on top for masked image modeling.\n\n This follows the same implementation as in [SimMIM](https://huggingface.co/papers/2111.09886).\n\n <Tip>\n\n Note that we provide a script to pre-train this model on custom data in our [examples\n directo... | 5 | 1 | 48 | 8 | 27 | 14 | 3 | 0.48 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 99 | 16 | 56 | 24 | 45 | 27 | 28 | 17 | 25 | 5 | 2 | 1 | 6 |
2,604 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetImageClassifierOutput | from dataclasses import dataclass
import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n FocalNet outputs for image classification.\n ')
class FocalNetImageClassifierOutput(ModelOutput):
"""
loss (`torch.FloatT... | @dataclass
@auto_docstring(custom_intro='\n FocalNet outputs for image classification.\n ')
class FocalNetImageClassifierOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 4 | 5 | 5 | 4 | 17 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
2,605 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetLayer | import torch
from torch import nn
class FocalNetLayer(nn.Module):
"""Focal Modulation Network layer (block).
Args:
config (`FocalNetConfig`):
Model config.
index (`int`):
Layer index.
dim (`int`):
Number of input channels.
input_resolution (`... |
class FocalNetLayer(nn.Module):
'''Focal Modulation Network layer (block).
Args:
config (`FocalNetConfig`):
Model config.
index (`int`):
Layer index.
dim (`int`):
Number of input channels.
input_resolution (`tuple[int]`):
Input res... | 3 | 1 | 25 | 5 | 19 | 2 | 4 | 0.45 | 1 | 5 | 3 | 0 | 2 | 12 | 2 | 12 | 67 | 12 | 38 | 19 | 35 | 17 | 30 | 19 | 27 | 4 | 1 | 1 | 7 |
2,606 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetMaskedImageModelingOutput | from dataclasses import dataclass
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
import torch
@dataclass
@auto_docstring(custom_intro='\n FocalNet masked image model outputs.\n ')
class FocalNetMaskedImageModelingOutput(ModelOutput):
"""
loss (`torch.FloatTen... | @dataclass
@auto_docstring(custom_intro='\n FocalNet masked image model outputs.\n ')
class FocalNetMaskedImageModelingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `bool_masked_pos` is provided):
Masked image modeling (MLM) loss.
reconstruction ... | 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 |
2,607 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetMlp | from ...activations import ACT2FN
from torch import nn
class FocalNetMlp(nn.Module):
def __init__(self, config, in_features, hidden_features=None, out_features=None, drop=0.0):
super().__init__()
out_features = out_features or in_features
hidden_features = hidden_features or in_features
... |
class FocalNetMlp(nn.Module):
def __init__(self, config, in_features, hidden_features=None, out_features=None, drop=0.0):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 17 | 1 | 16 | 7 | 13 | 0 | 16 | 7 | 13 | 1 | 1 | 0 | 2 |
2,608 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetModel | from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
import torch
from torch import nn
@auto_docstring
class FocalNetModel(FocalNetPreTrainedModel):
def __init__(self, config, add_pooling_layer=True, use_mask_token=False):
"""
add_pooling_layer (bool, *optio... | @auto_docstring
class FocalNetModel(FocalNetPreTrainedModel):
def __init__(self, config, add_pooling_layer=True, use_mask_token=False):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
use_mask_token (`bool`, *optional*, defaults to `F... | 6 | 2 | 21 | 4 | 16 | 2 | 3 | 0.09 | 1 | 7 | 3 | 0 | 3 | 7 | 3 | 4 | 74 | 13 | 56 | 23 | 38 | 5 | 30 | 16 | 26 | 6 | 2 | 1 | 9 |
2,609 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetModelOutput | from ...utils import ModelOutput, auto_docstring, logging
from dataclasses import dataclass
import torch
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro="\n FocalNet model's outputs that also contains a pooling of the last hidden states.\n ")
class FocalNetModelOutput(ModelOutput):
... | @dataclass
@auto_docstring(custom_intro="\n FocalNet model's outputs that also contains a pooling of the last hidden states.\n ")
class FocalNetModelOutput(ModelOutput):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*, returned when `add_pooling_layer=True` is passe... | 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 |
2,610 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetModulation | from torch import nn
import torch
class FocalNetModulation(nn.Module):
def __init__(self, config, index, dim, focal_factor=2, bias=True, projection_dropout=0.0):
super().__init__()
self.dim = dim
self.focal_window = config.focal_windows[index]
self.focal_level = config.focal_levels... |
class FocalNetModulation(nn.Module):
def __init__(self, config, index, dim, focal_factor=2, bias=True, projection_dropout=0.0):
pass
def forward(self, hidden_state):
'''
Args:
hidden_state:
Input features with shape of (batch_size, height, width, num_channe... | 3 | 1 | 34 | 5 | 24 | 5 | 4 | 0.2 | 1 | 2 | 0 | 0 | 2 | 16 | 2 | 12 | 69 | 10 | 49 | 27 | 46 | 10 | 42 | 27 | 39 | 4 | 1 | 1 | 7 |
2,611 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetPatchEmbeddings | from torch import nn
import collections.abc
from typing import Optional, Union
import torch
class FocalNetPatchEmbeddings(nn.Module):
def __init__(self, config, image_size, patch_size, num_channels, embed_dim, add_norm=False, use_conv_embed=False, is_stem=False):
super().__init__()
image_size = im... |
class FocalNetPatchEmbeddings(nn.Module):
def __init__(self, config, image_size, patch_size, num_channels, embed_dim, add_norm=False, use_conv_embed=False, is_stem=False):
pass
def maybe_pad(self, pixel_values, height, width):
pass
def forward(self, pixel_values: Optional[torch.FloatTens... | 4 | 0 | 22 | 1 | 20 | 1 | 4 | 0.03 | 1 | 5 | 0 | 0 | 3 | 7 | 3 | 13 | 69 | 6 | 61 | 29 | 47 | 2 | 44 | 19 | 40 | 6 | 1 | 2 | 12 |
2,612 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetPreTrainedModel | from ...utils import ModelOutput, auto_docstring, logging
from .configuration_focalnet import FocalNetConfig
from torch import nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class FocalNetPreTrainedModel(PreTrainedModel):
config: FocalNetConfig
base_model_prefix = 'focalnet'
main_input_na... | @auto_docstring
class FocalNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.5 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 23 | 2 | 14 | 7 | 12 | 7 | 13 | 7 | 11 | 4 | 1 | 2 | 4 |
2,613 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetStage | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
import torch
class FocalNetStage(GradientCheckpointingLayer):
def __init__(self, config, index, input_resolution):
super().__init__()
self.config = config
self.num_stages = len(config.depths)
embed_dim =... |
class FocalNetStage(GradientCheckpointingLayer):
def __init__(self, config, index, input_resolution):
pass
def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int]) -> tuple[torch.Tensor]:
pass | 3 | 0 | 31 | 5 | 26 | 1 | 4 | 0.02 | 1 | 7 | 2 | 0 | 2 | 5 | 2 | 12 | 64 | 11 | 52 | 19 | 49 | 1 | 28 | 19 | 25 | 5 | 1 | 1 | 8 |
2,614 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/configuration_fsmt.py | transformers.models.fsmt.configuration_fsmt.DecoderConfig | from ...configuration_utils import PretrainedConfig
class DecoderConfig(PretrainedConfig):
"""
Configuration class for FSMT's decoder specific things. note: this is a private helper class
"""
model_type = 'fsmt_decoder'
def __init__(self, vocab_size=0, bos_token_id=0, is_encoder_decoder=True, **kw... |
class DecoderConfig(PretrainedConfig):
'''
Configuration class for FSMT's decoder specific things. note: this is a private helper class
'''
def __init__(self, vocab_size=0, bos_token_id=0, is_encoder_decoder=True, **kwargs):
pass | 2 | 1 | 4 | 0 | 4 | 0 | 1 | 0.5 | 1 | 1 | 0 | 0 | 1 | 2 | 1 | 1 | 11 | 2 | 6 | 5 | 4 | 3 | 6 | 5 | 4 | 1 | 1 | 0 | 1 |
2,615 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/configuration_fsmt.py | transformers.models.fsmt.configuration_fsmt.FSMTConfig | from ...configuration_utils import PretrainedConfig
class FSMTConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FSMTModel`]. It is used to instantiate a FSMT
model according to the specified arguments, defining the model architecture. Instantiating a configurat... |
class FSMTConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FSMTModel`]. It is used to instantiate a FSMT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar confi... | 2 | 1 | 78 | 5 | 72 | 4 | 2 | 1.24 | 1 | 2 | 1 | 0 | 1 | 22 | 1 | 1 | 179 | 14 | 75 | 59 | 39 | 93 | 28 | 25 | 26 | 2 | 1 | 1 | 2 |
2,616 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.Attention | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from torch import Tensor, nn
import torch
from typing import Any, Optional, Union
class Attention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, embed_dim, num_heads, dropout=0.0, bias=True,... |
class Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim, num_heads, dropout=0.0, bias=True, encoder_decoder_attention=False, layer_idx=None):
pass
def forward(self, query, key: Optional[Tensor], key_padding_mask: Optional[Tensor... | 3 | 2 | 40 | 4 | 34 | 3 | 6 | 0.08 | 1 | 5 | 0 | 0 | 4 | 11 | 4 | 14 | 164 | 19 | 137 | 49 | 116 | 11 | 100 | 33 | 95 | 14 | 1 | 2 | 24 |
2,617 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.DecoderLayer | from ...activations import ACT2FN
from .configuration_fsmt import FSMTConfig
from torch import Tensor, nn
from torch.nn import CrossEntropyLoss, LayerNorm
class DecoderLayer(nn.Module):
def __init__(self, config: FSMTConfig, layer_idx=None):
super().__init__()
self.embed_dim = config.d_model
... |
class DecoderLayer(nn.Module):
def __init__(self, config: FSMTConfig, layer_idx=None):
pass
def forward(self, x, encoder_hidden_states, encoder_attn_mask=None, layer_state=None, causal_mask=None, layer_head_mask=None, cross_attn_layer_head_mask=None, decoder_padding_mask=None, output_attentions=False... | 3 | 0 | 42 | 3 | 38 | 3 | 2 | 0.08 | 1 | 3 | 2 | 0 | 2 | 11 | 2 | 12 | 86 | 7 | 76 | 28 | 62 | 6 | 36 | 17 | 33 | 2 | 1 | 1 | 3 |
2,618 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.EncoderLayer | from ...activations import ACT2FN
from .configuration_fsmt import FSMTConfig
from torch import Tensor, nn
from torch.nn import CrossEntropyLoss, LayerNorm
class EncoderLayer(nn.Module):
def __init__(self, config: FSMTConfig):
super().__init__()
self.embed_dim = config.d_model
self.self_att... |
class EncoderLayer(nn.Module):
def __init__(self, config: FSMTConfig):
pass
def forward(self, x, encoder_padding_mask, layer_head_mask, output_attentions=False):
'''
Args:
x (`torch.Tensor`): input to the layer of shape *(seq_len, batch, embed_dim)*
encoder_pad... | 3 | 1 | 23 | 1 | 16 | 6 | 1 | 0.38 | 1 | 3 | 2 | 0 | 2 | 9 | 2 | 12 | 47 | 3 | 32 | 14 | 29 | 12 | 26 | 14 | 23 | 1 | 1 | 0 | 2 |
2,619 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.FSMTDecoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from .configuration_fsmt import FSMTConfig
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from typing import Any, Optional, Union
import torch
from torch import Tensor, nn
im... |
class FSMTDecoder(nn.Module):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`DecoderLayer`]
Args:
config: FSMTConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, config: FSMTConfig, embed_tokens: nn.Embedding):
... | 4 | 2 | 57 | 7 | 38 | 12 | 9 | 0.37 | 1 | 12 | 4 | 0 | 3 | 8 | 3 | 13 | 183 | 26 | 116 | 43 | 96 | 43 | 72 | 28 | 67 | 23 | 1 | 3 | 27 |
2,620 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.FSMTEncoder | import math
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from typing import Any, Optional, Union
from torch import Tensor, nn
from .configuration_fsmt import FSMTConfig
class FSMTEncoder(nn.Module):
"""
Transformer ... |
class FSMTEncoder(nn.Module):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`EncoderLayer`].
Args:
config: FSMTConfig
'''
def __init__(self, config: FSMTConfig, embed_tokens):
pass
def forward(self, input_ids: torch.Tenso... | 3 | 2 | 54 | 7 | 35 | 15 | 9 | 0.5 | 1 | 11 | 4 | 0 | 2 | 7 | 2 | 12 | 117 | 16 | 70 | 28 | 58 | 35 | 46 | 19 | 43 | 15 | 1 | 2 | 17 |
2,621 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.FSMTForConditionalGeneration | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from torch.nn import CrossEntropyLoss, LayerNorm
from typing import Any, Optional, Union
from .configuration_fsmt import FSMTConfig
from ...utils import auto_docstring, logging
from ...generation import GenerationMixin
import torch
from ...modeling_out... | @auto_docstring(custom_intro='\n The FSMT Model with a language modeling head. Can be used for summarization.\n ')
class FSMTForConditionalGeneration(PretrainedFSMTModel, GenerationMixin):
def __init__(self, config: FSMTConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch... | 10 | 1 | 12 | 1 | 10 | 1 | 2 | 0.11 | 2 | 6 | 3 | 0 | 7 | 1 | 8 | 10 | 114 | 16 | 88 | 41 | 57 | 10 | 38 | 21 | 29 | 6 | 2 | 1 | 14 |
2,622 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.FSMTModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils import auto_docstring, logging
from torch import Tensor, nn
from .configuration_fsmt import FSMTC... | @auto_docstring
class FSMTModel(PretrainedFSMTModel):
def __init__(self, config: FSMTConfig):
pass
def get_encoder(self):
pass
def _tie_weights(self):
pass
@auto_docstring
def forward(self, input_ids: torch.LongTensor, attention_mask: Optional[torch.Tensor]=None, decoder_i... | 11 | 1 | 13 | 1 | 12 | 0 | 2 | 0.04 | 1 | 9 | 5 | 0 | 9 | 3 | 9 | 11 | 136 | 19 | 113 | 37 | 80 | 4 | 45 | 18 | 35 | 13 | 2 | 1 | 22 |
2,623 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.PretrainedFSMTModel | from ...modeling_utils import PreTrainedModel
import torch
from .configuration_fsmt import FSMTConfig
from torch import Tensor, nn
from ...utils import auto_docstring, logging
@auto_docstring
class PretrainedFSMTModel(PreTrainedModel):
config: FSMTConfig
base_model_prefix = 'model'
def _init_weights(self,... | @auto_docstring
class PretrainedFSMTModel(PreTrainedModel):
def _init_weights(self, module):
pass
@property
def dummy_inputs(self):
pass | 5 | 0 | 10 | 0 | 10 | 0 | 4 | 0 | 1 | 1 | 1 | 2 | 2 | 0 | 2 | 2 | 26 | 2 | 24 | 10 | 20 | 0 | 18 | 9 | 15 | 6 | 1 | 2 | 7 |
2,624 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/modeling_fsmt.py | transformers.models.fsmt.modeling_fsmt.SinusoidalPositionalEmbedding | import math
from torch import Tensor, nn
from typing import Any, Optional, Union
import torch
class SinusoidalPositionalEmbedding(nn.Embedding):
"""
This module produces sinusoidal positional embeddings of any length.
We don't want to save the weight of this embedding since it's not trained (deterministic... |
class SinusoidalPositionalEmbedding(nn.Embedding):
'''
This module produces sinusoidal positional embeddings of any length.
We don't want to save the weight of this embedding since it's not trained (deterministic) and it can be huge.
Padding symbols are ignored.
These embeddings get automatically e... | 8 | 4 | 11 | 0 | 7 | 4 | 2 | 0.6 | 1 | 4 | 0 | 0 | 3 | 1 | 5 | 5 | 74 | 10 | 40 | 21 | 27 | 24 | 32 | 14 | 26 | 3 | 1 | 1 | 9 |
2,625 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fsmt/tokenization_fsmt.py | transformers.models.fsmt.tokenization_fsmt.FSMTTokenizer | import json
from ...tokenization_utils import PreTrainedTokenizer
import os
from typing import Optional
class FSMTTokenizer(PreTrainedTokenizer):
"""
Construct an FAIRSEQ Transformer tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:
- Moses preprocessing and tokenization.
... |
class FSMTTokenizer(PreTrainedTokenizer):
'''
Construct an FAIRSEQ Transformer tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:
- Moses preprocessing and tokenization.
- Normalizing all inputs text.
- The arguments `special_tokens` and the function `set_special_tok... | 25 | 7 | 15 | 2 | 10 | 3 | 2 | 0.47 | 1 | 12 | 0 | 0 | 22 | 15 | 22 | 111 | 405 | 68 | 229 | 91 | 183 | 108 | 170 | 65 | 145 | 10 | 3 | 3 | 51 |
2,626 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/configuration_funnel.py | transformers.models.funnel.configuration_funnel.FunnelConfig | from ...configuration_utils import PretrainedConfig
class FunnelConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FunnelModel`] or a [`TFBertModel`]. It is used to
instantiate a Funnel Transformer model according to the specified arguments, defining the model a... |
class FunnelConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FunnelModel`] or a [`TFBertModel`]. It is used to
instantiate a Funnel Transformer model according to the specified arguments, defining the model architecture.
Instantiating a configuration with ... | 10 | 1 | 13 | 0 | 13 | 0 | 1 | 0.72 | 1 | 2 | 0 | 0 | 5 | 20 | 5 | 5 | 140 | 9 | 76 | 55 | 43 | 55 | 36 | 28 | 30 | 2 | 1 | 0 | 6 |
2,627 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelAttentionStructure | from .configuration_funnel import FunnelConfig
from typing import Optional, Union
import torch
from torch import nn
class FunnelAttentionStructure(nn.Module):
"""
Contains helpers for `FunnelRelMultiheadAttention `.
"""
cls_token_type_id: int = 2
def __init__(self, config: FunnelConfig) -> None:
... |
class FunnelAttentionStructure(nn.Module):
'''
Contains helpers for `FunnelRelMultiheadAttention `.
'''
def __init__(self, config: FunnelConfig) -> None:
pass
def init_attention_inputs(self, inputs_embeds: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional... | 11 | 10 | 24 | 2 | 17 | 5 | 4 | 0.3 | 1 | 11 | 1 | 0 | 10 | 5 | 10 | 20 | 258 | 31 | 174 | 77 | 148 | 53 | 144 | 61 | 133 | 12 | 1 | 3 | 40 |
2,628 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelBaseModel | from .configuration_funnel import FunnelConfig
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import ModelOutput, auto_docstring, logging
from typing... | @auto_docstring(custom_intro='\n The base Funnel Transformer Model transformer outputting raw hidden-states without upsampling head (also called\n decoder) or any task-specific head on top.\n ')
class FunnelBaseModel(FunnelPreTrainedModel):
def __init__(self, config: FunnelConfig) -> None:
pass
... | 7 | 0 | 15 | 2 | 13 | 1 | 3 | 0.04 | 1 | 8 | 4 | 0 | 4 | 2 | 4 | 5 | 70 | 11 | 57 | 22 | 35 | 2 | 28 | 10 | 23 | 10 | 2 | 1 | 13 |
2,629 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelClassificationHead | from .configuration_funnel import FunnelConfig
import torch
from torch import nn
class FunnelClassificationHead(nn.Module):
def __init__(self, config: FunnelConfig, n_labels: int) -> None:
super().__init__()
self.linear_hidden = nn.Linear(config.d_model, config.d_model)
self.dropout = nn.D... |
class FunnelClassificationHead(nn.Module):
def __init__(self, config: FunnelConfig, n_labels: int) -> None:
pass
def forward(self, hidden: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
2,630 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelDecoder | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from torch import nn
from .configuration_funnel import FunnelConfig
class FunnelDecoder(nn.Module):
... |
class FunnelDecoder(nn.Module):
def __init__(self, config: FunnelConfig) -> None:
pass
def forward(self, final_hidden: torch.Tensor, first_block_hidden: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden... | 3 | 0 | 23 | 3 | 20 | 0 | 4 | 0 | 1 | 9 | 4 | 0 | 2 | 3 | 2 | 12 | 47 | 6 | 41 | 22 | 29 | 0 | 22 | 13 | 19 | 7 | 1 | 2 | 8 |
2,631 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelDiscriminatorPredictions | from ...activations import ACT2FN
from .configuration_funnel import FunnelConfig
import torch
from torch import nn
class FunnelDiscriminatorPredictions(nn.Module):
"""Prediction module for the discriminator, made up of two dense layers."""
def __init__(self, config: FunnelConfig) -> None:
super().__in... |
class FunnelDiscriminatorPredictions(nn.Module):
'''Prediction module for the discriminator, made up of two dense layers.'''
def __init__(self, config: FunnelConfig) -> None:
pass
def forward(self, discriminator_hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 5 | 0 | 5 | 0 | 1 | 0.09 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 14 | 2 | 11 | 8 | 8 | 1 | 11 | 8 | 8 | 1 | 1 | 0 | 2 |
2,632 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelEmbeddings | from torch import nn
import torch
from typing import Optional, Union
from .configuration_funnel import FunnelConfig
class FunnelEmbeddings(nn.Module):
def __init__(self, config: FunnelConfig) -> None:
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, pad... |
class FunnelEmbeddings(nn.Module):
def __init__(self, config: FunnelConfig) -> None:
pass
def forward(self, input_ids: Optional[torch.Tensor]=None, inputs_embeds: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 9 | 9 | 0 | 12 | 7 | 9 | 2 | 1 | 1 | 3 |
2,633 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelEncoder | from .configuration_funnel import FunnelConfig
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
class FunnelEncoder(nn.Module):
... |
class FunnelEncoder(nn.Module):
def __init__(self, config: FunnelConfig) -> None:
pass
def forward(self, inputs_embeds: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict:... | 3 | 0 | 30 | 2 | 27 | 1 | 8 | 0.02 | 1 | 10 | 4 | 0 | 2 | 3 | 2 | 12 | 61 | 5 | 55 | 28 | 44 | 1 | 35 | 19 | 32 | 14 | 1 | 4 | 15 |
2,634 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelForMaskedLM | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifi... | @auto_docstring
class FunnelForMaskedLM(FunnelPreTrainedModel):
def __init__(self, config: FunnelConfig) -> None:
pass
def get_output_embeddings(self) -> nn.Linear:
pass
def set_output_embeddings(self, new_embeddings: nn.Embedding) -> None:
pass
@auto_docstring
def forward... | 7 | 1 | 15 | 2 | 11 | 2 | 2 | 0.15 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 72 | 11 | 54 | 25 | 32 | 8 | 24 | 14 | 19 | 5 | 2 | 1 | 8 |
2,635 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelForMultipleChoice | from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss,... | @auto_docstring
class FunnelForMultipleChoice(FunnelPreTrainedModel):
def __init__(self, config: FunnelConfig) -> None:
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, inputs_emb... | 5 | 1 | 33 | 4 | 26 | 4 | 6 | 0.12 | 1 | 7 | 4 | 0 | 2 | 2 | 2 | 3 | 74 | 8 | 59 | 25 | 40 | 7 | 26 | 14 | 23 | 10 | 2 | 1 | 11 |
2,636 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelForPreTraining | from ...utils import ModelOutput, auto_docstring, logging
import torch
from torch import nn
from .configuration_funnel import FunnelConfig
from typing import Optional, Union
@auto_docstring(custom_intro='\n Funnel Transformer model with a binary classification head on top as used during pretraining for identifying\... | @auto_docstring(custom_intro='\n Funnel Transformer model with a binary classification head on top as used during pretraining for identifying\n generated tokens.\n ')
class FunnelForPreTraining(FunnelPreTrainedModel):
def __init__(self, config: FunnelConfig) -> None:
pass
@auto_docstring
d... | 5 | 1 | 38 | 6 | 24 | 9 | 4 | 0.34 | 1 | 7 | 4 | 0 | 2 | 2 | 2 | 3 | 80 | 13 | 50 | 25 | 35 | 17 | 24 | 14 | 21 | 6 | 2 | 2 | 7 |
2,637 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelForPreTrainingOutput | import torch
from typing import Optional, Union
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n Output type of [`FunnelForPreTraining`].\n ')
class FunnelForPreTrainingOutput(ModelOutput):
"""
loss (*optional*, return... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`FunnelForPreTraining`].\n ')
class FunnelForPreTrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
Total loss of the ELECTRA-style objective.
logits (`torch.Flo... | 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 |
2,638 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelForQuestionAnswering | from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from torch import nn
from .configuration_funnel import FunnelConfig
from torch.... | @auto_docstring
class FunnelForQuestionAnswering(FunnelPreTrainedModel):
def __init__(self, config: FunnelConfig) -> None:
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, inputs_... | 5 | 0 | 39 | 5 | 28 | 7 | 4 | 0.21 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 3 | 86 | 10 | 63 | 28 | 43 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
2,639 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelForSequenceClassification | from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from .configuration_funnel import FunnelConfig
from torch.nn import BCEWithLogi... | @auto_docstring(custom_intro='\n Funnel Transformer Model with a sequence classification/regression head on top (two linear layer on top of the\n first timestep of the last hidden state) e.g. for GLUE tasks.\n ')
class FunnelForSequenceClassification(FunnelPreTrainedModel):
def __init__(self, config: Funn... | 5 | 1 | 38 | 4 | 31 | 4 | 7 | 0.1 | 1 | 8 | 4 | 0 | 2 | 4 | 2 | 3 | 83 | 8 | 68 | 25 | 49 | 7 | 34 | 14 | 31 | 12 | 2 | 3 | 13 |
2,640 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelForTokenClassification | from torch import nn
from .configuration_funnel import FunnelConfig
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, Q... | @auto_docstring
class FunnelForTokenClassification(FunnelPreTrainedModel):
def __init__(self, config: FunnelConfig) -> None:
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, input... | 5 | 1 | 28 | 4 | 22 | 3 | 3 | 0.1 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 64 | 8 | 51 | 24 | 32 | 5 | 22 | 13 | 19 | 5 | 2 | 1 | 6 |
2,641 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelLayer | from torch import nn
from .configuration_funnel import FunnelConfig
import torch
class FunnelLayer(nn.Module):
def __init__(self, config: FunnelConfig, block_index: int) -> None:
super().__init__()
self.attention = FunnelRelMultiheadAttention(config, block_index)
self.ffn = FunnelPositionw... |
class FunnelLayer(nn.Module):
def __init__(self, config: FunnelConfig, block_index: int) -> None:
pass
def forward(self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor, attention_inputs, output_attentions: bool=False) -> tuple:
pass | 3 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 7 | 3 | 0 | 2 | 2 | 2 | 12 | 17 | 1 | 16 | 14 | 6 | 0 | 9 | 7 | 6 | 2 | 1 | 0 | 3 |
2,642 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelModel | from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from torch import nn
from .configuration_funnel import FunnelConfig
from typing... | @auto_docstring
class FunnelModel(FunnelPreTrainedModel):
def __init__(self, config: FunnelConfig) -> None:
pass
def get_input_embeddings(self) -> nn.Embedding:
pass
def set_input_embeddings(self, new_embeddings: nn.Embedding) -> None:
pass
@auto_docstring
def forward(self... | 7 | 0 | 22 | 2 | 19 | 1 | 5 | 0.02 | 1 | 9 | 5 | 0 | 4 | 4 | 4 | 5 | 96 | 12 | 82 | 25 | 62 | 2 | 41 | 15 | 36 | 15 | 2 | 2 | 18 |
2,643 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelPositionwiseFFN | from torch import nn
from .configuration_funnel import FunnelConfig
import torch
from ...activations import ACT2FN
class FunnelPositionwiseFFN(nn.Module):
def __init__(self, config: FunnelConfig) -> None:
super().__init__()
self.linear_1 = nn.Linear(config.d_model, config.d_inner)
self.act... |
class FunnelPositionwiseFFN(nn.Module):
def __init__(self, config: FunnelConfig) -> None:
pass
def forward(self, hidden: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 6 | 2 | 12 | 17 | 1 | 16 | 10 | 13 | 0 | 16 | 10 | 13 | 1 | 1 | 0 | 2 |
2,644 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelPreTrainedModel | from ...modeling_utils import PreTrainedModel
import numpy as np
from ...utils import ModelOutput, auto_docstring, logging
from torch import nn
from .configuration_funnel import FunnelConfig
@auto_docstring
class FunnelPreTrainedModel(PreTrainedModel):
config: FunnelConfig
base_model_prefix = 'funnel'
def... | @auto_docstring
class FunnelPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 23 | 0 | 23 | 0 | 9 | 0.15 | 1 | 1 | 0 | 8 | 1 | 0 | 1 | 1 | 33 | 2 | 27 | 8 | 25 | 4 | 24 | 8 | 22 | 9 | 1 | 3 | 9 |
2,645 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/modeling_funnel.py | transformers.models.funnel.modeling_funnel.FunnelRelMultiheadAttention | import torch
from .configuration_funnel import FunnelConfig
from torch import nn
class FunnelRelMultiheadAttention(nn.Module):
def __init__(self, config: FunnelConfig, block_index: int) -> None:
super().__init__()
self.config = config
self.block_index = block_index
d_model, n_head,... |
class FunnelRelMultiheadAttention(nn.Module):
def __init__(self, config: FunnelConfig, block_index: int) -> None:
pass
def relative_positional_attention(self, position_embeds, q_head, context_len, cls_mask=None):
'''Relative attention score for the positional encodings'''
pass
de... | 5 | 2 | 35 | 5 | 22 | 9 | 3 | 0.39 | 1 | 5 | 1 | 0 | 4 | 15 | 4 | 14 | 142 | 21 | 87 | 61 | 75 | 34 | 75 | 54 | 70 | 4 | 1 | 1 | 11 |
2,646 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/tokenization_funnel.py | transformers.models.funnel.tokenization_funnel.FunnelTokenizer | import os
import collections
from typing import Optional
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
class FunnelTokenizer(PreTrainedTokenizer):
"""
Construct a Funnel Transformer tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrain... |
class FunnelTokenizer(PreTrainedTokenizer):
'''
Construct a Funnel Transformer tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
... | 15 | 7 | 15 | 1 | 10 | 4 | 2 | 0.8 | 1 | 9 | 2 | 0 | 12 | 5 | 12 | 101 | 254 | 28 | 126 | 56 | 88 | 101 | 66 | 30 | 53 | 6 | 3 | 3 | 27 |
2,647 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/funnel/tokenization_funnel_fast.py | transformers.models.funnel.tokenization_funnel_fast.FunnelTokenizerFast | import json
from .tokenization_funnel import FunnelTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from tokenizers import normalizers
from typing import Optional
class FunnelTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" Funnel Transformer tokenizer (backed by HuggingFa... |
class FunnelTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" Funnel Transformer tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superc... | 5 | 3 | 26 | 3 | 16 | 8 | 2 | 1.07 | 1 | 4 | 0 | 0 | 4 | 1 | 4 | 92 | 156 | 18 | 67 | 34 | 43 | 72 | 28 | 15 | 23 | 2 | 3 | 1 | 7 |
2,648 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fuyu/configuration_fuyu.py | transformers.models.fuyu.configuration_fuyu.FuyuConfig | from ...configuration_utils import PretrainedConfig
from ..auto import CONFIG_MAPPING, AutoConfig
class FuyuConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FuyuForCausalLM`]. It is used to instantiate an
Fuyu model according to the specified arguments, defini... |
class FuyuConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FuyuForCausalLM`]. It is used to instantiate an
Fuyu model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a simila... | 3 | 2 | 51 | 2 | 48 | 2 | 4 | 0.73 | 1 | 4 | 0 | 0 | 2 | 20 | 2 | 2 | 183 | 12 | 99 | 55 | 69 | 72 | 41 | 28 | 38 | 5 | 1 | 1 | 8 |
2,649 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fuyu/image_processing_fuyu.py | transformers.models.fuyu.image_processing_fuyu.FuyuBatchFeature | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...utils import TensorType, filter_out_non_signature_kwargs, is_torch_available, is_torch_device, is_torch_dtype, logging, requires_backends
from typing import Optional, Union
class FuyuBatchFeature(BatchFeature):
"""
Ba... |
class FuyuBatchFeature(BatchFeature):
'''
BatchFeature class for Fuyu image processor and processor.
The outputs dictionary from the processors contains a mix of tensors and lists of tensors.
'''
def convert_to_tensors(self, tensor_type: Optional[Union[str, TensorType]]=None):
'''
... | 6 | 3 | 24 | 2 | 15 | 7 | 4 | 0.64 | 1 | 4 | 0 | 0 | 2 | 1 | 2 | 68 | 107 | 14 | 58 | 16 | 51 | 37 | 49 | 16 | 42 | 8 | 10 | 3 | 21 |
2,650 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fuyu/image_processing_fuyu.py | transformers.models.fuyu.image_processing_fuyu.FuyuImageProcessor | from ...utils import TensorType, filter_out_non_signature_kwargs, is_torch_available, is_torch_device, is_torch_dtype, logging, requires_backends
from ...image_utils import ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, is_valid_image, make_list_of_ima... |
class FuyuImageProcessor(BaseImageProcessor):
'''
This class should handle the image processing part before the main FuyuForCausalLM. In particular, it should
handle:
- Processing Images:
Taking a batch of images as input. If the images are variable-sized, it resizes them based on the desired p... | 9 | 7 | 68 | 6 | 43 | 19 | 6 | 0.56 | 1 | 12 | 2 | 0 | 7 | 12 | 7 | 27 | 540 | 58 | 310 | 139 | 242 | 174 | 157 | 79 | 149 | 23 | 3 | 4 | 44 |
2,651 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fuyu/modeling_fuyu.py | transformers.models.fuyu.modeling_fuyu.FuyuForCausalLM | from ...utils import auto_docstring, can_return_tuple, logging
from ...modeling_outputs import CausalLMOutputWithPast
from .configuration_fuyu import FuyuConfig
from torch import nn
from ...generation import GenerationMixin
from ...cache_utils import Cache
import torch
from typing import Optional, Union
@auto_docstrin... | @auto_docstring(custom_intro='\n Fuyu Model with a language modeling head on top for causal language model conditioned on image patches and text.\n ')
class FuyuForCausalLM(FuyuPreTrainedModel, GenerationMixin):
def __init__(self, config: FuyuConfig):
pass
def get_input_embeddings(self):
... | 11 | 1 | 20 | 2 | 14 | 4 | 3 | 0.29 | 2 | 9 | 3 | 0 | 10 | 6 | 11 | 12 | 239 | 35 | 159 | 64 | 115 | 46 | 81 | 33 | 69 | 13 | 2 | 2 | 35 |
2,652 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fuyu/modeling_fuyu.py | transformers.models.fuyu.modeling_fuyu.FuyuPreTrainedModel | from torch import nn
from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, can_return_tuple, logging
from .configuration_fuyu import FuyuConfig
@auto_docstring
class FuyuPreTrainedModel(PreTrainedModel):
config: FuyuConfig
base_model_prefix = 'fuyu'
supports_gradient_checkpoint... | @auto_docstring
class FuyuPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 17 | 1 | 16 | 8 | 14 | 0 | 15 | 8 | 13 | 5 | 1 | 2 | 5 |
2,653 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fuyu/processing_fuyu.py | transformers.models.fuyu.processing_fuyu.FuyuProcessor | from ...utils.import_utils import requires
from ...image_utils import ImageInput
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack
from typing import Optional, Union
from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...utils import is_torch_available, loggin... | @requires(backends=('vision',))
class FuyuProcessor(ProcessorMixin):
'''
Constructs a Fuyu processor which wraps a Fuyu image processor and a Llama tokenizer into a single processor.
[`FuyuProcessor`] offers all the functionalities of [`FuyuImageProcessor`] and [`LlamaTokenizerFast`]. See the
[`~FuyuPro... | 15 | 5 | 36 | 5 | 25 | 7 | 3 | 0.34 | 1 | 11 | 2 | 0 | 8 | 9 | 8 | 25 | 395 | 56 | 255 | 104 | 226 | 87 | 154 | 86 | 141 | 9 | 2 | 3 | 38 |
2,654 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fuyu/processing_fuyu.py | transformers.models.fuyu.processing_fuyu.FuyuProcessorKwargs | from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack
class FuyuProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': False, 'stride': 0, 'return_attention_mask': True, 'return_overflowing_tokens': False, 'return_speci... |
class FuyuProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 16 | 0 | 16 | 2 | 15 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
2,655 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaAttention | from typing import Callable, Optional, Union
from ...utils.deprecation import deprecate_kwarg
from torch import nn
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...processing_utils import Unpack
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_g... |
class GemmaAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: GemmaConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, posit... | 4 | 1 | 35 | 4 | 31 | 1 | 3 | 0.03 | 1 | 6 | 3 | 1 | 2 | 11 | 2 | 12 | 74 | 9 | 63 | 31 | 52 | 2 | 34 | 23 | 31 | 5 | 1 | 2 | 6 |
2,656 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaDecoderLayer | from ...processing_utils import Unpack
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from typing import Callable, Optional, Union
from ...modeling_layers import GenericForSequenceClassification, G... |
class GemmaDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: GemmaConfig, layer_idx: int):
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]=None, position_ids... | 4 | 0 | 25 | 4 | 21 | 2 | 2 | 0.07 | 1 | 10 | 6 | 0 | 2 | 5 | 2 | 12 | 52 | 8 | 42 | 22 | 28 | 3 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
2,657 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaForCausalLM | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...processing_utils import Unpack
from torch import nn
from ...generation import GenerationMixin
from typing import Callable, Optional, Union
from ...cache_utils import Cache, DynamicCache
import torch
from ...utils import Transformers... | @auto_docstring
class GemmaForCausalLM(GemmaPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=N... | 6 | 1 | 14 | 2 | 9 | 4 | 2 | 0.38 | 2 | 9 | 4 | 3 | 8 | 3 | 8 | 9 | 123 | 21 | 74 | 36 | 47 | 28 | 36 | 20 | 27 | 8 | 2 | 1 | 15 |
2,658 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class GemmaForSequenceClassification(GenericForSequenceClassification, GemmaPreTrainedModel):
pass |
class GemmaForSequenceClassification(GenericForSequenceClassification, GemmaPreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 2 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
2,659 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaForTokenClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class GemmaForTokenClassification(GenericForTokenClassification, GemmaPreTrainedModel):
pass |
class GemmaForTokenClassification(GenericForTokenClassification, GemmaPreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 2 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
2,660 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaMLP | from torch import nn
from ...activations import ACT2FN
class GemmaMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.hidd... |
class GemmaMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
2,661 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaModel | import torch
from ...cache_utils import Cache, DynamicCache
from ...utils.generic import check_model_inputs
from ...masking_utils import create_causal_mask
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from .configuration_gemma import GemmaConfig
from ...utils impo... | @auto_docstring
class GemmaModel(GemmaPreTrainedModel):
def __init__(self, config: GemmaConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, pas... | 6 | 0 | 41 | 5 | 30 | 7 | 6 | 0.24 | 1 | 15 | 9 | 1 | 5 | 7 | 6 | 7 | 263 | 35 | 185 | 66 | 147 | 45 | 91 | 35 | 84 | 21 | 2 | 2 | 37 |
2,662 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_gemma import GemmaConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
@auto_docstring
class GemmaPreTrainedModel(PreTrainedModel):
config: GemmaConfig
base_model_prefix = 'model'
supports... | @auto_docstring
class GemmaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
2,663 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modeling_gemma.py | transformers.models.gemma.modeling_gemma.GemmaRotaryEmbedding | import torch
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
from torch import nn
from .configuration_gemma import GemmaConfig
class GemmaRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: GemmaConfig, device=None):
super().__init__()
if h... |
class GemmaRotaryEmbedding(nn.Module):
def __init__(self, config: GemmaConfig, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.35 | 1 | 4 | 1 | 1 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 14 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
2,664 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaConfig | from ...configuration_utils import PretrainedConfig
class GemmaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`GemmaModel`]. It is used to instantiate an Gemma
model according to the specified arguments, defining the model architecture. Instantiating a config... |
class GemmaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`GemmaModel`]. It is used to instantiate an Gemma
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar c... | 2 | 1 | 48 | 1 | 47 | 0 | 1 | 1.12 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 33 | 128 | 3 | 59 | 44 | 34 | 66 | 22 | 21 | 20 | 1 | 2 | 0 | 1 |
2,665 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaForCausalLM | from ..llama.modeling_llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
class GemmaForCausalLM(LlamaForCausalLM):
def forward(**super_kwargs):
"""
Example:
```python
>>> from... |
class GemmaForCausalLM(LlamaForCausalLM):
def forward(**super_kwargs):
'''
Example:
```python
>>> from transformers import AutoTokenizer, GemmaForCausalLM
>>> model = GemmaForCausalLM.from_pretrained("google/gemma-7b")
>>> tokenizer = AutoTokenizer.from_pretrained("... | 2 | 1 | 34 | 7 | 2 | 25 | 1 | 8.33 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 10 | 35 | 7 | 3 | 2 | 1 | 25 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
2,666 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaForSequenceClassification | from ..llama.modeling_llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
class GemmaForSequenceClassification(LlamaForSequenceClassification):
pass |
class GemmaForSequenceClassification(LlamaForSequenceClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,667 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaForTokenClassification | from ..llama.modeling_llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
class GemmaForTokenClassification(LlamaForTokenClassification):
pass |
class GemmaForTokenClassification(LlamaForTokenClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,668 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaMLP | from ..llama.modeling_llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
from torch import nn
class GemmaMLP(LlamaMLP):
def __init__(self, config):
super().__init__(config)
self.gate_proj = nn... |
class GemmaMLP(LlamaMLP):
def __init__(self, config):
pass | 2 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 5 | 1 | 13 | 6 | 0 | 6 | 5 | 4 | 0 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
2,669 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaModel | from ...processing_utils import Unpack
from typing import TYPE_CHECKING, Any, Optional
from ...utils import TransformersKwargs, logging
import torch
from ...cache_utils import Cache, DynamicCache
from ..llama.modeling_llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, ... |
class GemmaModel(LlamaModel):
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, inputs_embeds: Optional[torch.FloatTensor]=None, use_cache: Optional[bool]=None, cache_posi... | 2 | 0 | 111 | 18 | 86 | 8 | 21 | 0.09 | 1 | 6 | 3 | 0 | 1 | 0 | 1 | 8 | 112 | 18 | 87 | 25 | 72 | 8 | 41 | 12 | 39 | 21 | 3 | 2 | 21 |
2,670 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaRMSNorm | import torch
from torch import nn
class GemmaRMSNorm(nn.Module):
def __init__(self, dim: int, eps: float=1e-06):
super().__init__()
self.eps = eps
self.weight = nn.Parameter(torch.zeros(dim))
def _norm(self, x):
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps... |
class GemmaRMSNorm(nn.Module):
def __init__(self, dim: int, eps: float=1e-06):
pass
def _norm(self, x):
pass
def forward(self, x):
pass
def extra_repr(self):
pass | 5 | 0 | 4 | 0 | 3 | 1 | 1 | 0.15 | 1 | 4 | 0 | 0 | 4 | 2 | 4 | 14 | 18 | 3 | 13 | 8 | 8 | 2 | 13 | 8 | 8 | 1 | 1 | 0 | 4 |
2,671 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/modular_gemma.py | transformers.models.gemma.modular_gemma.GemmaTokenizer | from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from typing import TYPE_CHECKING, Any, Optional
from ..llama.tokenization_llama import LlamaTokenizer
import sentencepiece as spm
class GemmaTokenizer(LlamaTokenizer, PreTrainedTokenizer):
"""
Construct a Gemma tokenizer. Based on byte-level Byt... |
class GemmaTokenizer(LlamaTokenizer, PreTrainedTokenizer):
'''
Construct a Gemma tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as there is
no padding token in the original model.
Args:
vocab_file (`str`):
Path to the vocabulary file.
u... | 8 | 4 | 14 | 1 | 12 | 2 | 3 | 0.6 | 2 | 5 | 0 | 0 | 7 | 6 | 7 | 112 | 154 | 16 | 86 | 40 | 58 | 52 | 50 | 20 | 42 | 7 | 4 | 3 | 20 |
2,672 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/tokenization_gemma.py | transformers.models.gemma.tokenization_gemma.GemmaTokenizer | import os
from typing import TYPE_CHECKING, Any, Optional
from ...utils.import_utils import requires
from shutil import copyfile
import sentencepiece as spm
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
@requires(backends=('sentencepiece',))
class GemmaTokenizer(PreTrainedTokenizer):
"""
Co... | @requires(backends=('sentencepiece',))
class GemmaTokenizer(PreTrainedTokenizer):
'''
Construct a Gemma tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as there is
no padding token in the original model.
Args:
vocab_file (`str`):
Path to the voca... | 18 | 11 | 15 | 1 | 10 | 4 | 3 | 0.61 | 1 | 6 | 0 | 0 | 15 | 6 | 15 | 104 | 289 | 43 | 153 | 69 | 112 | 93 | 101 | 43 | 85 | 7 | 3 | 3 | 42 |
2,673 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma/tokenization_gemma_fast.py | transformers.models.gemma.tokenization_gemma_fast.GemmaTokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
import os
from tokenizers import processors
from shutil import copyfile
class GemmaTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a Gemma tokenizer fast. Based on byte-level Byte-Pair-Encoding.
This uses nota... |
class GemmaTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a Gemma tokenizer fast. Based on byte-level Byte-Pair-Encoding.
This uses notably ByteFallback and no prefix space. Normalization is applied to replace `" "` with `"▁"`
```python
>>> from transformers import GemmaTokenizerFast
>>... | 13 | 2 | 10 | 1 | 9 | 0 | 3 | 0.49 | 1 | 4 | 0 | 0 | 9 | 3 | 9 | 97 | 163 | 26 | 92 | 45 | 65 | 45 | 57 | 28 | 47 | 9 | 3 | 1 | 25 |
2,674 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2Attention | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils.deprecation import deprecate_kwarg
from ...modeling_flash_attention_utils import FlashAttentionKwargs
import torch.nn as nn
import torch
from ...processing_utils import Unpack
from .configuration_gemma2 import Gemma2Config
from typing ... |
class Gemma2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Gemma2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, pos... | 4 | 1 | 42 | 4 | 37 | 1 | 4 | 0.04 | 1 | 7 | 3 | 0 | 2 | 13 | 2 | 12 | 88 | 10 | 75 | 34 | 64 | 3 | 39 | 26 | 36 | 6 | 1 | 2 | 8 |
2,675 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2DecoderLayer | import torch.nn as nn
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
import torch
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache
from typing import Callable, Optional, Union
from .configuration_g... |
class Gemma2DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Gemma2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor],... | 4 | 0 | 40 | 4 | 31 | 5 | 3 | 0.16 | 1 | 9 | 5 | 0 | 2 | 10 | 2 | 12 | 81 | 9 | 63 | 32 | 48 | 10 | 38 | 20 | 35 | 4 | 1 | 2 | 5 |
2,676 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2ForCausalLM | from ...cache_utils import Cache, DynamicCache
from typing import Callable, Optional, Union
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
import torch
from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
import tor... | @auto_docstring
class Gemma2ForCausalLM(Gemma2PreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]... | 6 | 1 | 23 | 2 | 16 | 5 | 3 | 0.32 | 2 | 8 | 3 | 0 | 9 | 3 | 9 | 10 | 219 | 29 | 146 | 51 | 107 | 47 | 68 | 24 | 58 | 11 | 2 | 2 | 28 |
2,677 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2ForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Gemma2ForSequenceClassification(GenericForSequenceClassification, Gemma2PreTrainedModel):
pass |
class Gemma2ForSequenceClassification(GenericForSequenceClassification, Gemma2PreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
2,678 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2ForTokenClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Gemma2ForTokenClassification(GenericForTokenClassification, Gemma2PreTrainedModel):
pass |
class Gemma2ForTokenClassification(GenericForTokenClassification, Gemma2PreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
2,679 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2MLP | from ...activations import ACT2FN
import torch.nn as nn
class Gemma2MLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.hi... |
class Gemma2MLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
2,680 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2Model | import torch.nn as nn
from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from typing import Callable, Optional, Union
import torch
from .configuration_gemma2 import Gemma2Config
from ...processing_utils im... | @auto_docstring
class Gemma2Model(Gemma2PreTrainedModel):
def __init__(self, config: Gemma2Config):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, ... | 6 | 0 | 39 | 4 | 29 | 7 | 6 | 0.25 | 1 | 13 | 7 | 1 | 5 | 8 | 6 | 7 | 252 | 31 | 178 | 67 | 138 | 44 | 86 | 33 | 79 | 23 | 2 | 2 | 34 |
2,681 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2PreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_gemma2 import Gemma2Config
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
@auto_docstring
class Gemma2PreTrainedModel(PreTrainedModel):
config: Gemma2Config
base_model_prefix = 'model'... | @auto_docstring
class Gemma2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
2,682 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2RMSNorm | import torch.nn as nn
import torch
class Gemma2RMSNorm(nn.Module):
def __init__(self, dim: int, eps: float=1e-06):
super().__init__()
self.eps = eps
self.weight = nn.Parameter(torch.zeros(dim))
def _norm(self, x):
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.e... |
class Gemma2RMSNorm(nn.Module):
def __init__(self, dim: int, eps: float=1e-06):
pass
def _norm(self, x):
pass
def forward(self, x):
pass
def extra_repr(self):
pass | 5 | 0 | 4 | 0 | 3 | 1 | 1 | 0.15 | 1 | 4 | 0 | 0 | 4 | 2 | 4 | 14 | 18 | 3 | 13 | 8 | 8 | 2 | 13 | 8 | 8 | 1 | 1 | 0 | 4 |
2,683 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modeling_gemma2.py | transformers.models.gemma2.modeling_gemma2.Gemma2RotaryEmbedding | from .configuration_gemma2 import Gemma2Config
import torch.nn as nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
class Gemma2RotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Gemma2Config, device=None):
super().__init__()
... |
class Gemma2RotaryEmbedding(nn.Module):
def __init__(self, config: Gemma2Config, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.35 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 14 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
2,684 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2Attention | import torch
from ...cache_utils import Cache, DynamicCache
from ...processing_utils import Unpack
from ...utils.deprecation import deprecate_kwarg
from ...modeling_flash_attention_utils import FlashAttentionKwargs
import torch.nn as nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS
from ..gemma.modeling_gemma i... |
class Gemma2Attention(GemmaAttention):
def __init__(self, config: Gemma2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor], attention_mask... | 4 | 0 | 34 | 4 | 29 | 1 | 4 | 0.03 | 1 | 7 | 3 | 0 | 2 | 5 | 2 | 14 | 69 | 8 | 59 | 26 | 48 | 2 | 31 | 18 | 28 | 6 | 2 | 2 | 8 |
2,685 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2Config | from ...configuration_utils import PretrainedConfig, layer_type_validation
class Gemma2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Gemma2Model`]. It is used to instantiate an Gemma2
model according to the specified arguments, defining the model architectu... |
class Gemma2Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Gemma2Model`]. It is used to instantiate an Gemma2
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a simila... | 2 | 1 | 55 | 0 | 55 | 0 | 1 | 1.04 | 1 | 1 | 0 | 0 | 1 | 20 | 1 | 33 | 140 | 3 | 67 | 52 | 38 | 70 | 26 | 25 | 24 | 1 | 2 | 0 | 1 |
2,686 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2DecoderLayer | from typing import Callable, Optional, Union
from ...utils.deprecation import deprecate_kwarg
import torch.nn as nn
from ...modeling_layers import GradientCheckpointingLayer
from ...cache_utils import Cache, DynamicCache
import torch
class Gemma2DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config:... |
class Gemma2DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Gemma2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor],... | 4 | 0 | 40 | 4 | 31 | 5 | 3 | 0.16 | 1 | 9 | 5 | 0 | 2 | 10 | 2 | 12 | 81 | 9 | 63 | 32 | 48 | 10 | 38 | 20 | 35 | 4 | 1 | 2 | 5 |
2,687 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2ForCausalLM | import torch
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ..gemma.modeling_gemma import GemmaAttention, GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification, GemmaMLP, GemmaModel, GemmaPreTrainedModel, GemmaRMS... |
class Gemma2ForCausalLM(GemmaForCausalLM):
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, inputs_embeds: Optional[torch.Fl... | 3 | 1 | 57 | 5 | 42 | 11 | 7 | 0.26 | 1 | 8 | 3 | 0 | 3 | 1 | 3 | 12 | 174 | 17 | 127 | 40 | 97 | 33 | 52 | 14 | 48 | 11 | 3 | 2 | 22 |
2,688 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2ForSequenceClassification | from ..gemma.modeling_gemma import GemmaAttention, GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification, GemmaMLP, GemmaModel, GemmaPreTrainedModel, GemmaRMSNorm, GemmaRotaryEmbedding, apply_rotary_pos_emb, repeat_kv
class Gemma2ForSequenceClassification(GemmaForSequenceClassification):
pa... |
class Gemma2ForSequenceClassification(GemmaForSequenceClassification):
pass | 1 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 1 | 1 | 6 | 5 | 0 | 5 | 3 | 3 | 0 | 5 | 3 | 3 | 1 | 3 | 0 | 1 |
2,689 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2ForTokenClassification | from ..gemma.modeling_gemma import GemmaAttention, GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification, GemmaMLP, GemmaModel, GemmaPreTrainedModel, GemmaRMSNorm, GemmaRotaryEmbedding, apply_rotary_pos_emb, repeat_kv
class Gemma2ForTokenClassification(GemmaForTokenClassification):
pass |
class Gemma2ForTokenClassification(GemmaForTokenClassification):
pass | 1 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 1 | 1 | 6 | 5 | 0 | 5 | 3 | 3 | 0 | 5 | 3 | 3 | 1 | 3 | 0 | 1 |
2,690 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2MLP | from ..gemma.modeling_gemma import GemmaAttention, GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification, GemmaMLP, GemmaModel, GemmaPreTrainedModel, GemmaRMSNorm, GemmaRotaryEmbedding, apply_rotary_pos_emb, repeat_kv
from ...activations import ACT2FN
class Gemma2MLP(GemmaMLP):
def __init_... |
class Gemma2MLP(GemmaMLP):
def __init__(self, config):
pass | 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 13 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
2,691 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2Model | from ...utils import TransformersKwargs, logging
import torch.nn as nn
import torch
from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask
from typing import Callable, Optional, Union
from ...cache_utils import Cache, DynamicCache
from ...modeling_outputs import BaseModelOutputWithPast, Caus... |
class Gemma2Model(GemmaModel):
def __init__(self, config: Gemma2Config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, inputs_embeds: Optional[torch.... | 3 | 0 | 56 | 7 | 44 | 5 | 9 | 0.11 | 1 | 11 | 5 | 0 | 3 | 2 | 3 | 10 | 172 | 22 | 135 | 43 | 109 | 15 | 59 | 20 | 55 | 23 | 3 | 2 | 28 |
2,692 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/gemma2/modular_gemma2.py | transformers.models.gemma2.modular_gemma2.Gemma2RMSNorm | from ..gemma.modeling_gemma import GemmaAttention, GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification, GemmaMLP, GemmaModel, GemmaPreTrainedModel, GemmaRMSNorm, GemmaRotaryEmbedding, apply_rotary_pos_emb, repeat_kv
class Gemma2RMSNorm(GemmaRMSNorm):
pass |
class Gemma2RMSNorm(GemmaRMSNorm):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 14 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,693 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/git/configuration_git.py | transformers.models.git.configuration_git.GitConfig | from ...configuration_utils import PretrainedConfig
class GitConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`GitModel`]. It is used to instantiate a GIT model
according to the specified arguments, defining the model architecture. Instantiating a configuration... |
class GitConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`GitModel`]. It is used to instantiate a GIT model
according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configur... | 2 | 1 | 48 | 3 | 45 | 0 | 2 | 1.15 | 1 | 2 | 1 | 0 | 1 | 18 | 1 | 33 | 115 | 12 | 48 | 44 | 24 | 55 | 26 | 22 | 24 | 2 | 2 | 1 | 2 |
2,694 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/git/configuration_git.py | transformers.models.git.configuration_git.GitVisionConfig | from ...configuration_utils import PretrainedConfig
class GitVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`GitVisionModel`]. It is used to instantiate a GIT
vision encoder according to the specified arguments, defining the model architecture. Instanti... |
class GitVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`GitVisionModel`]. It is used to instantiate a GIT
vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yie... | 2 | 1 | 28 | 1 | 27 | 0 | 1 | 1.3 | 1 | 1 | 0 | 0 | 1 | 11 | 1 | 33 | 79 | 10 | 30 | 29 | 14 | 39 | 16 | 15 | 14 | 1 | 2 | 0 | 1 |
2,695 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py | transformers.models.git.modeling_git.GitAttention | from ...cache_utils import Cache, DynamicCache
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils.deprecation import deprecate_kwarg
import torch
from typing import Callable, Optional, Union
from torch import nn
class GitAttention(nn.Module):
... |
class GitAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, 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: torch.Tensor, attention_mask... | 5 | 0 | 15 | 1 | 13 | 1 | 1 | 0.1 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 48 | 4 | 41 | 19 | 29 | 4 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,696 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py | transformers.models.git.modeling_git.GitEmbeddings | from typing import Callable, Optional, Union
from torch import nn
import torch
class GitEmbeddings(nn.Module):
"""Construct the embeddings from word and position embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_s... |
class GitEmbeddings(nn.Module):
'''Construct the embeddings from word and position embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None, past_key... | 3 | 1 | 21 | 3 | 17 | 2 | 3 | 0.11 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 46 | 7 | 35 | 18 | 26 | 4 | 25 | 12 | 22 | 5 | 1 | 1 | 6 |
2,697 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py | transformers.models.git.modeling_git.GitEncoder | from typing import Callable, Optional, Union
from ...cache_utils import Cache, DynamicCache
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, BaseModelOutputWithPooling, CausalLMOutputWithPast
from torch import nn
import torch
class GitEncoder(nn.Module):
def __init__(self, config):
... |
class GitEncoder(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, past_key_values: Optional[Union[Cache, tuple[tuple[torch.FloatTensor]]]]=None, use_cache: Optiona... | 3 | 0 | 48 | 4 | 44 | 1 | 9 | 0.02 | 1 | 10 | 4 | 0 | 2 | 3 | 2 | 12 | 98 | 9 | 88 | 25 | 74 | 2 | 41 | 14 | 38 | 17 | 1 | 2 | 18 |
2,698 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py | transformers.models.git.modeling_git.GitForCausalLM | import torch
from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging, torch_int
from typing import Callable, Optional, Union
from ...cache_utils import Cache, DynamicCache
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast, BaseModelOutputWithPooling, CausalLMOutputWithPast
fro... | @auto_docstring(custom_intro='\n GIT Model with a `language modeling` head on top for autoregressive language modeling.\n ')
class GitForCausalLM(GitPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(se... | 8 | 1 | 41 | 7 | 16 | 19 | 3 | 1.16 | 2 | 7 | 3 | 0 | 6 | 2 | 6 | 136 | 258 | 48 | 97 | 41 | 70 | 113 | 44 | 22 | 37 | 6 | 3 | 2 | 15 |
2,699 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/git/modeling_git.py | transformers.models.git.modeling_git.GitIntermediate | from ...activations import ACT2FN
from torch import nn
import torch
class GitIntermediate(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_act... |
class GitIntermediate(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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.