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,000 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moonshine/modular_moonshine.py | transformers.models.moonshine.modular_moonshine.MoonshineRotaryEmbedding | from ..glm.modeling_glm import GlmAttention, GlmRotaryEmbedding, apply_rotary_pos_emb
class MoonshineRotaryEmbedding(GlmRotaryEmbedding):
pass |
class MoonshineRotaryEmbedding(GlmRotaryEmbedding):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,001 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/configuration_moshi.py | transformers.models.moshi.configuration_moshi.MoshiConfig | from ..auto.configuration_auto import AutoConfig
from ...configuration_utils import PretrainedConfig
class MoshiConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MoshiModel`]. It is used to instantiate a
Moshi model according to the specified arguments, definin... |
class MoshiConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MoshiModel`]. It is used to instantiate a
Moshi model according to the specified arguments, defining the audio encoder, Moshi depth decoder and Moshi decoder
configs. Instantiating a configuration... | 6 | 2 | 29 | 3 | 24 | 2 | 2 | 1.04 | 1 | 4 | 2 | 0 | 2 | 19 | 3 | 3 | 182 | 23 | 78 | 56 | 47 | 81 | 37 | 29 | 33 | 5 | 1 | 1 | 7 |
4,002 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/configuration_moshi.py | transformers.models.moshi.configuration_moshi.MoshiDepthConfig | from ...configuration_utils import PretrainedConfig
class MoshiDepthConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MoshiDepthDecoder`]. It is used to instantiate a
Moshi depth decoder model according to the specified arguments, defining the Moshi depth decod... |
class MoshiDepthConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MoshiDepthDecoder`]. It is used to instantiate a
Moshi depth decoder model according to the specified arguments, defining the Moshi depth decoder config.
Configuration objects inherit from [`... | 2 | 1 | 43 | 1 | 42 | 0 | 3 | 1.49 | 1 | 2 | 0 | 0 | 1 | 17 | 1 | 1 | 122 | 10 | 45 | 42 | 22 | 67 | 24 | 21 | 22 | 3 | 1 | 1 | 3 |
4,003 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiAttention | import torch.nn as nn
import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
from .configuration_moshi import MoshiConfig, MoshiDepthConfig
from typing import Any, Optional, Union
from ...utils.deprecation import deprecate_kwarg
import math
class MoshiAttention(nn.Module):
"""Multi-headed attenti... |
class MoshiAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: MoshiConfig, layer_idx: Optional[int]=None, use_flexible_linear=False, use_rope=True):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')... | 4 | 1 | 54 | 9 | 44 | 6 | 6 | 0.17 | 1 | 9 | 4 | 2 | 2 | 17 | 2 | 12 | 113 | 19 | 88 | 38 | 76 | 15 | 57 | 29 | 54 | 7 | 1 | 1 | 11 |
4,004 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiCausalLMOutputWithPast | import torch.nn as nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, ModelOutput, Seq2SeqLMOutput
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Any, Optional, Union
... | @dataclass
@auto_docstring(custom_intro='\n `MoshiForCausalLM` outputs.\n ')
class MoshiCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (for next-token prediction).
logits (`torch.FloatT... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.43 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 36 | 5 | 7 | 7 | 6 | 24 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
4,005 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiConditionalGenerationGenerateOutput | import torch.nn as nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, ModelOutput, Seq2SeqLMOutput
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Any, Optional, Union
... | @dataclass
@auto_docstring(custom_intro='\n Outputs of [`MoshiForConditionalConditionalGeneration.generate`].\n ')
class MoshiConditionalGenerationGenerateOutput(ModelOutput):
'''
audio_sequences (`torch.LongTensor` of shape `(batch_size*num_return_sequences, 1, sequence_length)`, *optional*):
The... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.09 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 47 | 2 | 11 | 11 | 10 | 34 | 11 | 11 | 10 | 0 | 1 | 0 | 0 |
4,006 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiConditionalGenerationOutputWithPast | import torch.nn as nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, ModelOutput, Seq2SeqLMOutput
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Any, Optional, Union
... | @dataclass
@auto_docstring(custom_intro='\n `MoshiForConditionalGeneration` outputs.\n ')
class MoshiConditionalGenerationOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `text_labels` is provided):
Text language modeling loss (for next-token pr... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.92 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 52 | 5 | 12 | 12 | 11 | 35 | 12 | 12 | 11 | 0 | 1 | 0 | 0 |
4,007 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiDecoderLayer | from .configuration_moshi import MoshiConfig, MoshiDepthConfig
from ...modeling_layers import GradientCheckpointingLayer
from ...utils.deprecation import deprecate_kwarg
from typing import Any, Optional, Union
import torch.nn as nn
from ...cache_utils import Cache, DynamicCache, StaticCache
import torch
class MoshiDec... |
class MoshiDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: MoshiConfig, layer_idx: int, use_flexible_linear: bool, use_rope=True):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask:... | 4 | 1 | 40 | 5 | 24 | 11 | 3 | 0.43 | 1 | 8 | 4 | 0 | 2 | 8 | 2 | 12 | 81 | 11 | 49 | 24 | 36 | 21 | 26 | 14 | 23 | 4 | 1 | 1 | 5 |
4,008 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiDepthDecoder | import torch.nn as nn
from ...generation import GenerationConfig, GenerationMixin
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, ModelOutput, Seq2SeqLMOutput
import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
from .configuration_moshi import MoshiConfig, MoshiDept... |
class MoshiDepthDecoder(MoshiPreTrainedModel, GenerationMixin):
'''
Transformer depth decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`MoshiTransformerLayer`]
Args:
config: MoshiConfig
'''
def __init__(self, config: MoshiDepthConfig):
pass
def forward... | 6 | 3 | 93 | 11 | 57 | 26 | 11 | 0.48 | 2 | 17 | 10 | 0 | 3 | 8 | 4 | 5 | 387 | 48 | 229 | 75 | 192 | 111 | 114 | 42 | 109 | 26 | 2 | 3 | 44 |
4,009 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiFlashAttention2 | import torch.nn as nn
import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Any, Optional, Union
from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available
from ...utils.deprecation import deprecate_kwarg
class MoshiFlashAttention2(Mos... |
class MoshiFlashAttention2(MoshiAttention):
'''
Moshi flash attention module. This module inherits from `MoshiAttention` as the weights of the module stays
untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
flash attention and deal with p... | 4 | 1 | 53 | 9 | 37 | 12 | 6 | 0.38 | 1 | 6 | 2 | 0 | 2 | 2 | 2 | 14 | 113 | 19 | 74 | 25 | 62 | 28 | 41 | 15 | 38 | 10 | 2 | 2 | 11 |
4,010 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiFlexibleLinear | import torch.nn as nn
import torch
class MoshiFlexibleLinear(nn.Module):
def __init__(self, input_size, output_size, num_layers):
super().__init__()
self.weight = nn.Parameter(torch.randn(num_layers, output_size, input_size))
def forward(self, x, layer_idx=None):
"""
`MoshiFle... |
class MoshiFlexibleLinear(nn.Module):
def __init__(self, input_size, output_size, num_layers):
pass
def forward(self, x, layer_idx=None):
'''
`MoshiFlexibleLinear` creates one linear layer per codebook. There's multiple ways to use it.
In the default case, `sequence_length=num... | 3 | 1 | 18 | 4 | 4 | 10 | 2 | 2.22 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 37 | 8 | 9 | 5 | 6 | 20 | 9 | 5 | 6 | 2 | 1 | 0 | 3 |
4,011 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiForCausalLM | import torch.nn as nn
from ...generation import GenerationConfig, GenerationMixin
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Any, Optional, Union
@auto_docstring(custom_intro='\n The Moshi dec... | @auto_docstring(custom_intro='\n The Moshi decoder model with a text language modelling head on top. Only usable for text.\n ')
class MoshiForCausalLM(MoshiPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTenso... | 5 | 1 | 16 | 2 | 11 | 4 | 2 | 0.37 | 2 | 8 | 3 | 0 | 8 | 3 | 8 | 9 | 145 | 21 | 91 | 37 | 64 | 34 | 43 | 21 | 34 | 9 | 2 | 1 | 16 |
4,012 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiForConditionalGeneration | from .configuration_moshi import MoshiConfig, MoshiDepthConfig
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, ModelOutput, Seq2SeqLMOutput
from ..auto.modeling_auto import AutoModel
from ...generation import GenerationConfig, GenerationMixin
import math
from ...utils import auto_docstr... | @auto_docstring(custom_intro='\n The original Moshi model with an audio encoder, a Moshi depth decoder and a Moshi decoder, for speech-to-speech.\n ')
class MoshiForConditionalGeneration(MoshiPreTrainedModel, GenerationMixin):
def __init__(self, config: MoshiConfig):
pass
def get_audio_encoder(s... | 24 | 7 | 41 | 5 | 29 | 7 | 4 | 0.25 | 2 | 19 | 10 | 0 | 18 | 11 | 20 | 21 | 860 | 123 | 591 | 185 | 490 | 149 | 255 | 102 | 234 | 18 | 2 | 2 | 89 |
4,013 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiGatingMLP | import torch
from ...activations import ACT2FN
from typing import Any, Optional, Union
import torch.nn as nn
class MoshiGatingMLP(nn.Module):
def __init__(self, config, use_flexible_linear=False):
super().__init__()
self.activation_fn = ACT2FN[config.hidden_act]
ffn_dim = config.ffn_dim
... |
class MoshiGatingMLP(nn.Module):
def __init__(self, config, use_flexible_linear=False):
pass
def forward(self, hidden_states: torch.Tensor, layer_idx: Optional[int]=None) -> torch.Tensor:
pass | 3 | 0 | 11 | 1 | 10 | 0 | 3 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 23 | 3 | 20 | 10 | 17 | 0 | 19 | 10 | 16 | 3 | 1 | 1 | 6 |
4,014 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiLinear | import torch.nn as nn
class MoshiLinear(nn.Module):
def __init__(self, input_dim, output_dim, num_codebooks, use_flexible_linear=False):
super().__init__()
self.use_flexible_linear = use_flexible_linear
if not use_flexible_linear:
self.linear = nn.Linear(input_dim, output_dim, ... |
class MoshiLinear(nn.Module):
def __init__(self, input_dim, output_dim, num_codebooks, use_flexible_linear=False):
pass
def forward(self, x, layer_idx=None):
pass | 3 | 0 | 7 | 1 | 6 | 0 | 2 | 0 | 1 | 2 | 1 | 0 | 2 | 2 | 2 | 12 | 16 | 3 | 13 | 5 | 10 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 4 |
4,015 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiModel | import torch.nn as nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, ModelOutput, Seq2SeqLMOutput
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...cache_utils import Cache, DynamicCache, StaticCache
from .configuration_moshi import MoshiCo... | @auto_docstring
class MoshiModel(MoshiPreTrainedModel):
def __init__(self, config: MoshiConfig):
pass
@auto_docstring
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[U... | 8 | 1 | 48 | 5 | 37 | 8 | 8 | 0.24 | 1 | 16 | 9 | 0 | 5 | 7 | 6 | 7 | 306 | 34 | 225 | 70 | 187 | 53 | 110 | 38 | 103 | 25 | 2 | 3 | 45 |
4,016 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiPreTrainedModel | import torch.nn as nn
from .configuration_moshi import MoshiConfig, MoshiDepthConfig
from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
@auto_docstring
class MoshiPreTrainedModel(PreTrainedModel):
config: MoshiConfig
base_model_prefix = 'mod... | @auto_docstring
class MoshiPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 18 | 0 | 18 | 0 | 8 | 0.15 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 33 | 2 | 27 | 12 | 25 | 4 | 24 | 12 | 22 | 8 | 1 | 2 | 8 |
4,017 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiRMSNorm | import torch.nn as nn
import torch
class MoshiRMSNorm(nn.Module):
def __init__(self, dim: int, eps: float=1e-06):
super().__init__()
self.eps = eps
self.weight = nn.Parameter(torch.ones(dim))
def _norm(self, x):
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps... |
class MoshiRMSNorm(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 | 3 | 0 | 3 | 0 | 1 | 0.15 | 1 | 4 | 0 | 0 | 4 | 2 | 4 | 14 | 17 | 3 | 13 | 8 | 8 | 2 | 13 | 8 | 8 | 1 | 1 | 0 | 4 |
4,018 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiRotaryEmbedding | import torch.nn as nn
from .configuration_moshi import MoshiConfig, MoshiDepthConfig
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
class MoshiRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: MoshiConfig, device=None):
super().__in... |
class MoshiRotaryEmbedding(nn.Module):
def __init__(self, config: MoshiConfig, 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 |
4,019 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiSdpaAttention | import torch.nn as nn
import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Any, Optional, Union
from ...utils.deprecation import deprecate_kwarg
class MoshiSdpaAttention(MoshiAttention):
"""
Moshi attention module using torch.nn.functional.scaled_dot_product_attention. Th... |
class MoshiSdpaAttention(MoshiAttention):
'''
Moshi attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
`MoshiAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
SDPA API.
'''
@deprecate_kwa... | 3 | 1 | 83 | 13 | 64 | 14 | 9 | 0.31 | 1 | 4 | 1 | 0 | 1 | 0 | 1 | 13 | 91 | 14 | 65 | 21 | 53 | 20 | 33 | 11 | 31 | 9 | 2 | 1 | 9 |
4,020 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/moshi/modeling_moshi.py | transformers.models.moshi.modeling_moshi.MoshiUnconditionalInput | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, ModelOutput, Seq2SeqLMOutput
from dataclasses import dataclass
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from typing import Any, Optional, Union
import torch.nn as nn
import torch
@dataclass
@auto_docstrin... | @dataclass
@auto_docstring
class MoshiUnconditionalInput(ModelOutput):
'''
input_ids (`torch.Tensor `of shape `(batch_size, sequence_length), *optional*):
The sequence used as a text prompt for the generation.
user_audio_codes (`torch.Tensor `of shape `(batch_size, num_codebooks, sequence_length), *... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 18 | 1 | 5 | 5 | 4 | 12 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
4,021 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/configuration_mpnet.py | transformers.models.mpnet.configuration_mpnet.MPNetConfig | from ...configuration_utils import PretrainedConfig
class MPNetConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MPNetModel`] or a [`TFMPNetModel`]. It is used to
instantiate a MPNet model according to the specified arguments, defining the model architecture. I... |
class MPNetConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MPNetModel`] or a [`TFMPNetModel`]. It is used to
instantiate a MPNet model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults w... | 2 | 1 | 33 | 1 | 32 | 0 | 1 | 1.32 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 89 | 10 | 34 | 33 | 14 | 45 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
4,022 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetAttention | from torch import nn
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
class MPNetAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.attn = MPNetSelfAttention(config)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_n... |
class MPNetAttention(nn.Module):
def __init__(self, config):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, position_bias=None, output_attentions=False, **kwargs):
pass | 4 | 0 | 14 | 1 | 13 | 0 | 1 | 0.03 | 1 | 3 | 1 | 0 | 3 | 4 | 3 | 13 | 44 | 5 | 39 | 20 | 27 | 1 | 23 | 12 | 19 | 2 | 1 | 1 | 4 |
4,023 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetClassificationHead | import torch
from torch import nn
class MPNetClassificationHead(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.dropout = nn.Dropout(config.hidden_dropout_... |
class MPNetClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 7 | 0 | 7 | 1 | 1 | 0.14 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 17 | 2 | 14 | 7 | 11 | 2 | 14 | 7 | 11 | 1 | 1 | 0 | 2 |
4,024 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetEmbeddings | import torch
from torch import nn
class MPNetEmbeddings(nn.Module):
def __init__(self, config):
super().__init__()
self.padding_idx = 1
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=self.padding_idx)
self.position_embeddings = nn.Embedding(c... |
class MPNetEmbeddings(nn.Module):
def __init__(self, config):
pass
def forward(self, input_ids=None, position_ids=None, inputs_embeds=None, **kwargs):
pass
def create_position_ids_from_inputs_embeds(self, inputs_embeds):
'''
We are provided embeddings directly. We cannot ... | 4 | 1 | 18 | 3 | 13 | 2 | 3 | 0.15 | 1 | 1 | 0 | 0 | 3 | 5 | 3 | 13 | 57 | 11 | 40 | 16 | 36 | 6 | 32 | 16 | 28 | 6 | 1 | 2 | 8 |
4,025 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetEncoder | from torch import nn
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import math
import torch
class MPNetEncoder(nn.Module):
def ... |
class MPNetEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=False, **kwargs):
... | 6 | 0 | 21 | 3 | 18 | 0 | 3 | 0.01 | 1 | 8 | 2 | 0 | 3 | 4 | 4 | 14 | 87 | 13 | 73 | 35 | 58 | 1 | 49 | 25 | 44 | 8 | 1 | 2 | 12 |
4,026 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetForMaskedLM | from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torc... |
class MPNetForMaskedLM(MPNetPreTrainedModel):
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, attention_mask: Optiona... | 6 | 1 | 16 | 2 | 12 | 2 | 2 | 0.13 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 74 | 11 | 56 | 26 | 34 | 7 | 25 | 14 | 20 | 5 | 2 | 1 | 8 |
4,027 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetForMultipleChoice | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torch
from torch import nn
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClas... | @auto_docstring
class MPNetForMultipleChoice(MPNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Optional[tor... | 5 | 1 | 36 | 5 | 28 | 4 | 6 | 0.11 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 79 | 10 | 62 | 30 | 42 | 7 | 27 | 18 | 24 | 10 | 2 | 1 | 11 |
4,028 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetForQuestionAnswering | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, logging
from torch import nn
from torch.nn import ... | @auto_docstring
class MPNetForQuestionAnswering(MPNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Optional[... | 5 | 0 | 41 | 5 | 29 | 7 | 4 | 0.2 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 89 | 11 | 65 | 29 | 44 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
4,029 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetForSequenceClassification | from typing import Optional, Union
import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...... | @auto_docstring(custom_intro='\n MPNet Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled\n output) e.g. for GLUE tasks.\n ')
class MPNetForSequenceClassification(MPNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
... | 5 | 1 | 38 | 4 | 31 | 4 | 7 | 0.1 | 1 | 7 | 3 | 0 | 2 | 3 | 2 | 3 | 83 | 8 | 68 | 24 | 48 | 7 | 32 | 12 | 29 | 12 | 2 | 3 | 13 |
4,030 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetForTokenClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
... | @auto_docstring
class MPNetForTokenClassification(MPNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Optiona... | 5 | 1 | 30 | 5 | 23 | 3 | 3 | 0.09 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 68 | 10 | 53 | 25 | 33 | 5 | 22 | 13 | 19 | 5 | 2 | 1 | 6 |
4,031 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetIntermediate | from ...activations import ACT2FN, gelu
import torch
from torch import nn
class MPNetIntermediate(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.intermed... |
class MPNetIntermediate(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,032 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetLMHead | from ...activations import ACT2FN, gelu
from torch import nn
import torch
class MPNetLMHead(nn.Module):
"""MPNet Head for masked and permuted language modeling."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.layer_n... |
class MPNetLMHead(nn.Module):
'''MPNet Head for masked and permuted language modeling.'''
def __init__(self, config):
pass
def _tie_weights(self):
pass
def forward(self, features, **kwargs):
pass | 4 | 1 | 7 | 1 | 5 | 1 | 1 | 0.19 | 1 | 1 | 0 | 0 | 3 | 4 | 3 | 13 | 26 | 7 | 16 | 9 | 12 | 3 | 16 | 9 | 12 | 1 | 1 | 0 | 3 |
4,033 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetLayer | from torch import nn
class MPNetLayer(nn.Module):
def __init__(self, config):
super().__init__()
self.attention = MPNetAttention(config)
self.intermediate = MPNetIntermediate(config)
self.output = MPNetOutput(config)
def forward(self, hidden_states, attention_mask=None, head_m... |
class MPNetLayer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, position_bias=None, output_attentions=False, **kwargs):
pass | 3 | 0 | 14 | 1 | 14 | 1 | 1 | 0.04 | 1 | 4 | 3 | 0 | 2 | 3 | 2 | 12 | 30 | 2 | 28 | 19 | 17 | 1 | 14 | 11 | 11 | 1 | 1 | 0 | 2 |
4,034 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetModel | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from ...utils import auto_docstring, logging
@auto_docstring
class MPNetM... | @auto_docstring
class MPNetModel(MPNetPreTrainedModel):
def __init__(self, config, add_pooling_layer=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(self):
pass
def se... | 8 | 2 | 15 | 2 | 13 | 1 | 3 | 0.07 | 1 | 8 | 4 | 0 | 5 | 4 | 5 | 6 | 88 | 12 | 71 | 30 | 48 | 5 | 37 | 18 | 31 | 11 | 2 | 1 | 17 |
4,035 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetOutput | from torch import nn
import torch
class MPNetOutput(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.Dropout... |
class MPNetOutput(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,036 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetPooler | from torch import nn
import torch
class MPNetPooler(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_token... |
class MPNetPooler(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,037 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetPreTrainedModel | from ...utils import auto_docstring, logging
from .configuration_mpnet import MPNetConfig
from ...modeling_utils import PreTrainedModel
from torch import nn
@auto_docstring
class MPNetPreTrainedModel(PreTrainedModel):
config: MPNetConfig
base_model_prefix = 'mpnet'
def _init_weights(self, module):
... | @auto_docstring
class MPNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.2 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 19 | 1 | 15 | 4 | 13 | 3 | 13 | 4 | 11 | 6 | 1 | 2 | 6 |
4,038 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/modeling_mpnet.py | transformers.models.mpnet.modeling_mpnet.MPNetSelfAttention | from torch import nn
import torch
import math
class MPNetSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')):
raise ValueError(f'The hidden size ({config.hidden_size... |
class MPNetSelfAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, position_bias=None, output_attentions=False, **kwargs):
pass | 3 | 0 | 23 | 5 | 17 | 1 | 3 | 0.06 | 1 | 3 | 0 | 0 | 3 | 8 | 3 | 13 | 71 | 16 | 52 | 30 | 40 | 3 | 41 | 22 | 37 | 5 | 1 | 1 | 8 |
4,039 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/tokenization_mpnet.py | transformers.models.mpnet.tokenization_mpnet.BasicTokenizer | import unicodedata
from ...tokenization_utils import AddedToken, PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
class BasicTokenizer:
"""
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optio... |
class BasicTokenizer:
'''
Constructs a BasicTokenizer 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 (`Iterable`, *opti... | 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,040 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/tokenization_mpnet.py | transformers.models.mpnet.tokenization_mpnet.MPNetTokenizer | from ...tokenization_utils import AddedToken, PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import os
import collections
from typing import Optional
class MPNetTokenizer(PreTrainedTokenizer):
"""
This tokenizer inherits from [`BertTokenizer`] which contains most of the methods. Users shoul... |
class MPNetTokenizer(PreTrainedTokenizer):
'''
This tokenizer inherits from [`BertTokenizer`] which contains most of the methods. Users should refer to the
superclass for more information regarding methods.
Args:
vocab_file (`str`):
Path to the vocabulary file.
do_lower_case... | 15 | 7 | 15 | 1 | 11 | 4 | 3 | 0.71 | 1 | 8 | 2 | 0 | 12 | 5 | 12 | 101 | 263 | 36 | 133 | 57 | 95 | 95 | 75 | 31 | 62 | 10 | 3 | 3 | 33 |
4,041 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpnet/tokenization_mpnet_fast.py | transformers.models.mpnet.tokenization_mpnet_fast.MPNetTokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
import json
from typing import Optional
from .tokenization_mpnet import MPNetTokenizer
from tokenizers import normalizers
from ...tokenization_utils import AddedToken
class MPNetTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" MPNet t... |
class MPNetTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" MPNet tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclass for more ... | 9 | 4 | 18 | 2 | 12 | 4 | 3 | 0.85 | 1 | 4 | 0 | 0 | 6 | 2 | 6 | 94 | 173 | 27 | 79 | 37 | 53 | 67 | 43 | 18 | 36 | 9 | 3 | 2 | 19 |
4,042 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/configuration_mpt.py | transformers.models.mpt.configuration_mpt.MptAttentionConfig | from ...configuration_utils import PretrainedConfig
class MptAttentionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MptAttention`] class. It is used to instantiate
attention layers according to the specified arguments, defining the layers architecture. Inst... |
class MptAttentionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MptAttention`] class. It is used to instantiate
attention layers according to the specified arguments, defining the layers architecture. Instantiating a
configuration with the defaults will... | 2 | 1 | 30 | 1 | 29 | 0 | 2 | 1.13 | 1 | 2 | 0 | 0 | 1 | 10 | 1 | 1 | 71 | 5 | 31 | 26 | 16 | 35 | 16 | 13 | 14 | 2 | 1 | 1 | 2 |
4,043 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/configuration_mpt.py | transformers.models.mpt.configuration_mpt.MptConfig | from typing import Optional, Union
from ...configuration_utils import PretrainedConfig
class MptConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MptModel`]. It is used to instantiate a Mpt model
according to the specified arguments, defining the model architec... |
class MptConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MptModel`]. It is used to instantiate a Mpt model
according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configur... | 2 | 1 | 48 | 0 | 48 | 0 | 3 | 1.11 | 1 | 7 | 1 | 0 | 1 | 19 | 1 | 1 | 128 | 10 | 56 | 46 | 32 | 62 | 28 | 24 | 26 | 3 | 1 | 1 | 3 |
4,044 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptAttention | import math
from ...cache_utils import Cache, DynamicCache
import torch
from torch import nn
from typing import Optional, Union
from .configuration_mpt import MptConfig
from ...utils.deprecation import deprecate_kwarg
class MptAttention(nn.Module):
"""Multi-head self attention.
Using torch or triton attention ... |
class MptAttention(nn.Module):
'''Multi-head self attention.
Using torch or triton attention implementation enables user to also use additive bias.
'''
def __init__(self, config: MptConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', ... | 4 | 1 | 34 | 7 | 27 | 1 | 5 | 0.07 | 1 | 4 | 1 | 0 | 2 | 9 | 2 | 12 | 74 | 16 | 54 | 29 | 45 | 4 | 47 | 23 | 44 | 8 | 1 | 2 | 10 |
4,045 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptBlock | from ...modeling_layers import GradientCheckpointingLayer
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from .configuration_mpt import MptConfig
import torch
from ...cache_utils import Cache, DynamicCache
from torch import nn
from typing import Optional, Union
class MptBlock(GradientChec... |
class MptBlock(GradientCheckpointingLayer):
def __init__(self, config: MptConfig, layer_idx: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor, position_bias: torch.Tensor, attention_mask: torch.Tensor, layer_past: Optional[Cache]=None, use_cache: bool=False, output_attentions: ... | 3 | 0 | 30 | 7 | 20 | 4 | 2 | 0.2 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 62 | 15 | 40 | 24 | 29 | 8 | 27 | 16 | 24 | 3 | 1 | 1 | 4 |
4,046 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptForCausalLM | from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput
from ...generation import GenerationMixin
from ...cache_utils import Cache, Dyn... | @auto_docstring(custom_intro='\n The MPT Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ')
class MptForCausalLM(MptPreTrainedModel, GenerationMixin):
def __init__(self, config: MptConfig):
pass
def set_output_embeddings(sel... | 6 | 1 | 18 | 1 | 14 | 3 | 2 | 0.21 | 2 | 7 | 3 | 0 | 5 | 2 | 5 | 8 | 104 | 12 | 76 | 32 | 50 | 16 | 28 | 16 | 22 | 5 | 2 | 1 | 9 |
4,047 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptForQuestionAnswering | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput
from torch i... | @auto_docstring
class MptForQuestionAnswering(MptPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None, start_positions: Optio... | 5 | 1 | 37 | 4 | 27 | 7 | 4 | 0.24 | 1 | 4 | 2 | 0 | 2 | 2 | 2 | 5 | 77 | 9 | 55 | 26 | 41 | 13 | 31 | 15 | 28 | 7 | 2 | 2 | 8 |
4,048 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptForSequenceClassification | from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from ...cache_utils import Cache, DynamicCache
from typing import Optional, Union
import torch
from ...utils import auto_docstring, logging
from .configuration_mpt import MptConfig
from ...modeling_outputs import BaseModel... | null | 5 | 1 | 49 | 5 | 41 | 4 | 9 | 0.09 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 5 | 106 | 10 | 88 | 29 | 68 | 8 | 45 | 17 | 42 | 16 | 2 | 3 | 17 |
4,049 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptForTokenClassification | from ...utils import auto_docstring, logging
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Questi... | @auto_docstring
class MptForTokenClassification(MptPreTrainedModel):
def __init__(self, config: MptConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, attention_mask: Optional[torch.Tensor]=None, inputs_embeds: Optional[... | 5 | 1 | 36 | 4 | 29 | 4 | 4 | 0.13 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 5 | 80 | 8 | 64 | 28 | 43 | 8 | 28 | 15 | 25 | 5 | 2 | 1 | 8 |
4,050 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptMLP | from torch import nn
from .configuration_mpt import MptConfig
from torch.nn import functional as F
import torch
class MptMLP(nn.Module):
def __init__(self, config: MptConfig):
super().__init__()
hidden_size = config.hidden_size
self.up_proj = nn.Linear(hidden_size, 4 * hidden_size, bias=Fa... |
class MptMLP(nn.Module):
def __init__(self, config: MptConfig):
pass
def forward(self, hidden_states: torch.Tensor, residual: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 9 | 2 | 7 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 19 | 5 | 14 | 10 | 11 | 0 | 14 | 10 | 11 | 1 | 1 | 0 | 2 |
4,051 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptModel | import torch
from typing import Optional, Union
from torch import nn
from ...utils import auto_docstring, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from .configuration_mpt import MptConfig
from ...modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
from ...modeli... | @auto_docstring
class MptModel(MptPreTrainedModel):
def __init__(self, config: MptConfig):
pass
def get_input_embeddings(self):
pass
def build_mpt_alibi_tensor(self, num_heads, sequence_length, alibi_bias_max=8, device=None):
pass
def set_input_embeddings(self, new_embeddings... | 8 | 1 | 28 | 5 | 22 | 2 | 6 | 0.07 | 1 | 10 | 3 | 0 | 5 | 6 | 5 | 8 | 149 | 27 | 115 | 36 | 92 | 8 | 67 | 24 | 61 | 25 | 2 | 2 | 29 |
4,052 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mpt/modeling_mpt.py | transformers.models.mpt.modeling_mpt.MptPreTrainedModel | from torch import nn
from .configuration_mpt import MptConfig
import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from ...utils import auto_docstring, logging
from ...modeling_utils import PreTrainedModel
from ...utils.deprecation import deprecate_kwarg
@auto_docstring
class MptPr... | @auto_docstring
class MptPreTrainedModel(PreTrainedModel):
def __init__(self, *inputs, **kwargs):
pass
def _init_weights(self, module: nn.Module):
'''Initialize the weights.'''
pass
@staticmethod
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
... | 7 | 2 | 12 | 0 | 9 | 3 | 3 | 0.24 | 1 | 3 | 0 | 5 | 2 | 0 | 3 | 3 | 45 | 3 | 34 | 14 | 27 | 8 | 23 | 11 | 19 | 7 | 1 | 2 | 9 |
4,053 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/configuration_mra.py | transformers.models.mra.configuration_mra.MraConfig | from ...configuration_utils import PretrainedConfig
class MraConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MraModel`]. It is used to instantiate an MRA
model according to the specified arguments, defining the model architecture. Instantiating a configuratio... |
class MraConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MraModel`]. It is used to instantiate an MRA
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configu... | 2 | 1 | 43 | 1 | 42 | 0 | 1 | 1.27 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 111 | 11 | 44 | 43 | 19 | 56 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
4,054 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraAttention | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
class MraAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
super().__init__()
self.self = MraSelfAttention(config, position_embedding_type... |
class MraAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states, attention_mask=None):
pass | 4 | 0 | 9 | 1 | 8 | 1 | 1 | 0.13 | 1 | 4 | 2 | 0 | 3 | 3 | 3 | 13 | 30 | 4 | 24 | 11 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
4,055 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraClassificationHead | from ...activations import ACT2FN
from torch import nn
class MraClassificationHead(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.dropout = nn.Dropout(con... |
class MraClassificationHead(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,056 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraEmbeddings | import torch
from torch import nn
class MraEmbeddings(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, config.hidden_size, padding_idx=config.pad_token... |
class MraEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None):
pass | 3 | 1 | 26 | 4 | 20 | 3 | 4 | 0.17 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 56 | 9 | 40 | 16 | 37 | 7 | 34 | 16 | 31 | 7 | 1 | 2 | 8 |
4,057 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraEncoder | from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
class MraEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config ... |
class MraEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_hidden_states=False, return_dict=True):
pass | 3 | 0 | 20 | 3 | 17 | 0 | 4 | 0 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 41 | 6 | 35 | 16 | 25 | 0 | 20 | 9 | 17 | 7 | 1 | 2 | 8 |
4,058 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraForMaskedLM | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from typing import Optional, Union
from ...utils imp... | @auto_docstring
class MraForMaskedLM(MraPreTrainedModel):
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.Tensor]=None, attention_mask: ... | 7 | 1 | 16 | 2 | 12 | 2 | 2 | 0.14 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 74 | 11 | 56 | 26 | 34 | 8 | 25 | 14 | 20 | 5 | 2 | 1 | 8 |
4,059 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraForMultipleChoice | import torch
from typing import Optional, Union
from ...utils import auto_docstring, is_cuda_platform, is_ninja_available, is_torch_cuda_available, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoice... | @auto_docstring
class MraForMultipleChoice(MraPreTrainedModel):
def __init__(self, config):
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, position_ids: Optional[torch.Tensor]=N... | 5 | 1 | 37 | 5 | 29 | 6 | 6 | 0.17 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 82 | 10 | 65 | 27 | 45 | 11 | 30 | 15 | 27 | 11 | 2 | 1 | 12 |
4,060 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraForQuestionAnswering | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
import torch
from typing import Optional, Un... | @auto_docstring
class MraForQuestionAnswering(MraPreTrainedModel):
def __init__(self, config):
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, position_ids: Optional[torch.Tensor... | 5 | 0 | 41 | 5 | 30 | 7 | 4 | 0.2 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 90 | 11 | 66 | 29 | 45 | 13 | 33 | 16 | 30 | 7 | 2 | 2 | 8 |
4,061 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraForSequenceClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from typing import Optional, Union
from ...utils imp... | @auto_docstring(custom_intro='\n MRA 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 MraForSequenceClassification(MraPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def... | 5 | 1 | 37 | 3 | 31 | 4 | 7 | 0.1 | 1 | 7 | 3 | 0 | 2 | 3 | 2 | 3 | 82 | 7 | 68 | 24 | 48 | 7 | 32 | 12 | 29 | 12 | 2 | 3 | 13 |
4,062 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraForTokenClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
import torch
from typing import Optional, Un... | @auto_docstring
class MraForTokenClassification(MraPreTrainedModel):
def __init__(self, config):
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, position_ids: Optional[torch.Tens... | 5 | 1 | 34 | 4 | 27 | 3 | 4 | 0.1 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 76 | 9 | 61 | 28 | 41 | 6 | 27 | 16 | 24 | 6 | 2 | 2 | 7 |
4,063 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraIntermediate | import torch
from torch import nn
from ...activations import ACT2FN
class MraIntermediate(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 MraIntermediate(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,064 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraLMPredictionHead | import torch
from torch import nn
class MraLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = MraPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.bias = nn.Parameter(torch.zero... |
class MraLMPredictionHead(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,065 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraLayer | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...modeling_layers import GradientCheckpointingLayer
class MraLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.chunk_size_feed_forward = config.ch... |
class MraLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None):
pass
def feed_forward_chunk(self, attention_output):
pass | 4 | 0 | 8 | 1 | 7 | 0 | 1 | 0.05 | 1 | 4 | 3 | 0 | 3 | 6 | 3 | 13 | 27 | 5 | 22 | 16 | 18 | 1 | 20 | 16 | 16 | 1 | 1 | 0 | 3 |
4,066 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraModel | from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from typing import Optional, Union
from ...utils import auto_docstring, is_cuda_platform, is_ninja_available, is_torch... | @auto_docstring
class MraModel(MraPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prune: dict of... | 8 | 1 | 19 | 2 | 14 | 2 | 3 | 0.15 | 1 | 7 | 3 | 0 | 5 | 3 | 5 | 6 | 106 | 15 | 79 | 30 | 57 | 12 | 41 | 19 | 35 | 11 | 2 | 2 | 16 |
4,067 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraOnlyMLMHead | import torch
from torch import nn
class MraOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = MraLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predictions(sequence_output)
... |
class MraOnlyMLMHead(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,068 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraOutput | import torch
from torch import nn
class MraOutput(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.Dropout(c... |
class MraOutput(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,069 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraPreTrainedModel | from ...utils import auto_docstring, is_cuda_platform, is_ninja_available, is_torch_cuda_available, logging
from ...modeling_utils import PreTrainedModel
from .configuration_mra import MraConfig
from torch import nn
@auto_docstring
class MraPreTrainedModel(PreTrainedModel):
config: MraConfig
base_model_prefix ... | @auto_docstring
class MraPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.44 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 25 | 2 | 16 | 5 | 14 | 7 | 14 | 5 | 12 | 6 | 1 | 2 | 6 |
4,070 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraPredictionHeadTransform | from ...activations import ACT2FN
import torch
from torch import nn
class MraPredictionHeadTransform(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.transform_a... |
class MraPredictionHeadTransform(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,071 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraReduceSum | import torch
class MraReduceSum:
@staticmethod
def operator_call(sparse_query, indices, query_num_block, key_num_block):
batch_size, num_block, block_size, _ = sparse_query.size()
if len(sparse_query.size()) != 4:
raise ValueError('sparse_query must be a 4-dimensional tensor.')
... |
class MraReduceSum:
@staticmethod
def operator_call(sparse_query, indices, query_num_block, key_num_block):
pass | 3 | 0 | 25 | 6 | 19 | 0 | 3 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 27 | 6 | 21 | 8 | 18 | 0 | 16 | 7 | 14 | 3 | 0 | 1 | 3 |
4,072 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraSampledDenseMatMul | import torch
class MraSampledDenseMatMul(torch.autograd.Function):
@staticmethod
def forward(ctx, dense_query, dense_key, indices, block_size):
sparse_qk_prod = mm_to_sparse(dense_query, dense_key, indices, block_size)
ctx.save_for_backward(dense_query, dense_key, indices)
ctx.block_si... |
class MraSampledDenseMatMul(torch.autograd.Function):
@staticmethod
def forward(ctx, dense_query, dense_key, indices, block_size):
pass
@staticmethod
def backward(ctx, grad):
pass
@staticmethod
def operator_call(dense_query, dense_key, indices, block_size=32):
pass | 7 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 33 | 22 | 2 | 20 | 15 | 13 | 0 | 17 | 12 | 13 | 1 | 5 | 0 | 3 |
4,073 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraSelfAttention | from ...utils import auto_docstring, is_cuda_platform, is_ninja_available, is_torch_cuda_available, logging
import torch
from torch import nn
class MraSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
super().__init__()
if config.hidden_size % config.num_attention... |
class MraSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
pass
def forward(self, hidden_states, attention_mask=None):
pass | 3 | 0 | 29 | 6 | 22 | 1 | 3 | 0.04 | 1 | 4 | 0 | 0 | 3 | 12 | 3 | 13 | 90 | 20 | 67 | 29 | 63 | 3 | 51 | 28 | 47 | 5 | 1 | 2 | 9 |
4,074 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraSelfOutput | import torch
from torch import nn
class MraSelfOutput(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(con... |
class MraSelfOutput(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,075 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mra/modeling_mra.py | transformers.models.mra.modeling_mra.MraSparseDenseMatMul | import torch
class MraSparseDenseMatMul(torch.autograd.Function):
@staticmethod
def forward(ctx, sparse_query, indices, dense_key, query_num_block):
sparse_qk_prod = sparse_dense_mm(sparse_query, indices, dense_key, query_num_block)
ctx.save_for_backward(sparse_query, indices, dense_key)
... |
class MraSparseDenseMatMul(torch.autograd.Function):
@staticmethod
def forward(ctx, sparse_query, indices, dense_key, query_num_block):
pass
@staticmethod
def backward(ctx, grad):
pass
@staticmethod
def operator_call(sparse_query, indices, dense_key, query_num_block):
p... | 7 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 33 | 21 | 2 | 19 | 14 | 12 | 0 | 16 | 11 | 12 | 1 | 5 | 0 | 3 |
4,076 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/configuration_mt5.py | transformers.models.mt5.configuration_mt5.MT5Config | from ...configuration_utils import PretrainedConfig
class MT5Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MT5Model`] or a [`TFMT5Model`]. It is used to
instantiate a mT5 model according to the specified arguments, defining the model architecture. Instantia... |
class MT5Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MT5Model`] or a [`TFMT5Model`]. It is used to
instantiate a mT5 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yiel... | 2 | 1 | 67 | 4 | 62 | 2 | 4 | 0.62 | 1 | 2 | 0 | 0 | 1 | 17 | 1 | 1 | 122 | 8 | 71 | 47 | 45 | 44 | 28 | 23 | 26 | 4 | 1 | 1 | 4 |
4,077 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/configuration_mt5.py | transformers.models.mt5.configuration_mt5.MT5OnnxConfig | from collections.abc import Mapping
from ...onnx import OnnxSeq2SeqConfigWithPast
class MT5OnnxConfig(OnnxSeq2SeqConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
common_inputs = {'input_ids': {0: 'batch', 1: 'encoder_sequence'}, 'attention_mask': {0: 'batch', 1: 'encoder... |
class MT5OnnxConfig(OnnxSeq2SeqConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def default_onnx_opset(self) -> int:
pass
@property
def atol_for_validation(self) -> float:
pass | 7 | 0 | 7 | 1 | 6 | 0 | 2 | 0.09 | 1 | 3 | 0 | 0 | 3 | 0 | 3 | 3 | 29 | 4 | 23 | 8 | 16 | 2 | 16 | 5 | 12 | 3 | 1 | 1 | 5 |
4,078 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5Attention | from torch import nn
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils.deprecation import deprecate_kwarg
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from typing import Optional, Union
from .configuration_mt5 import MT5Config
import math... |
class MT5Attention(nn.Module):
def __init__(self, config: MT5Config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
def prune_heads(self, heads):
pass
@staticmethod
def _relative_position_bucket(relative_position, bidirectional=True, num_buckets=32, max_distan... | 8 | 3 | 44 | 5 | 32 | 8 | 5 | 0.26 | 1 | 5 | 1 | 0 | 4 | 17 | 5 | 15 | 226 | 28 | 160 | 67 | 136 | 42 | 113 | 49 | 107 | 16 | 1 | 3 | 26 |
4,079 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5Block | from torch import nn
import torch
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
class MT5Block(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
... |
class MT5Block(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, position_bias=None, en... | 4 | 0 | 48 | 5 | 41 | 4 | 4 | 0.09 | 1 | 5 | 3 | 0 | 2 | 2 | 2 | 12 | 98 | 11 | 82 | 26 | 64 | 7 | 33 | 11 | 30 | 6 | 1 | 2 | 8 |
4,080 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5ClassificationHead | from torch import nn
from .configuration_mt5 import MT5Config
import torch
class MT5ClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config: MT5Config):
super().__init__()
self.dense = nn.Linear(config.d_model, config.d_model)
self.d... |
class MT5ClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config: MT5Config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 6 | 0 | 6 | 0 | 1 | 0.08 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 16 | 2 | 13 | 6 | 10 | 1 | 13 | 6 | 10 | 1 | 1 | 0 | 2 |
4,081 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5DenseActDense | import torch
from ...activations import ACT2FN
from torch import nn
from .configuration_mt5 import MT5Config
class MT5DenseActDense(nn.Module):
def __init__(self, config: MT5Config):
super().__init__()
self.wi = nn.Linear(config.d_model, config.d_ff, bias=False)
self.wo = nn.Linear(config.... |
class MT5DenseActDense(nn.Module):
def __init__(self, config: MT5Config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 0 | 9 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 20 | 1 | 19 | 7 | 16 | 0 | 15 | 7 | 12 | 2 | 1 | 1 | 3 |
4,082 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5DenseGatedActDense | from torch import nn
from .configuration_mt5 import MT5Config
from ...activations import ACT2FN
import torch
class MT5DenseGatedActDense(nn.Module):
def __init__(self, config: MT5Config):
super().__init__()
self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False)
self.wi_1 = nn.Linea... |
class MT5DenseGatedActDense(nn.Module):
def __init__(self, config: MT5Config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 13 | 1 | 10 | 2 | 2 | 0.14 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 27 | 3 | 21 | 10 | 18 | 3 | 17 | 10 | 14 | 2 | 1 | 1 | 3 |
4,083 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5EncoderModel | from torch import nn
from ...utils.model_parallel_utils import assert_device_map, get_device_map
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...modeling_outputs import BaseModelO... | @auto_docstring
class MT5EncoderModel(MT5PreTrainedModel):
'''
Examples:
```python
>>> from transformers import MT5EncoderModel, AutoTokenizer
>>> model = MT5EncoderModel.from_pretrained("google/mt5-small")
>>> tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
>>> article = "UN O... | 13 | 3 | 12 | 1 | 8 | 2 | 1 | 0.51 | 1 | 7 | 3 | 0 | 8 | 4 | 8 | 11 | 132 | 19 | 75 | 31 | 53 | 38 | 41 | 19 | 32 | 2 | 2 | 1 | 11 |
4,084 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5ForConditionalGeneration | from torch import nn
import copy
from ...utils.model_parallel_utils import assert_device_map, get_device_map
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...cache_utils import Cac... | @auto_docstring(custom_intro='\n MT5 Model with a `language modeling` head on top.\n ')
class MT5ForConditionalGeneration(MT5PreTrainedModel, GenerationMixin):
'''
Examples:
```python
>>> from transformers import MT5ForConditionalGeneration, AutoTokenizer
>>> model = MT5ForConditionalGeneratio... | 13 | 2 | 21 | 2 | 15 | 4 | 3 | 0.35 | 2 | 10 | 4 | 0 | 12 | 7 | 12 | 15 | 305 | 45 | 193 | 59 | 157 | 67 | 114 | 37 | 101 | 20 | 2 | 2 | 37 |
4,085 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5ForQuestionAnswering | from torch import nn
import copy
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutpu... | @auto_docstring
class MT5ForQuestionAnswering(MT5PreTrainedModel):
def __init__(self, config: MT5Config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def get_encoder(self):
pass
@auto_docstring
def forward(sel... | 8 | 1 | 28 | 3 | 22 | 3 | 4 | 0.19 | 1 | 9 | 4 | 0 | 6 | 7 | 6 | 9 | 184 | 24 | 134 | 48 | 107 | 26 | 73 | 29 | 66 | 19 | 2 | 2 | 24 |
4,086 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5ForSequenceClassification | from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqQue... | @auto_docstring(custom_intro='\n MT5 model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g. for GLUE\n tasks.\n ')
class MT5ForSequenceClassification(MT5PreTrainedModel):
def __init__(self, config: MT5Config):
pass
@auto_docstring
def forward(sel... | 5 | 1 | 59 | 5 | 49 | 5 | 9 | 0.11 | 1 | 10 | 4 | 0 | 2 | 3 | 2 | 5 | 126 | 12 | 103 | 35 | 81 | 11 | 48 | 17 | 45 | 17 | 2 | 3 | 18 |
4,087 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5ForTokenClassification | from torch import nn
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqMo... | @auto_docstring
class MT5ForTokenClassification(MT5PreTrainedModel):
def __init__(self, config: MT5Config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, inputs_embeds: Optional[tor... | 5 | 1 | 29 | 4 | 22 | 3 | 3 | 0.17 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 5 | 65 | 9 | 48 | 25 | 33 | 8 | 23 | 14 | 20 | 5 | 2 | 1 | 6 |
4,088 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5LayerCrossAttention | from torch import nn
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
class MT5LayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
super().__init__()
self.EncDecAttention = MT5Attention(config, has_relative_attention_bias=Fa... |
class MT5LayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, key_value_states, attention_mask=None, position_bias=None, layer_head_mask=None, ... | 4 | 0 | 17 | 0 | 17 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 36 | 1 | 35 | 22 | 20 | 1 | 12 | 10 | 9 | 1 | 1 | 0 | 2 |
4,089 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5LayerFF | from torch import nn
from .configuration_mt5 import MT5Config
class MT5LayerFF(nn.Module):
def __init__(self, config: MT5Config):
super().__init__()
if config.is_gated_act:
self.DenseReluDense = MT5DenseGatedActDense(config)
else:
self.DenseReluDense = MT5DenseActDe... |
class MT5LayerFF(nn.Module):
def __init__(self, config: MT5Config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 1 | 7 | 0 | 2 | 0 | 1 | 5 | 4 | 0 | 2 | 3 | 2 | 12 | 16 | 2 | 14 | 7 | 11 | 0 | 13 | 7 | 10 | 2 | 1 | 1 | 3 |
4,090 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5LayerNorm | from torch import nn
import torch
class MT5LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Construct a layernorm module in the MT5 style. No bias and no subtraction of mean.
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
... |
class MT5LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Construct a layernorm module in the MT5 style. No bias and no subtraction of mean.
'''
pass
def forward(self, hidden_states):
pass | 3 | 1 | 11 | 2 | 5 | 4 | 2 | 0.73 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 23 | 4 | 11 | 6 | 8 | 8 | 11 | 6 | 8 | 2 | 1 | 1 | 3 |
4,091 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5LayerSelfAttention | from typing import Optional, Union
from torch import nn
from ...utils.deprecation import deprecate_kwarg
class MT5LayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
super().__init__()
self.SelfAttention = MT5Attention(config... |
class MT5LayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, position_bias=None, layer_... | 4 | 0 | 16 | 0 | 16 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 34 | 1 | 33 | 19 | 20 | 1 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
4,092 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5Model | from torch import nn
import copy
from ...utils.model_parallel_utils import assert_device_map, get_device_map
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...cache_utils import Cac... | @auto_docstring
class MT5Model(MT5PreTrainedModel):
'''
Examples:
```python
>>> from transformers import MT5Model, AutoTokenizer
>>> model = MT5Model.from_pretrained("google/mt5-small")
>>> tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
>>> article = "UN Offizier sagt, dass we... | 13 | 3 | 20 | 2 | 15 | 3 | 3 | 0.34 | 1 | 9 | 4 | 0 | 9 | 5 | 9 | 12 | 225 | 30 | 145 | 45 | 113 | 50 | 74 | 24 | 64 | 14 | 2 | 2 | 24 |
4,093 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5PreTrainedModel | from .configuration_mt5 import MT5Config
from ...modeling_utils import PreTrainedModel
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
@auto_docstring
class MT5PreTrainedModel(PreTrained... | @auto_docstring
class MT5PreTrainedModel(PreTrainedModel):
@property
def dummy_inputs(self):
pass
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _shift_right(self, input_ids):
pass | 6 | 1 | 32 | 1 | 27 | 4 | 8 | 0.18 | 1 | 11 | 10 | 7 | 3 | 0 | 3 | 3 | 115 | 8 | 92 | 25 | 87 | 17 | 74 | 24 | 70 | 19 | 1 | 2 | 24 |
4,094 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/modeling_mt5.py | transformers.models.mt5.modeling_mt5.MT5Stack | from torch import nn
from ...utils.model_parallel_utils import assert_device_map, get_device_map
from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
from ...cache_utils import Cache, DynamicC... |
class MT5Stack(MT5PreTrainedModel):
def __init__(self, config, embed_tokens=None):
pass
@add_start_docstrings(PARALLELIZE_DOCSTRING)
def parallelize(self, device_map=None):
pass
@add_start_docstrings(DEPARALLELIZE_DOCSTRING)
def deparallelize(self):
pass
def set_input_... | 11 | 1 | 53 | 4 | 42 | 7 | 10 | 0.17 | 1 | 18 | 8 | 0 | 7 | 10 | 8 | 11 | 439 | 42 | 342 | 92 | 299 | 57 | 192 | 58 | 183 | 57 | 2 | 4 | 80 |
4,095 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/tokenization_mt5.py | transformers.models.mt5.tokenization_mt5.MT5Tokenizer | from ..t5 import T5Tokenizer
class MT5Tokenizer(T5Tokenizer):
pass |
class MT5Tokenizer(T5Tokenizer):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 109 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
4,096 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/mt5/tokenization_mt5_fast.py | transformers.models.mt5.tokenization_mt5_fast.MT5TokenizerFast | from ..t5 import T5TokenizerFast
class MT5TokenizerFast(T5TokenizerFast):
pass |
class MT5TokenizerFast(T5TokenizerFast):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 96 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
4,097 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/configuration_musicgen.py | transformers.models.musicgen.configuration_musicgen.MusicgenConfig | from ..auto.configuration_auto import AutoConfig
from ...configuration_utils import PretrainedConfig
class MusicgenConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MusicgenModel`]. It is used to instantiate a
MusicGen model according to the specified arguments... |
class MusicgenConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MusicgenModel`]. It is used to instantiate a
MusicGen model according to the specified arguments, defining the text encoder, audio encoder and MusicGen decoder
configs.
Configuration object... | 6 | 2 | 13 | 2 | 9 | 2 | 1 | 1.34 | 1 | 4 | 2 | 0 | 2 | 4 | 3 | 3 | 110 | 21 | 38 | 24 | 26 | 51 | 21 | 16 | 17 | 2 | 1 | 1 | 4 |
4,098 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/configuration_musicgen.py | transformers.models.musicgen.configuration_musicgen.MusicgenDecoderConfig | from ...configuration_utils import PretrainedConfig
class MusicgenDecoderConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`MusicgenDecoder`]. It is used to instantiate a
MusicGen decoder according to the specified arguments, defining the model architecture. In... |
class MusicgenDecoderConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`MusicgenDecoder`]. It is used to instantiate a
MusicGen decoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults wi... | 2 | 1 | 51 | 2 | 49 | 1 | 2 | 0.92 | 1 | 2 | 0 | 0 | 1 | 16 | 1 | 1 | 108 | 7 | 53 | 44 | 28 | 49 | 24 | 21 | 22 | 2 | 1 | 1 | 2 |
4,099 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/musicgen/modeling_musicgen.py | transformers.models.musicgen.modeling_musicgen.MusicgenAttention | from ...utils.deprecation import deprecate_kwarg
import torch.nn as nn
import torch
from .configuration_musicgen import MusicgenConfig, MusicgenDecoderConfig
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...processing_utils import Unpack
from typing import TYPE_CHECKING, Any, Callable, Option... |
class MusicgenAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: Optional[float]=0.0, is_decoder: Optional[bool]=False, bias: Optional[bool]=True, is_causal: Optional[bool]=False, config: Optional[MusicgenConfig... | 4 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 2 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.