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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,500 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioEncoder | from typing import Callable, Optional, Union
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
import torch
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ... |
class Data2VecAudioEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.tensor, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=True):
pass
def _update_full_mask(self, a... | 4 | 0 | 41 | 5 | 33 | 3 | 8 | 0.07 | 1 | 8 | 3 | 0 | 2 | 7 | 2 | 12 | 83 | 11 | 67 | 26 | 57 | 5 | 45 | 19 | 42 | 15 | 1 | 3 | 16 |
1,501 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioEncoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class Data2VecAudioEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = Data2VecAudioAttention(embed_dim=config.hidden_size, num_heads=config.num_attention_heads, dro... |
class Data2VecAudioEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False):
pass | 3 | 0 | 16 | 3 | 13 | 0 | 2 | 0 | 1 | 2 | 1 | 0 | 2 | 5 | 2 | 12 | 33 | 6 | 27 | 11 | 24 | 0 | 20 | 11 | 17 | 2 | 1 | 1 | 3 |
1,502 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioFeatureEncoder | from torch import nn
class Data2VecAudioFeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
self.conv_layers = nn.ModuleList([Data2VecAudioConvLayer(config, layer_id=i) for i in range(config.num_feat_extract_layers)])
... |
class Data2VecAudioFeatureEncoder(nn.Module):
'''Construct the features from raw audio waveform'''
def __init__(self, config):
pass
def _freeze_parameters(self):
pass
def forward(self, input_values):
pass | 4 | 1 | 9 | 1 | 8 | 0 | 2 | 0.16 | 1 | 3 | 1 | 0 | 3 | 3 | 3 | 13 | 35 | 6 | 25 | 10 | 21 | 4 | 19 | 10 | 15 | 4 | 1 | 2 | 7 |
1,503 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioFeatureProjection | from torch import nn
class Data2VecAudioFeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.layer_norm_eps)
self.projection = nn.Linear(config.conv_dim[-1], config.hidden_size)
self.dropout = nn... |
class Data2VecAudioFeatureProjection(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.09 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 13 | 1 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
1,504 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioFeedForward | from torch import nn
from ...activations import ACT2FN
class Data2VecAudioFeedForward(nn.Module):
def __init__(self, config):
super().__init__()
self.intermediate_dropout = nn.Dropout(config.activation_dropout)
self.intermediate_dense = nn.Linear(config.hidden_size, config.intermediate_siz... |
class Data2VecAudioFeedForward(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 2 | 9 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 4 | 18 | 8 | 15 | 0 | 17 | 8 | 14 | 2 | 1 | 1 | 3 |
1,505 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioForAudioFrameClassification | from torch.nn import CrossEntropyLoss
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from torch import nn
import warnings
from ...utils import auto_docstring, is_peft_available, is_torch_flex_attn_available
import ... | @auto_docstring
class Data2VecAudioForAudioFrameClassification(Data2VecAudioPreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_extractor(self):
'''
Calling this function will disable the gradient computation for the feature encoder so that its parameter will
... | 8 | 4 | 18 | 2 | 13 | 4 | 3 | 0.27 | 1 | 7 | 2 | 0 | 5 | 4 | 5 | 8 | 105 | 13 | 73 | 28 | 52 | 20 | 39 | 19 | 33 | 6 | 2 | 1 | 13 |
1,506 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioForCTC | from typing import Callable, Optional, Union
import torch
import warnings
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from torch import nn
from ...utils import auto_docstring, is_peft_available, is_torch_flex_at... | @auto_docstring(custom_intro='\n Data2VecAudio Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ')
class Data2VecAudioForCTC(Data2VecAudioPreTrainedModel):
def __init__(self, config):
'''
target_lang (`str`, *optional*):
Language id o... | 7 | 4 | 27 | 3 | 18 | 5 | 3 | 0.26 | 1 | 7 | 2 | 0 | 4 | 3 | 4 | 7 | 119 | 16 | 82 | 28 | 61 | 21 | 37 | 19 | 32 | 7 | 2 | 2 | 12 |
1,507 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioForSequenceClassification | from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
import warnings
from typing import Callable, Optional, Union
from torch.nn import CrossEntropyLoss
from ...utils import auto_docstring, is_peft_available, is_torch_fle... | @auto_docstring(custom_intro='\n Data2VecAudio Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like\n SUPERB Keyword Spotting.\n ')
class Data2VecAudioForSequenceClassification(Data2VecAudioPreTrainedModel):
def __init__(self, config):
pass
d... | 8 | 4 | 20 | 2 | 14 | 4 | 3 | 0.26 | 1 | 7 | 2 | 0 | 5 | 4 | 5 | 8 | 114 | 14 | 80 | 31 | 59 | 21 | 46 | 22 | 40 | 8 | 2 | 1 | 15 |
1,508 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioForXVector | from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput, TokenClassifierOutput, Wav2Vec2BaseModelOutput, XVectorOutput
from ...utils import auto_docstring, is_peft_available, is_torch_flex_attn_available
import warnings
from torch import nn
... | @auto_docstring(custom_intro='\n Data2VecAudio Model with an XVector feature extraction head on top for tasks like Speaker Verification.\n ')
class Data2VecAudioForXVector(Data2VecAudioPreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_extractor(self):
'''
Call... | 10 | 5 | 19 | 3 | 13 | 4 | 3 | 0.27 | 1 | 11 | 4 | 0 | 6 | 7 | 6 | 9 | 144 | 23 | 96 | 42 | 73 | 26 | 63 | 33 | 55 | 10 | 2 | 2 | 19 |
1,509 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioModel | from typing import Callable, Optional, Union
import torch
from .configuration_data2vec_audio import Data2VecAudioConfig
from torch import nn
from ...utils import auto_docstring, is_peft_available, is_torch_flex_attn_available
@auto_docstring
class Data2VecAudioModel(Data2VecAudioPreTrainedModel):
def __init__(sel... | @auto_docstring
class Data2VecAudioModel(Data2VecAudioPreTrainedModel):
def __init__(self, config: Data2VecAudioConfig):
pass
def freeze_feature_encoder(self):
'''
Calling this function will disable the gradient computation for the feature encoder so that its parameter will
not... | 7 | 3 | 30 | 4 | 22 | 4 | 4 | 0.16 | 1 | 9 | 6 | 0 | 4 | 6 | 4 | 7 | 130 | 20 | 95 | 30 | 69 | 15 | 45 | 16 | 40 | 7 | 2 | 1 | 16 |
1,510 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioPadLayer | from torch import nn
class Data2VecAudioPadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
super().__init__()
self.num_pad_remove = 1 if num_conv_pos_embeddings % 2 == 0 else 0
def forward(self, hidden_states):
if self.num_pad_remove > 0:
hidden_states = hid... |
class Data2VecAudioPadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 2 | 1 | 1 | 4 |
1,511 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioPositionalConvEmbedding | from torch import nn
class Data2VecAudioPositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.layers = nn.ModuleList([Data2VecAudioPositionalConvLayer(config) for _ in range(config.num_conv_pos_embeddings)])
def forward(self, hidden_states):
hidden_st... |
class Data2VecAudioPositionalConvEmbedding(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 13 | 1 | 12 | 6 | 9 | 0 | 10 | 5 | 7 | 2 | 1 | 1 | 3 |
1,512 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioPositionalConvLayer | from torch import nn
from ...activations import ACT2FN
class Data2VecAudioPositionalConvLayer(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_size=config.conv_pos_kernel_size, padding=config.conv_pos_kernel_size // 2, ... |
class Data2VecAudioPositionalConvLayer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 12 | 1 | 10 | 1 | 1 | 0.05 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 25 | 3 | 21 | 7 | 18 | 1 | 15 | 7 | 12 | 1 | 1 | 0 | 2 |
1,513 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.Data2VecAudioPreTrainedModel | from ...utils import auto_docstring, is_peft_available, is_torch_flex_attn_available
from .configuration_data2vec_audio import Data2VecAudioConfig
from typing import Callable, Optional, Union
import torch
import math
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
@auto_docs... | @auto_docstring
class Data2VecAudioPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _get_feat_extract_output_lengths(self, input_lengths: Union[torch.LongTensor, int], add_adapter: Optional[bool]=None):
'''
Computes the ou... | 6 | 2 | 17 | 3 | 12 | 3 | 4 | 0.28 | 1 | 6 | 2 | 5 | 3 | 0 | 3 | 3 | 82 | 14 | 53 | 21 | 44 | 15 | 43 | 17 | 38 | 10 | 1 | 2 | 17 |
1,514 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_audio.py | transformers.models.data2vec.modeling_data2vec_audio.TDNNLayer | from ...utils import auto_docstring, is_peft_available, is_torch_flex_attn_available
import warnings
import torch
from torch import nn
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.tdnn_dim[layer_id - 1] if layer_id > 0 else config... |
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 14 | 2 | 11 | 1 | 3 | 0.04 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 29 | 5 | 23 | 11 | 19 | 1 | 20 | 11 | 16 | 3 | 1 | 2 | 5 |
1,515 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextAttention | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch.nn as nn
from ...processing_utils import Unpack
import torch
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from typing import Callable, Optional, Uni... |
class Data2VecTextAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=... | 4 | 0 | 15 | 1 | 14 | 1 | 1 | 0.07 | 1 | 5 | 1 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 43 | 20 | 30 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
1,516 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextClassificationHead | import torch.nn as nn
import torch
class Data2VecTextClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
classifier_dropout = config.classifier_d... |
class Data2VecTextClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 8 | 0 | 8 | 1 | 2 | 0.12 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 2 | 17 | 8 | 14 | 2 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
1,517 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextEncoder | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...processing_utils import Unpack
from typing import Callable, Optional, Union
import torch.nn as nn
from ...cache_utils import Cache, EncoderDecoderCache
import torch
from ...modeling_outputs import BaseModelOutputWithP... |
class Data2VecTextEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: Optiona... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
1,518 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextForCausalLM | from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch.nn as nn
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions... | @auto_docstring(custom_intro='\n Data2VecText Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class Data2VecTextForCausalLM(Data2VecTextPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_emb... | 8 | 1 | 25 | 3 | 15 | 7 | 2 | 0.44 | 2 | 6 | 3 | 0 | 5 | 2 | 5 | 6 | 136 | 22 | 79 | 34 | 54 | 35 | 32 | 16 | 26 | 6 | 2 | 1 | 12 |
1,519 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextForMaskedLM | from typing import Callable, Optional, Union
import torch.nn as nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from ...modeling_outputs import BaseMode... | @auto_docstring
class Data2VecTextForMaskedLM(Data2VecTextPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optio... | 8 | 1 | 19 | 2 | 15 | 2 | 2 | 0.13 | 1 | 5 | 3 | 0 | 4 | 2 | 4 | 5 | 89 | 12 | 68 | 29 | 42 | 9 | 27 | 14 | 22 | 5 | 2 | 1 | 9 |
1,520 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextForMultipleChoice | import torch.nn as nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Callable, Optional, Union
import torch
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCros... | @auto_docstring
class Data2VecTextForMultipleChoice(Data2VecTextPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Floa... | 6 | 1 | 38 | 5 | 30 | 4 | 6 | 0.1 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 85 | 10 | 68 | 34 | 45 | 7 | 29 | 19 | 26 | 11 | 2 | 1 | 12 |
1,521 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextForQuestionAnswering | import torch
from ...utils.generic import can_return_tuple, check_model_inputs
import torch.nn as nn
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelO... | @auto_docstring
class Data2VecTextForQuestionAnswering(Data2VecTextPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.... | 6 | 0 | 41 | 5 | 30 | 7 | 4 | 0.19 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 90 | 10 | 67 | 30 | 45 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
1,522 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextForSequenceClassification | import torch.nn as nn
from ...utils.generic import can_return_tuple, check_model_inputs
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...processing_utils import Unpack
from ...modeling_ou... | @auto_docstring(custom_intro='\n Data2VecText Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ')
class Data2VecTextForSequenceClassification(Data2VecTextPreTrainedModel):
def __init__(self, config):
pass
... | 6 | 1 | 40 | 4 | 33 | 4 | 7 | 0.1 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 88 | 9 | 72 | 26 | 51 | 7 | 34 | 13 | 31 | 12 | 2 | 3 | 13 |
1,523 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextForTokenClassification | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...processing_utils import Unpack
impo... | @auto_docstring
class Data2VecTextForTokenClassification(Data2VecTextPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torc... | 6 | 1 | 33 | 5 | 26 | 3 | 4 | 0.08 | 1 | 4 | 2 | 0 | 2 | 4 | 2 | 3 | 74 | 10 | 59 | 27 | 38 | 5 | 24 | 14 | 21 | 5 | 2 | 1 | 7 |
1,524 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextIntermediate | from ...activations import ACT2FN, gelu
import torch
import torch.nn as nn
class Data2VecTextIntermediate(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.... |
class Data2VecTextIntermediate(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 |
1,525 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextLMHead | import torch
from ...activations import ACT2FN, gelu
import torch.nn as nn
class Data2VecTextLMHead(nn.Module):
"""Data2VecText Head for masked language modeling."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.layer... |
class Data2VecTextLMHead(nn.Module):
'''Data2VecText Head for masked language modeling.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass
def _tie_weights(self):
pass | 4 | 1 | 8 | 1 | 6 | 1 | 1 | 0.21 | 1 | 1 | 0 | 0 | 3 | 4 | 3 | 13 | 29 | 6 | 19 | 9 | 15 | 4 | 18 | 9 | 14 | 2 | 1 | 1 | 4 |
1,526 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextLayer | from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, is_torch_fle... |
class Data2VecTextLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, ... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.1 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 84 | 9 | 70 | 32 | 57 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
1,527 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextModel | from ...cache_utils import Cache, EncoderDecoderCache
import torch
from ...processing_utils import Unpack
import torch.nn as nn
from ...utils.generic import can_return_tuple, check_model_inputs
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_attn_mask_util... | @auto_docstring
class Data2VecTextModel(Data2VecTextPreTrainedModel):
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):
pa... | 12 | 2 | 30 | 3 | 20 | 7 | 5 | 0.41 | 1 | 8 | 4 | 0 | 5 | 4 | 5 | 6 | 178 | 26 | 108 | 41 | 81 | 44 | 55 | 25 | 49 | 18 | 2 | 2 | 24 |
1,528 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextOutput | import torch
import torch.nn as nn
class Data2VecTextOutput(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... |
class Data2VecTextOutput(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 |
1,529 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextPooler | import torch
import torch.nn as nn
class Data2VecTextPooler(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:
fir... |
class Data2VecTextPooler(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 |
1,530 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextPreTrainedModel | from .configuration_data2vec_text import Data2VecTextConfig
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch.nn as nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class Data2VecTextPreTrainedModel(PreTrainedModel):
... | @auto_docstring
class Data2VecTextPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 17 | 0 | 14 | 3 | 8 | 0.37 | 1 | 0 | 0 | 7 | 1 | 0 | 1 | 1 | 28 | 2 | 19 | 6 | 17 | 7 | 17 | 6 | 15 | 8 | 1 | 2 | 8 |
1,531 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextSelfAttention | import torch
from ...cache_utils import Cache, EncoderDecoderCache
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch.nn as nn
from ...processing_utils import Unpack
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callabl... |
class Data2VecTextSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_value: Opt... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 0 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
1,532 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_text.py | transformers.models.data2vec.modeling_data2vec_text.Data2VecTextSelfOutput | import torch
import torch.nn as nn
class Data2VecTextSelfOutput(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.D... |
class Data2VecTextSelfOutput(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 |
1,533 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionAttention | from torch import nn
import torch
from typing import Optional, Union
from ...pytorch_utils import compile_compatible_method_lru_cache, find_pruneable_heads_and_indices, prune_linear_layer
from .configuration_data2vec_vision import Data2VecVisionConfig
class Data2VecVisionAttention(nn.Module):
def __init__(self, c... |
class Data2VecVisionAttention(nn.Module):
def __init__(self, config: Data2VecVisionConfig, window_size: Optional[tuple]=None) -> None:
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=Fa... | 4 | 0 | 14 | 1 | 12 | 1 | 1 | 0.08 | 1 | 8 | 2 | 0 | 3 | 3 | 3 | 13 | 44 | 6 | 36 | 19 | 24 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
1,534 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionConvModule | import torch
from typing import Optional, Union
from torch import nn
class Data2VecVisionConvModule(nn.Module):
"""
A convolutional block that bundles conv/norm/activation layers. This block simplifies the usage of convolution
layers, which are commonly used with a norm layer (e.g., BatchNorm) and activati... |
class Data2VecVisionConvModule(nn.Module):
'''
A convolutional block that bundles conv/norm/activation layers. This block simplifies the usage of convolution
layers, which are commonly used with a norm layer (e.g., BatchNorm) and activation layer (e.g., ReLU).
Based on OpenMMLab's implementation, found... | 3 | 1 | 13 | 1 | 13 | 0 | 1 | 0.19 | 1 | 5 | 0 | 0 | 2 | 3 | 2 | 12 | 35 | 4 | 26 | 15 | 15 | 5 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
1,535 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionDropPath | from torch import nn
from typing import Optional, Union
import torch
class Data2VecVisionDropPath(nn.Module):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
def __init__(self, drop_prob: Optional[float]=None) -> None:
super().__init__()
self.drop... |
class Data2VecVisionDropPath(nn.Module):
'''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).'''
def __init__(self, drop_prob: Optional[float]=None) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass
def extra_rep... | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.13 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 13 | 12 | 3 | 8 | 5 | 4 | 1 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
1,536 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionEmbeddings | from typing import Optional, Union
from .configuration_data2vec_vision import Data2VecVisionConfig
import collections.abc
import torch
from ...utils import auto_docstring, logging, torch_int
from torch import nn
import warnings
class Data2VecVisionEmbeddings(nn.Module):
"""
Construct the CLS token, position an... |
class Data2VecVisionEmbeddings(nn.Module):
'''
Construct the CLS token, position and patch embeddings. Optionally, also the mask token.
'''
def __init__(self, config: Data2VecVisionConfig) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) ... | 4 | 2 | 30 | 5 | 22 | 3 | 4 | 0.2 | 1 | 7 | 2 | 0 | 3 | 7 | 3 | 13 | 99 | 20 | 66 | 31 | 57 | 13 | 47 | 26 | 43 | 5 | 1 | 2 | 11 |
1,537 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionEncoder | from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, SemanticSegmenterOutput
from typing import Optional, Union
from .configuration_data2vec_vision import Data2VecVisionConfig
class Data2VecVisionEncoder(nn.Module):
def __init__(self... |
class Data2VecVisionEncoder(nn.Module):
def __init__(self, config: Data2VecVisionConfig, window_size: Optional[tuple]=None) -> None:
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, interpolate... | 3 | 0 | 41 | 4 | 36 | 1 | 7 | 0.01 | 1 | 11 | 4 | 0 | 2 | 4 | 2 | 12 | 83 | 9 | 73 | 25 | 61 | 1 | 31 | 16 | 28 | 11 | 1 | 2 | 14 |
1,538 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionFCNHead | import torch
from typing import Optional, Union
from torch import nn
from .configuration_data2vec_vision import Data2VecVisionConfig
class Data2VecVisionFCNHead(nn.Module):
"""
Fully Convolution Networks for Semantic Segmentation. This head is implemented of
[FCNNet](https://huggingface.co/papers/1411.4038... |
class Data2VecVisionFCNHead(nn.Module):
'''
Fully Convolution Networks for Semantic Segmentation. This head is implemented of
[FCNNet](https://huggingface.co/papers/1411.4038>).
Args:
config (Data2VecVisionConfig): Configuration.
in_channels
kernel_size (int): The kernel size fo... | 3 | 1 | 23 | 1 | 21 | 1 | 3 | 0.26 | 1 | 6 | 2 | 0 | 2 | 8 | 2 | 12 | 61 | 7 | 43 | 22 | 34 | 11 | 26 | 16 | 23 | 4 | 1 | 1 | 6 |
1,539 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionForImageClassification | from .configuration_data2vec_vision import Data2VecVisionConfig
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, SemanticSegmenterOutput
from ...utils import auto_docstring, logging, torch_int
import torch
from torch import nn
@auto_... | @auto_docstring(custom_intro='\n Data2VecVision Model transformer with an image classification head on top (a linear layer on top of the average of\n the final hidden states of the patch tokens) e.g. for ImageNet.\n ')
class Data2VecVisionForImageClassification(Data2VecVisionPreTrainedModel):
def __init__... | 5 | 1 | 37 | 4 | 29 | 4 | 8 | 0.12 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 82 | 9 | 65 | 22 | 46 | 8 | 32 | 12 | 29 | 13 | 2 | 3 | 15 |
1,540 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionForSemanticSegmentation | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, SemanticSegmenterOutput
from .configuration_data2vec_vision import Data2VecVisionConfig
import torch
from torch.nn import CrossEntropyLoss
from torch import nn
from ...utils import auto... | @auto_docstring
class Data2VecVisionForSemanticSegmentation(Data2VecVisionPreTrainedModel):
def __init__(self, config: Data2VecVisionConfig) -> None:
pass
def compute_loss(self, logits, auxiliary_logits, labels):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.Tenso... | 6 | 1 | 47 | 7 | 31 | 9 | 6 | 0.29 | 1 | 12 | 5 | 0 | 3 | 8 | 3 | 4 | 145 | 23 | 95 | 39 | 80 | 28 | 52 | 29 | 48 | 12 | 2 | 2 | 18 |
1,541 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionIntermediate | import torch
from torch import nn
from .configuration_data2vec_vision import Data2VecVisionConfig
from ...activations import ACT2FN
class Data2VecVisionIntermediate(nn.Module):
def __init__(self, config: Data2VecVisionConfig) -> None:
super().__init__()
self.dense = nn.Linear(config.hidden_size, c... |
class Data2VecVisionIntermediate(nn.Module):
def __init__(self, config: Data2VecVisionConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 1 | 6 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 14 | 2 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
1,542 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionLayer | from torch import nn
import torch
from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
from .configuration_data2vec_vision import Data2VecVisionConfig
class Data2VecVisionLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""... |
class Data2VecVisionLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: Data2VecVisionConfig, window_size: Optional[tuple]=None, drop_path_rate: float=0.0) -> None:
pass
def forward(self, hidden_states: torch.Tensor, ... | 3 | 1 | 31 | 5 | 24 | 3 | 3 | 0.14 | 1 | 11 | 5 | 0 | 2 | 10 | 2 | 12 | 65 | 11 | 49 | 28 | 36 | 7 | 31 | 18 | 28 | 3 | 1 | 1 | 6 |
1,543 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionModel | from ...utils import auto_docstring, logging, torch_int
import torch
from torch import nn
from .configuration_data2vec_vision import Data2VecVisionConfig
from typing import Optional, Union
@auto_docstring
class Data2VecVisionModel(Data2VecVisionPreTrainedModel):
def __init__(self, config: Data2VecVisionConfig, ad... | @auto_docstring
class Data2VecVisionModel(Data2VecVisionPreTrainedModel):
def __init__(self, config: Data2VecVisionConfig, add_pooling_layer: bool=False) -> None:
'''
add_pooling_layer (bool, *optional*, defaults to `False`):
Whether to add a pooling layer
'''
pass
... | 7 | 3 | 20 | 2 | 14 | 4 | 3 | 0.22 | 1 | 9 | 5 | 0 | 4 | 5 | 4 | 5 | 90 | 11 | 65 | 27 | 43 | 14 | 29 | 17 | 24 | 7 | 2 | 1 | 13 |
1,544 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionModelOutputWithPooling | from ...utils import auto_docstring, logging, torch_int
from dataclasses import dataclass
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, SemanticSegmenterOutput
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`Data2VecVisionModel`].\n ')
clas... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`Data2VecVisionModel`].\n ')
class Data2VecVisionModelOutputWithPooling(BaseModelOutputWithPooling):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`):
Average of the last layer hidden states of the patch ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 19 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 23 | 3 | 1 | 1 | 0 | 19 | 1 | 1 | 0 | 0 | 2 | 0 | 0 |
1,545 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionOutput | import torch
from torch import nn
from .configuration_data2vec_vision import Data2VecVisionConfig
class Data2VecVisionOutput(nn.Module):
def __init__(self, config: Data2VecVisionConfig) -> None:
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dr... |
class Data2VecVisionOutput(nn.Module):
def __init__(self, config: Data2VecVisionConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 11 | 2 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
1,546 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionPatchEmbeddings | import torch
import collections.abc
from torch import nn
class Data2VecVisionPatchEmbeddings(nn.Module):
"""
This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial
`hidden_states` (patch embeddings) of shape `(batch_size, seq_length, hidden_size)` to be consum... |
class Data2VecVisionPatchEmbeddings(nn.Module):
'''
This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial
`hidden_states` (patch embeddings) of shape `(batch_size, seq_length, hidden_size)` to be consumed by a
Transformer.
'''
def __init__(self, ... | 3 | 1 | 22 | 3 | 18 | 1 | 3 | 0.16 | 1 | 4 | 0 | 0 | 2 | 6 | 2 | 12 | 51 | 8 | 37 | 20 | 30 | 6 | 27 | 16 | 24 | 3 | 1 | 1 | 6 |
1,547 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionPooler | import torch
from torch import nn
from .configuration_data2vec_vision import Data2VecVisionConfig
class Data2VecVisionPooler(nn.Module):
def __init__(self, config: Data2VecVisionConfig) -> None:
super().__init__()
self.layernorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) if conf... |
class Data2VecVisionPooler(nn.Module):
def __init__(self, config: Data2VecVisionConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 1 | 6 | 1 | 2 | 0.15 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 17 | 2 | 13 | 6 | 10 | 2 | 10 | 6 | 7 | 2 | 1 | 1 | 4 |
1,548 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionPreTrainedModel | from ...utils import auto_docstring, logging, torch_int
from .configuration_data2vec_vision import Data2VecVisionConfig
from ...modeling_utils import PreTrainedModel
from torch import nn
@auto_docstring
class Data2VecVisionPreTrainedModel(PreTrainedModel):
config: Data2VecVisionConfig
base_model_prefix = 'data... | @auto_docstring
class Data2VecVisionPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.35 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 29 | 2 | 20 | 9 | 18 | 7 | 18 | 9 | 16 | 6 | 1 | 2 | 6 |
1,549 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionPyramidPoolingBlock | from torch import nn
import torch
class Data2VecVisionPyramidPoolingBlock(nn.Module):
def __init__(self, pool_scale: int, in_channels: int, channels: int) -> None:
super().__init__()
self.layers = [nn.AdaptiveAvgPool2d(pool_scale), Data2VecVisionConvModule(in_channels, channels, kernel_size=1)]
... |
class Data2VecVisionPyramidPoolingBlock(nn.Module):
def __init__(self, pool_scale: int, in_channels: int, channels: int) -> None:
pass
def forward(self, input: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 6 | 1 | 0 | 2 | 1 | 2 | 12 | 15 | 1 | 14 | 7 | 11 | 0 | 11 | 7 | 8 | 2 | 1 | 1 | 4 |
1,550 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionPyramidPoolingModule | import torch
from torch import nn
class Data2VecVisionPyramidPoolingModule(nn.Module):
"""
Pyramid Pooling Module (PPM) used in PSPNet.
Args:
pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid
Module.
in_channels (int): Input channels.
channels (int): Chan... |
class Data2VecVisionPyramidPoolingModule(nn.Module):
'''
Pyramid Pooling Module (PPM) used in PSPNet.
Args:
pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid
Module.
in_channels (int): Input channels.
channels (int): Channels after modules, before conv_seg... | 3 | 1 | 11 | 0 | 11 | 0 | 2 | 0.43 | 1 | 7 | 1 | 0 | 2 | 5 | 2 | 12 | 37 | 4 | 23 | 14 | 20 | 10 | 19 | 14 | 16 | 2 | 1 | 1 | 4 |
1,551 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionRelativePositionBias | from torch import nn
import torch
from ...utils import auto_docstring, logging, torch_int
from ...pytorch_utils import compile_compatible_method_lru_cache, find_pruneable_heads_and_indices, prune_linear_layer
from .configuration_data2vec_vision import Data2VecVisionConfig
class Data2VecVisionRelativePositionBias(nn.Mo... |
class Data2VecVisionRelativePositionBias(nn.Module):
def __init__(self, config: Data2VecVisionConfig, window_size: tuple) -> None:
pass
@compile_compatible_method_lru_cache(maxsize=10)
def generate_relative_position_index(self, window_size: tuple[int, int]) -> torch.Tensor:
'''
Thi... | 5 | 2 | 27 | 4 | 19 | 6 | 2 | 0.32 | 1 | 6 | 1 | 0 | 3 | 4 | 3 | 13 | 84 | 13 | 59 | 27 | 55 | 19 | 46 | 27 | 42 | 3 | 1 | 1 | 5 |
1,552 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionSdpaSelfAttention | import torch
from typing import Optional, Union
import math
class Data2VecVisionSdpaSelfAttention(Data2VecVisionSelfAttention):
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, relative_position_bias: Optional[torch.Tensor]=None, interpolate_pos... |
class Data2VecVisionSdpaSelfAttention(Data2VecVisionSelfAttention):
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, relative_position_bias: Optional[torch.Tensor]=None, interpolate_pos_encoding: bool=False, resolution: Optional[tuple[int]]=None... | 2 | 0 | 59 | 4 | 54 | 1 | 6 | 0.02 | 1 | 4 | 0 | 0 | 1 | 0 | 1 | 14 | 60 | 4 | 55 | 20 | 45 | 1 | 24 | 12 | 22 | 6 | 2 | 2 | 6 |
1,553 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionSelfAttention | from .configuration_data2vec_vision import Data2VecVisionConfig
from typing import Optional, Union
import torch
import math
from torch import nn
class Data2VecVisionSelfAttention(nn.Module):
def __init__(self, config: Data2VecVisionConfig, window_size: Optional[tuple]=None) -> None:
super().__init__()
... |
class Data2VecVisionSelfAttention(nn.Module):
def __init__(self, config: Data2VecVisionConfig, window_size: Optional[tuple]=None) -> None:
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, relative_position_bias: Optional[torch.... | 3 | 0 | 26 | 5 | 19 | 2 | 3 | 0.12 | 1 | 8 | 2 | 1 | 3 | 9 | 3 | 13 | 82 | 18 | 57 | 33 | 45 | 7 | 43 | 25 | 39 | 5 | 1 | 1 | 9 |
1,554 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionSelfOutput | from .configuration_data2vec_vision import Data2VecVisionConfig
import torch
from torch import nn
class Data2VecVisionSelfOutput(nn.Module):
"""
The residual connection is defined in Data2VecVisionLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
... |
class Data2VecVisionSelfOutput(nn.Module):
'''
The residual connection is defined in Data2VecVisionLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: Data2VecVisionConfig) -> None:
pass
def forward(s... | 3 | 1 | 5 | 1 | 4 | 0 | 1 | 0.44 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 16 | 3 | 9 | 5 | 6 | 4 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
1,555 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/data2vec/modeling_data2vec_vision.py | transformers.models.data2vec.modeling_data2vec_vision.Data2VecVisionUperHead | import torch
from .configuration_data2vec_vision import Data2VecVisionConfig
from torch import nn
class Data2VecVisionUperHead(nn.Module):
"""
Unified Perceptual Parsing for Scene Understanding. This head is the implementation of
[UPerNet](https://huggingface.co/papers/1807.10221).
Based on OpenMMLab'... |
class Data2VecVisionUperHead(nn.Module):
'''
Unified Perceptual Parsing for Scene Understanding. This head is the implementation of
[UPerNet](https://huggingface.co/papers/1807.10221).
Based on OpenMMLab's implementation, found in https://github.com/open-mmlab/mmsegmentation.
'''
def __init__(... | 4 | 1 | 24 | 3 | 19 | 3 | 2 | 0.24 | 1 | 7 | 3 | 0 | 3 | 10 | 3 | 13 | 83 | 13 | 59 | 25 | 55 | 14 | 40 | 25 | 36 | 3 | 1 | 1 | 6 |
1,556 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/configuration_dbrx.py | transformers.models.dbrx.configuration_dbrx.DbrxAttentionConfig | from typing import Any, Optional
from ...configuration_utils import PretrainedConfig
class DbrxAttentionConfig(PretrainedConfig):
"""Configuration class for Dbrx Attention.
[`DbrxAttention`] class. It is used to instantiate attention layers
according to the specified arguments, defining the layers archite... |
class DbrxAttentionConfig(PretrainedConfig):
'''Configuration class for Dbrx Attention.
[`DbrxAttention`] class. It is used to instantiate attention layers
according to the specified arguments, defining the layers architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to ... | 2 | 1 | 19 | 1 | 18 | 0 | 4 | 0.65 | 1 | 5 | 0 | 0 | 1 | 4 | 1 | 1 | 39 | 6 | 20 | 15 | 11 | 13 | 13 | 8 | 11 | 4 | 1 | 2 | 4 |
1,557 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/configuration_dbrx.py | transformers.models.dbrx.configuration_dbrx.DbrxConfig | from ...configuration_utils import PretrainedConfig
from typing import Any, Optional
class DbrxConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DbrxModel`]. It is used to instantiate a Dbrx model according to the
specified arguments, defining the model archit... |
class DbrxConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DbrxModel`]. It is used to instantiate a Dbrx model according to the
specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a different con... | 2 | 1 | 47 | 4 | 43 | 0 | 6 | 0.85 | 1 | 9 | 2 | 0 | 1 | 13 | 1 | 1 | 111 | 15 | 52 | 34 | 35 | 44 | 28 | 19 | 26 | 6 | 1 | 1 | 6 |
1,558 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/configuration_dbrx.py | transformers.models.dbrx.configuration_dbrx.DbrxFFNConfig | from typing import Any, Optional
from ...configuration_utils import PretrainedConfig
class DbrxFFNConfig(PretrainedConfig):
"""Configuration class for Dbrx FFN.
[`DbrxFFN`] class. It is used to instantiate feedforward layers according to
the specified arguments, defining the layers architecture.
Conf... |
class DbrxFFNConfig(PretrainedConfig):
'''Configuration class for Dbrx FFN.
[`DbrxFFN`] class. It is used to instantiate feedforward layers according to
the specified arguments, defining the layers architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the mode... | 2 | 1 | 27 | 1 | 26 | 0 | 5 | 0.57 | 1 | 6 | 0 | 0 | 1 | 7 | 1 | 1 | 50 | 6 | 28 | 21 | 16 | 16 | 18 | 11 | 16 | 5 | 1 | 2 | 5 |
1,559 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxAttention | from torch import nn
import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
import math
from ...utils.deprecation import deprecate_kwarg
from .configuration_dbrx import DbrxConfig
from typing import Any, Optional, Union
class DbrxAttention(nn.Module):
"""Multi-head self attention."""
def __i... |
class DbrxAttention(nn.Module):
'''Multi-head self attention.'''
def __init__(self, config: DbrxConfig, block_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_ids: torch.LongTen... | 4 | 1 | 50 | 8 | 41 | 2 | 4 | 0.05 | 1 | 9 | 3 | 2 | 2 | 15 | 2 | 12 | 103 | 17 | 83 | 39 | 70 | 4 | 53 | 29 | 50 | 6 | 1 | 1 | 8 |
1,560 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxBlock | from ...cache_utils import Cache, DynamicCache, StaticCache
from ...modeling_layers import GradientCheckpointingLayer
import torch
from typing import Any, Optional, Union
from torch import nn
from .configuration_dbrx import DbrxConfig
from ...utils.deprecation import deprecate_kwarg
class DbrxBlock(GradientCheckpointi... |
class DbrxBlock(GradientCheckpointingLayer):
def __init__(self, config: DbrxConfig, block_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: Optiona... | 4 | 1 | 38 | 4 | 26 | 9 | 3 | 0.33 | 1 | 9 | 4 | 0 | 2 | 5 | 2 | 12 | 78 | 9 | 52 | 30 | 30 | 17 | 21 | 11 | 18 | 4 | 1 | 1 | 5 |
1,561 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxExpertGLU | from ...activations import ACT2FN
import torch
from torch import nn
class DbrxExpertGLU(nn.Module):
def __init__(self, hidden_size: int, ffn_hidden_size: int, moe_num_experts: int, ffn_act_fn: dict):
super().__init__()
self.hidden_size = hidden_size
self.ffn_hidden_size = ffn_hidden_size
... |
class DbrxExpertGLU(nn.Module):
def __init__(self, hidden_size: int, ffn_hidden_size: int, moe_num_experts: int, ffn_act_fn: dict):
pass
def forward(self, x: torch.Tensor, expert_w1: torch.Tensor, expert_v1: torch.Tensor, expert_w2: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 11 | 1 | 10 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 7 | 2 | 12 | 23 | 3 | 20 | 17 | 15 | 0 | 18 | 15 | 15 | 1 | 1 | 0 | 2 |
1,562 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxExperts | import torch
from torch import nn
class DbrxExperts(nn.Module):
def __init__(self, hidden_size: int, ffn_hidden_size: int, moe_num_experts: int, ffn_act_fn: dict):
super().__init__()
self.moe_num_experts = moe_num_experts
self.mlp = DbrxExpertGLU(hidden_size=hidden_size, ffn_hidden_size=ff... |
class DbrxExperts(nn.Module):
def __init__(self, hidden_size: int, ffn_hidden_size: int, moe_num_experts: int, ffn_act_fn: dict):
pass
def forward(self, x: torch.Tensor, weights: torch.Tensor, top_weights: torch.Tensor, top_experts: torch.LongTensor) -> torch.Tensor:
pass | 3 | 0 | 25 | 3 | 21 | 2 | 2 | 0.07 | 1 | 6 | 1 | 0 | 2 | 2 | 2 | 12 | 52 | 6 | 43 | 19 | 38 | 3 | 27 | 17 | 24 | 3 | 1 | 2 | 4 |
1,563 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxFFN | import torch
from .configuration_dbrx import DbrxConfig
from torch import nn
class DbrxFFN(nn.Module):
def __init__(self, config: DbrxConfig):
super().__init__()
ffn_config = config.ffn_config
self.router = DbrxRouter(hidden_size=config.d_model, moe_num_experts=ffn_config.moe_num_experts, ... |
class DbrxFFN(nn.Module):
def __init__(self, config: DbrxConfig):
pass
def forward(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 0 | 11 | 1 | 10 | 0 | 1 | 0 | 1 | 5 | 3 | 0 | 2 | 2 | 2 | 12 | 24 | 3 | 21 | 8 | 18 | 0 | 10 | 8 | 7 | 1 | 1 | 0 | 2 |
1,564 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxFlashAttention2 | from ...utils.deprecation import deprecate_kwarg
from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Any, Optional, Union
import torch
class DbrxFlashAttention2(DbrxAttention):
"""Dbr... |
class DbrxFlashAttention2(DbrxAttention):
'''Dbrx flash attention module.
This module inherits from `DbrxAttention` as the weights of the module stays
untouched. The only required change would be on the forward pass where it
calls the public API of flash attention.
'''
def __init__(self, *args... | 4 | 1 | 55 | 8 | 39 | 8 | 5 | 0.27 | 1 | 7 | 2 | 0 | 2 | 5 | 2 | 14 | 118 | 19 | 78 | 28 | 65 | 21 | 42 | 14 | 39 | 9 | 2 | 2 | 10 |
1,565 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxForCausalLM | from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from torch import nn
from ...cache_utils import Cache, DynamicCache, StaticCache
from .configuration_dbrx import DbrxConfig
import torch
from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
from ...generation import ... | @auto_docstring(custom_intro='\n The DBRX Model transformer for causal language modeling.\n ')
class DbrxForCausalLM(DbrxPreTrainedModel, GenerationMixin):
def __init__(self, config: DbrxConfig):
pass
def get_input_embeddings(self) -> nn.Embedding:
pass
def set_input_embeddings(self... | 11 | 1 | 17 | 2 | 12 | 4 | 3 | 0.31 | 2 | 9 | 4 | 0 | 8 | 6 | 8 | 9 | 149 | 22 | 98 | 39 | 70 | 30 | 45 | 22 | 36 | 13 | 2 | 2 | 20 |
1,566 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxModel | from typing import Any, Optional, Union
from ...modeling_attn_mask_utils import AttentionMaskConverter
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
from torch import nn
from ...cache_utils import... | @auto_docstring
class DbrxModel(DbrxPreTrainedModel):
'''Transformer decoder consisting of *config.num_hidden_layers*. Each layer is a [`DbrxBlock`] layer.
Args:
config ([`DbrxConfig`]): Model configuration class with all parameters of the model.
Initializing with a config file does not load... | 10 | 2 | 45 | 5 | 35 | 6 | 7 | 0.22 | 1 | 14 | 7 | 0 | 5 | 7 | 6 | 7 | 290 | 37 | 210 | 68 | 171 | 46 | 105 | 36 | 98 | 28 | 2 | 2 | 44 |
1,567 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxNormAttentionNorm | from .configuration_dbrx import DbrxConfig
import torch
from typing import Any, Optional, Union
from torch import nn
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, StaticCache
class DbrxNormAttentionNorm(nn.Module):
def __init__(self, config: DbrxConfig, block_idx... |
class DbrxNormAttentionNorm(nn.Module):
def __init__(self, config: DbrxConfig, block_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_ids: torch.LongTensor, attention_mask: Optional... | 4 | 0 | 21 | 2 | 19 | 0 | 1 | 0 | 1 | 7 | 2 | 0 | 2 | 5 | 2 | 12 | 44 | 5 | 39 | 20 | 26 | 0 | 17 | 10 | 14 | 1 | 1 | 0 | 2 |
1,568 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxPreTrainedModel | from .configuration_dbrx import DbrxConfig
from ...modeling_utils import PreTrainedModel
from torch import nn
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
@auto_docstring
class DbrxPreTrainedModel(PreTrainedModel):
config: DbrxConfig
base_model_prefix = 'transformer'
supports_... | @auto_docstring
class DbrxPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
pass | 3 | 0 | 18 | 0 | 18 | 0 | 8 | 0.03 | 1 | 1 | 1 | 2 | 1 | 0 | 1 | 1 | 30 | 1 | 29 | 13 | 27 | 1 | 26 | 13 | 24 | 8 | 1 | 2 | 8 |
1,569 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxRotaryEmbedding | from torch import nn
import torch
class DbrxRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
super().__init__()
self.dim = dim
self.max_position_embeddings = max_position_embeddings
self.base = ba... |
class DbrxRotaryEmbedding(nn.Module):
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
pass
@torch.no_grad()
def forward(self, x, position_ids, seq_len=None):
pass | 4 | 0 | 12 | 1 | 10 | 2 | 2 | 0.14 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 27 | 3 | 21 | 15 | 17 | 3 | 20 | 14 | 17 | 2 | 1 | 1 | 3 |
1,570 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxRouter | import torch
from typing import Any, Optional, Union
from torch import nn
class DbrxRouter(nn.Module):
def __init__(self, hidden_size: int, moe_num_experts: int, moe_top_k: int, moe_jitter_eps: Optional[float], moe_normalize_expert_weights: Optional[float]):
super().__init__()
self.hidden_size = h... |
class DbrxRouter(nn.Module):
def __init__(self, hidden_size: int, moe_num_experts: int, moe_top_k: int, moe_jitter_eps: Optional[float], moe_normalize_expert_weights: Optional[float]):
pass
def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.LongTensor]:
... | 3 | 0 | 18 | 2 | 16 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 6 | 2 | 12 | 37 | 4 | 33 | 19 | 23 | 0 | 20 | 12 | 17 | 3 | 1 | 1 | 4 |
1,571 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dbrx/modeling_dbrx.py | transformers.models.dbrx.modeling_dbrx.DbrxSdpaAttention | import torch
from typing import Any, Optional, Union
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, StaticCache
class DbrxSdpaAttention(DbrxAttention):
"""
Dbrx attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
... |
class DbrxSdpaAttention(DbrxAttention):
'''
Dbrx attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
`DbrxAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
SDPA API.
'''
@deprecate_kwarg('... | 3 | 1 | 86 | 14 | 66 | 6 | 8 | 0.16 | 1 | 4 | 1 | 0 | 1 | 3 | 1 | 13 | 93 | 15 | 67 | 22 | 56 | 11 | 33 | 10 | 31 | 8 | 2 | 1 | 8 |
1,572 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/configuration_deberta.py | transformers.models.deberta.configuration_deberta.DebertaConfig | from ...configuration_utils import PretrainedConfig
class DebertaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DebertaModel`] or a [`TFDebertaModel`]. It is
used to instantiate a DeBERTa model according to the specified arguments, defining the model archite... |
class DebertaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DebertaModel`] or a [`TFDebertaModel`]. It is
used to instantiate a DeBERTa model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the de... | 2 | 1 | 53 | 4 | 48 | 1 | 2 | 1.28 | 1 | 2 | 0 | 0 | 1 | 21 | 1 | 1 | 127 | 13 | 50 | 47 | 25 | 64 | 27 | 24 | 25 | 2 | 1 | 1 | 2 |
1,573 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/configuration_deberta.py | transformers.models.deberta.configuration_deberta.DebertaOnnxConfig | from ...onnx import OnnxConfig
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Union
from collections import OrderedDict
class DebertaOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic... |
class DebertaOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def default_onnx_opset(self) -> int:
pass
def generate_dummy_inputs(self, preprocessor: Union['PreTrainedTokenizerBase', 'FeatureExtractionMixin'], batch_size: int=-1... | 6 | 0 | 10 | 0 | 10 | 0 | 2 | 0 | 1 | 6 | 0 | 0 | 3 | 0 | 3 | 3 | 35 | 2 | 33 | 20 | 15 | 0 | 15 | 6 | 11 | 3 | 1 | 1 | 6 |
1,574 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.ContextPooler | from torch import nn
from ...activations import ACT2FN
class ContextPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.pooler_hidden_size, config.pooler_hidden_size)
self.dropout = nn.Dropout(config.pooler_dropout)
self.config = config
... |
class ContextPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass
@property
def output_dim(self):
pass | 5 | 0 | 5 | 0 | 4 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 3 | 3 | 3 | 13 | 20 | 3 | 15 | 10 | 10 | 2 | 14 | 9 | 10 | 1 | 1 | 0 | 3 |
1,575 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaAttention | from torch import nn
from typing import Optional, Union
import torch
class DebertaAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = DisentangledSelfAttention(config)
self.output = DebertaSelfOutput(config)
self.config = config
def forward(self, h... |
class DebertaAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask, output_attentions: bool=False, query_states=None, relative_pos=None, rel_embeddings=None) -> tuple[torch.Tensor, Optional[torch.Tensor]]:
pass | 3 | 0 | 15 | 1 | 15 | 0 | 2 | 0 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 12 | 32 | 2 | 30 | 16 | 19 | 0 | 14 | 8 | 11 | 3 | 1 | 1 | 4 |
1,576 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaEmbeddings | from torch import nn
import torch
class DebertaEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
pad_token_id = getattr(config, 'pad_token_id', 0)
self.embedding_size = getattr(config, 'em... |
class DebertaEmbeddings(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, mask=None, inputs_embeds=None):
pass | 3 | 1 | 38 | 8 | 29 | 1 | 8 | 0.03 | 1 | 2 | 1 | 0 | 2 | 9 | 2 | 12 | 79 | 18 | 59 | 18 | 56 | 2 | 52 | 18 | 49 | 12 | 1 | 3 | 16 |
1,577 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaEncoder | from torch import nn
from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
class DebertaEncoder(nn.Module):
"""Modified BertEncoder with relative position bias support"""
de... |
class DebertaEncoder(nn.Module):
'''Modified BertEncoder with relative position bias support'''
def __init__(self, config):
pass
def get_rel_embedding(self):
pass
def get_attention_mask(self, attention_mask):
pass
def get_rel_pos(self, hidden_states, query_states=None, r... | 6 | 1 | 17 | 2 | 15 | 0 | 4 | 0.01 | 1 | 8 | 2 | 0 | 5 | 5 | 5 | 5 | 91 | 13 | 77 | 28 | 62 | 1 | 47 | 19 | 41 | 9 | 1 | 2 | 20 |
1,578 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaForMaskedLM | from ...utils import auto_docstring, logging
import torch
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
@auto_docstring
c... | @auto_docstring
class DebertaForMaskedLM(DebertaPreTrainedModel):
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, attentio... | 7 | 1 | 19 | 2 | 16 | 2 | 3 | 0.11 | 1 | 7 | 4 | 0 | 4 | 4 | 4 | 5 | 92 | 11 | 74 | 28 | 49 | 8 | 36 | 16 | 31 | 6 | 2 | 1 | 12 |
1,579 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaForQuestionAnswering | from typing import Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from torch import nn
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from ...utils import auto_docstring, loggi... | @auto_docstring
class DebertaForQuestionAnswering(DebertaPreTrainedModel):
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[torc... | 5 | 0 | 40 | 5 | 29 | 7 | 4 | 0.19 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 92 | 10 | 69 | 29 | 44 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
1,580 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaForSequenceClassification | from typing import Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from torch import nn
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from ...utils import auto_docstring, loggi... | @auto_docstring(custom_intro='\n DeBERTa Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ')
class DebertaForSequenceClassification(DebertaPreTrainedModel):
def __init__(self, config):
pass
def get_in... | 7 | 1 | 25 | 2 | 21 | 2 | 4 | 0.09 | 1 | 6 | 3 | 0 | 4 | 5 | 4 | 5 | 109 | 11 | 90 | 36 | 68 | 8 | 53 | 24 | 48 | 13 | 2 | 4 | 17 |
1,581 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaForTokenClassification | from ...utils import auto_docstring, logging
import torch
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Uni... | @auto_docstring
class DebertaForTokenClassification(DebertaPreTrainedModel):
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[to... | 5 | 1 | 28 | 4 | 22 | 3 | 3 | 0.1 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 64 | 9 | 50 | 25 | 30 | 5 | 22 | 13 | 19 | 5 | 2 | 1 | 6 |
1,582 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaIntermediate | from torch import nn
from ...activations import ACT2FN
import torch
class DebertaIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.intermediate... |
class DebertaIntermediate(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 |
1,583 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaLMPredictionHead | from torch import nn
import torch
from ...activations import ACT2FN
class DebertaLMPredictionHead(nn.Module):
"""https://github.com/microsoft/DeBERTa/blob/master/DeBERTa/deberta/bert.py#L270"""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hid... |
class DebertaLMPredictionHead(nn.Module):
'''https://github.com/microsoft/DeBERTa/blob/master/DeBERTa/deberta/bert.py#L270'''
def __init__(self, config):
pass
def forward(self, hidden_states, word_embeddings):
pass | 3 | 1 | 10 | 2 | 9 | 1 | 2 | 0.17 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 25 | 5 | 18 | 7 | 15 | 3 | 15 | 7 | 12 | 2 | 1 | 1 | 3 |
1,584 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaLayer | from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
import torch
class DebertaLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = DebertaAttention(config)
self.intermediate = DebertaIntermediate(config)... |
class DebertaLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask, query_states=None, relative_pos=None, rel_embeddings=None, output_attentions: bool=False) -> tuple[torch.Tensor, Optional[torch.Tensor]]:
pass | 3 | 0 | 15 | 1 | 14 | 0 | 2 | 0 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 12 | 31 | 2 | 29 | 17 | 18 | 0 | 13 | 9 | 10 | 2 | 1 | 1 | 3 |
1,585 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaLayerNorm | from torch import nn
import torch
class DebertaLayerNorm(nn.Module):
"""LayerNorm module (epsilon inside the square root)."""
def __init__(self, size, eps=1e-12):
super().__init__()
self.weight = nn.Parameter(torch.ones(size))
self.bias = nn.Parameter(torch.zeros(size))
self.va... |
class DebertaLayerNorm(nn.Module):
'''LayerNorm module (epsilon inside the square root).'''
def __init__(self, size, eps=1e-12):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 7 | 0 | 7 | 0 | 1 | 0.07 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 18 | 2 | 15 | 10 | 12 | 1 | 15 | 10 | 12 | 1 | 1 | 0 | 2 |
1,586 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaModel | from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, logging
import torch
from typing import Optional, Union
@auto_docstring
class DebertaModel(DebertaPreTrainedModel):
def __init__(self,... | @auto_docstring
class DebertaModel(DebertaPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_... | 8 | 1 | 20 | 2 | 17 | 1 | 4 | 0.06 | 1 | 9 | 3 | 0 | 5 | 4 | 5 | 6 | 109 | 14 | 90 | 33 | 68 | 5 | 46 | 22 | 40 | 15 | 2 | 2 | 19 |
1,587 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaOnlyMLMHead | from torch import nn
class DebertaOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.lm_head = DebertaLMPredictionHead(config)
def forward(self, sequence_output, word_embeddings):
prediction_scores = self.lm_head(sequence_output, word_embeddings)
retur... |
class DebertaOnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output, word_embeddings):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0.14 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 7 | 5 | 4 | 1 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
1,588 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaOutput | from torch import nn
class DebertaOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = DebertaLayerNorm(config.hidden_size, config.layer_norm_eps)
self.dropout = nn.Dropout(config.hid... |
class DebertaOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
1,589 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaPreTrainedModel | from torch import nn
from ...utils import auto_docstring, logging
from .configuration_deberta import DebertaConfig
from ...modeling_utils import PreTrainedModel
@auto_docstring
class DebertaPreTrainedModel(PreTrainedModel):
config: DebertaConfig
base_model_prefix = 'deberta'
_keys_to_ignore_on_load_unexpec... | @auto_docstring
class DebertaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights.'''
pass | 3 | 1 | 12 | 0 | 9 | 3 | 5 | 0.5 | 1 | 0 | 0 | 5 | 1 | 0 | 1 | 1 | 23 | 2 | 14 | 6 | 12 | 7 | 13 | 6 | 11 | 5 | 1 | 2 | 5 |
1,590 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DebertaSelfOutput | from torch import nn
class DebertaSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = DebertaLayerNorm(config.hidden_size, config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidde... |
class DebertaSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
1,591 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.DisentangledSelfAttention | from torch import nn
from typing import Optional, Union
import torch
class DisentangledSelfAttention(nn.Module):
"""
Disentangled self-attention module
Parameters:
config (`str`):
A model config class instance with the configuration to build a new model. The schema is similar to
... |
class DisentangledSelfAttention(nn.Module):
'''
Disentangled self-attention module
Parameters:
config (`str`):
A model config class instance with the configuration to build a new model. The schema is similar to
*BertConfig*, for more details, please refer [`DebertaConfig`]
... | 5 | 2 | 46 | 7 | 32 | 7 | 6 | 0.27 | 1 | 7 | 0 | 0 | 4 | 16 | 4 | 14 | 196 | 33 | 129 | 59 | 109 | 35 | 99 | 44 | 94 | 8 | 1 | 2 | 23 |
1,592 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.LegacyDebertaLMPredictionHead | from torch import nn
import torch
class LegacyDebertaLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = LegacyDebertaPredictionHeadTransform(config)
self.embedding_size = getattr(config, 'embedding_size', config.hidden_size)
self.decoder = ... |
class LegacyDebertaLMPredictionHead(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.21 | 1 | 2 | 1 | 0 | 3 | 4 | 3 | 13 | 22 | 5 | 14 | 8 | 10 | 3 | 14 | 8 | 10 | 1 | 1 | 0 | 3 |
1,593 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.LegacyDebertaOnlyMLMHead | from torch import nn
import torch
class LegacyDebertaOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = LegacyDebertaLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predictions(s... |
class LegacyDebertaOnlyMLMHead(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 |
1,594 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/modeling_deberta.py | transformers.models.deberta.modeling_deberta.LegacyDebertaPredictionHeadTransform | from torch import nn
from ...activations import ACT2FN
class LegacyDebertaPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.embedding_size = getattr(config, 'embedding_size', config.hidden_size)
self.dense = nn.Linear(config.hidden_size, self.embedding... |
class LegacyDebertaPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 8 | 1 | 7 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 17 | 2 | 15 | 7 | 12 | 0 | 14 | 7 | 11 | 2 | 1 | 1 | 3 |
1,595 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/tokenization_deberta.py | transformers.models.deberta.tokenization_deberta.DebertaTokenizer | import os
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from typing import Optional
import regex as re
import json
class DebertaTokenizer(PreTrainedTokenizer):
"""
Construct a DeBERTa tokenizer. Based on byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces lik... |
class DebertaTokenizer(PreTrainedTokenizer):
'''
Construct a DeBERTa tokenizer. Based on byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be encoded differently whether it is at the beginning of the sentenc... | 14 | 7 | 18 | 2 | 13 | 4 | 3 | 0.67 | 1 | 11 | 0 | 0 | 13 | 10 | 13 | 102 | 322 | 45 | 168 | 72 | 132 | 112 | 121 | 46 | 107 | 9 | 3 | 3 | 39 |
1,596 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta/tokenization_deberta_fast.py | transformers.models.deberta.tokenization_deberta_fast.DebertaTokenizerFast | from typing import Optional
from .tokenization_deberta import DebertaTokenizer
from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
class DebertaTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" DeBERTa tokenizer (backed by... |
class DebertaTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" DeBERTa tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level
Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be... | 10 | 4 | 16 | 2 | 9 | 5 | 2 | 1.2 | 1 | 5 | 1 | 0 | 8 | 2 | 8 | 96 | 207 | 31 | 80 | 42 | 50 | 96 | 39 | 21 | 30 | 3 | 3 | 2 | 13 |
1,597 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/configuration_deberta_v2.py | transformers.models.deberta_v2.configuration_deberta_v2.DebertaV2Config | from ...configuration_utils import PretrainedConfig
class DebertaV2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DebertaV2Model`]. It is used to instantiate a
DeBERTa-v2 model according to the specified arguments, defining the model architecture. Instantiat... |
class DebertaV2Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DebertaV2Model`]. It is used to instantiate a
DeBERTa-v2 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield... | 2 | 1 | 53 | 4 | 48 | 1 | 2 | 1.28 | 1 | 2 | 0 | 0 | 1 | 21 | 1 | 1 | 127 | 13 | 50 | 47 | 25 | 64 | 27 | 24 | 25 | 2 | 1 | 1 | 2 |
1,598 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/configuration_deberta_v2.py | transformers.models.deberta_v2.configuration_deberta_v2.DebertaV2OnnxConfig | from collections.abc import Mapping
from ...onnx import OnnxConfig
from typing import TYPE_CHECKING, Any, Union
from collections import OrderedDict
class DebertaV2OnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynam... |
class DebertaV2OnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def default_onnx_opset(self) -> int:
pass
def generate_dummy_inputs(self, preprocessor: Union['PreTrainedTokenizerBase', 'FeatureExtractionMixin'], batch_size: int=... | 6 | 0 | 10 | 0 | 10 | 0 | 2 | 0 | 1 | 6 | 0 | 0 | 3 | 0 | 3 | 3 | 35 | 2 | 33 | 20 | 15 | 0 | 15 | 6 | 11 | 3 | 1 | 1 | 6 |
1,599 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.ContextPooler | from ...activations import ACT2FN
from torch import nn
class ContextPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.pooler_hidden_size, config.pooler_hidden_size)
self.dropout = nn.Dropout(config.pooler_dropout)
self.config = config
... |
class ContextPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass
@property
def output_dim(self):
pass | 5 | 0 | 5 | 0 | 4 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 3 | 3 | 3 | 13 | 20 | 3 | 15 | 10 | 10 | 2 | 14 | 9 | 10 | 1 | 1 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.