id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,100 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py | transformers.models.detr.modeling_detr.DetrMaskHeadSmallConv | from torch import Tensor, nn
import torch
class DetrMaskHeadSmallConv(nn.Module):
"""
Simple convolutional head, using group norm. Upsampling is done using a FPN approach
"""
def __init__(self, dim, fpn_dims, context_dim):
super().__init__()
if dim % 8 != 0:
raise ValueErro... |
class DetrMaskHeadSmallConv(nn.Module):
'''
Simple convolutional head, using group norm. Upsampling is done using a FPN approach
'''
def __init__(self, dim, fpn_dims, context_dim):
pass
def forward(self, x: Tensor, bbox_mask: Tensor, fpns: list[Tensor]):
pass | 3 | 1 | 36 | 6 | 29 | 2 | 4 | 0.1 | 1 | 3 | 0 | 0 | 2 | 15 | 2 | 12 | 78 | 13 | 59 | 21 | 56 | 6 | 56 | 21 | 53 | 4 | 1 | 2 | 8 |
2,101 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py | transformers.models.detr.modeling_detr.DetrModel | from .configuration_detr import DetrConfig
from torch import Tensor, nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
... | null | 8 | 1 | 25 | 4 | 15 | 6 | 3 | 0.4 | 1 | 10 | 7 | 0 | 6 | 5 | 6 | 7 | 159 | 30 | 92 | 39 | 72 | 37 | 46 | 27 | 39 | 11 | 2 | 1 | 18 |
2,102 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py | transformers.models.detr.modeling_detr.DetrObjectDetectionOutput | from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from dataclasses import dataclass
import torch
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Output type of [`DetrForObjectDetection`].\n ')
class DetrObjectDetectionOutput(ModelOutput... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`DetrForObjectDetection`].\n ')
class DetrObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likehood ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.46 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 60 | 2 | 13 | 13 | 12 | 45 | 13 | 13 | 12 | 0 | 1 | 0 | 0 |
2,103 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py | transformers.models.detr.modeling_detr.DetrPreTrainedModel | from torch import Tensor, nn
from ...modeling_utils import PreTrainedModel
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from .configuration_detr import DetrConfig
@auto_docstring
class DetrPreTrainedModel(PreTrainedModel):
config: DetrConfig
base_model_prefix ... | @auto_docstring
class DetrPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 22 | 1 | 19 | 2 | 7 | 0.08 | 1 | 2 | 2 | 5 | 1 | 0 | 1 | 1 | 28 | 2 | 24 | 8 | 22 | 2 | 22 | 8 | 20 | 7 | 1 | 2 | 7 |
2,104 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py | transformers.models.detr.modeling_detr.DetrSegmentationOutput | import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`DetrForSegmentation`].\n ')
class DetrSegmentationOutput(ModelOutput):
... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`DetrForSegmentation`].\n ')
class DetrSegmentationOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likehood (cross... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.64 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 67 | 2 | 14 | 14 | 13 | 51 | 14 | 14 | 13 | 0 | 1 | 0 | 0 |
2,105 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/detr/modeling_detr.py | transformers.models.detr.modeling_detr.DetrSinePositionEmbedding | import math
import torch
from torch import Tensor, nn
class DetrSinePositionEmbedding(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one used by the Attention is all you
need paper, generalized to work on images.
"""
def __init__(self, embedding_dim=... |
class DetrSinePositionEmbedding(nn.Module):
'''
This is a more standard version of the position embedding, very similar to the one used by the Attention is all you
need paper, generalized to work on images.
'''
def __init__(self, embedding_dim=64, temperature=10000, normalize=False, scale=None):
... | 3 | 1 | 14 | 1 | 13 | 0 | 3 | 0.15 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 35 | 4 | 27 | 13 | 24 | 4 | 27 | 13 | 24 | 3 | 1 | 1 | 6 |
2,106 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/configuration_diffllama.py | transformers.models.diffllama.configuration_diffllama.DiffLlamaConfig | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig
class DiffLlamaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DiffLlamaModel`]. It is used to instantiate an DiffLlama
model according to the specif... |
class DiffLlamaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DiffLlamaModel`]. It is used to instantiate an DiffLlama
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults
will yield... | 2 | 1 | 60 | 3 | 54 | 3 | 4 | 1.82 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 173 | 12 | 57 | 45 | 31 | 104 | 27 | 21 | 25 | 4 | 1 | 1 | 4 |
2,107 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaAttention | import math
from ...cache_utils import Cache, DynamicCache, StaticCache
from ...utils.deprecation import deprecate_kwarg
from .configuration_diffllama import DiffLlamaConfig
from torch import nn
from typing import Optional, Union
import torch
class DiffLlamaAttention(nn.Module):
"""Multi-headed attention from 'Att... |
class DiffLlamaAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: DiffLlamaConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_stat... | 4 | 1 | 50 | 8 | 41 | 2 | 3 | 0.06 | 1 | 6 | 2 | 2 | 2 | 21 | 2 | 12 | 104 | 18 | 82 | 49 | 68 | 5 | 63 | 38 | 60 | 4 | 1 | 1 | 6 |
2,108 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaDecoderLayer | from ...cache_utils import Cache, DynamicCache, StaticCache
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from .configuration_diffllama import DiffLlamaConfig
from ...processing_utils import Unpack
f... |
class DiffLlamaDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: DiffLlamaConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, posi... | 4 | 0 | 25 | 4 | 21 | 2 | 2 | 0.07 | 1 | 9 | 5 | 0 | 2 | 5 | 2 | 12 | 52 | 8 | 42 | 22 | 28 | 3 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
2,109 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaFlashAttention2 | from ...modeling_flash_attention_utils import _flash_attention_forward, flash_attn_supports_top_left_mask
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Optional, Union
from ...utils.deprecation import deprecate_kwarg
import torch
class DiffLlamaFlashAttention2(DiffLlamaAttention):
... |
class DiffLlamaFlashAttention2(DiffLlamaAttention):
'''
DiffLlama flash attention module. This module inherits from `DiffLlamaAttention` 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... | 4 | 1 | 70 | 11 | 52 | 8 | 5 | 0.19 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 14 | 148 | 23 | 105 | 31 | 92 | 20 | 54 | 21 | 51 | 9 | 2 | 2 | 10 |
2,110 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaForCausalLM | from ...processing_utils import Unpack
import torch
from typing import Optional, Union
from ...generation import GenerationMixin
from ...cache_utils import Cache, DynamicCache, StaticCache
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...utils import Transform... | @auto_docstring
class DiffLlamaForCausalLM(DiffLlamaPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongT... | 6 | 1 | 14 | 2 | 9 | 4 | 2 | 0.38 | 2 | 9 | 4 | 0 | 8 | 3 | 8 | 9 | 123 | 21 | 74 | 36 | 47 | 28 | 36 | 20 | 27 | 8 | 2 | 1 | 15 |
2,111 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaForQuestionAnswering | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class DiffLlamaForQuestionAnswering(GenericForQuestionAnswering, DiffLlamaPreTrainedModel):
base_model_prefix = 'transformer' |
class DiffLlamaForQuestionAnswering(GenericForQuestionAnswering, DiffLlamaPreTrainedModel):
pass | 1 | 0 | 18 | 2 | 13 | 3 | 2 | 0.2 | 1 | 5 | 3 | 0 | 4 | 2 | 4 | 5 | 77 | 11 | 55 | 28 | 36 | 11 | 26 | 14 | 21 | 5 | 2 | 1 | 8 |
2,112 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaForSequenceClassification | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class DiffLlamaForSequenceClassification(GenericForSequenceClassification, DiffLlamaPreTrainedModel):
pass |
class DiffLlamaForSequenceClassification(GenericForSequenceClassification, DiffLlamaPreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
2,113 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaForTokenClassification | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class DiffLlamaForTokenClassification(GenericForTokenClassification, DiffLlamaPreTrainedModel):
pass |
class DiffLlamaForTokenClassification(GenericForTokenClassification, DiffLlamaPreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
2,114 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaMLP | from torch import nn
from ...activations import ACT2FN
class DiffLlamaMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.... |
class DiffLlamaMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
2,115 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaModel | import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
from ...masking_utils import create_causal_mask
from .configuration_diffllama import DiffLlamaConfig
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...utils.generic import check_model_inputs
from ...utils impo... | @auto_docstring
class DiffLlamaModel(DiffLlamaPreTrainedModel):
def __init__(self, config: DiffLlamaConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTenso... | 6 | 0 | 40 | 5 | 30 | 6 | 6 | 0.22 | 1 | 16 | 10 | 0 | 5 | 7 | 6 | 7 | 257 | 34 | 184 | 65 | 146 | 40 | 89 | 34 | 82 | 21 | 2 | 2 | 37 |
2,116 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaPreTrainedModel | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from ...modeling_utils import PreTrainedModel
from .configuration_diffllama import DiffLlamaConfig
@auto_docstring
class DiffLlamaPreTrainedModel(PreTrainedModel):
config: DiffLlamaConfig
base_model_prefix = 'model'
supports... | @auto_docstring
class DiffLlamaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 5 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
2,117 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaRMSNorm | import torch
from ...integrations import use_kernel_forward_from_hub
from torch import nn
@use_kernel_forward_from_hub('RMSNorm')
class DiffLlamaRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
DiffLlamaRMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
... | @use_kernel_forward_from_hub('RMSNorm')
class DiffLlamaRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
DiffLlamaRMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 5 | 1 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 18 | 2 | 13 | 8 | 9 | 3 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
2,118 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaRotaryEmbedding | from torch import nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from .configuration_diffllama import DiffLlamaConfig
class DiffLlamaRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: DiffLlamaConfig, device=None):
super().__init_... |
class DiffLlamaRotaryEmbedding(nn.Module):
def __init__(self, config: DiffLlamaConfig, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.35 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 14 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
2,119 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modeling_diffllama.py | transformers.models.diffllama.modeling_diffllama.DiffLlamaSdpaAttention | from typing import Optional, Union
import torch
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, StaticCache
class DiffLlamaSdpaAttention(DiffLlamaAttention):
"""
DiffLlama attention module using torch.nn.functional.scaled_dot_product_attention. This module inher... |
class DiffLlamaSdpaAttention(DiffLlamaAttention):
'''
DiffLlama attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
`DiffLlamaAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
SDPA API.
'''
... | 3 | 1 | 93 | 14 | 73 | 6 | 7 | 0.16 | 1 | 4 | 1 | 0 | 1 | 2 | 1 | 13 | 101 | 15 | 74 | 26 | 61 | 12 | 40 | 15 | 38 | 7 | 2 | 1 | 7 |
2,120 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaAttention | import torch
from ...utils.deprecation import deprecate_kwarg
from torch import nn
from ...cache_utils import Cache, StaticCache
from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_po... |
class DiffLlamaAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: DiffLlamaConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_stat... | 4 | 1 | 50 | 8 | 41 | 2 | 3 | 0.06 | 1 | 6 | 2 | 2 | 2 | 21 | 2 | 12 | 104 | 18 | 82 | 49 | 68 | 5 | 63 | 38 | 60 | 4 | 1 | 1 | 6 |
2,121 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaDecoderLayer | from .configuration_diffllama import DiffLlamaConfig
from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, repeat_kv
class DiffLlamaDecoderLayer(LlamaDecoderLayer):
def _... |
class DiffLlamaDecoderLayer(LlamaDecoderLayer):
def __init__(self, config: DiffLlamaConfig, layer_idx: int):
pass | 2 | 0 | 4 | 1 | 3 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 1 | 1 | 1 | 13 | 5 | 1 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
2,122 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaFlashAttention2 | from ...modeling_flash_attention_utils import _flash_attention_forward, flash_attn_supports_top_left_mask
from typing import Optional
from ...cache_utils import Cache, StaticCache
from ...utils.deprecation import deprecate_kwarg
from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSe... |
class DiffLlamaFlashAttention2(DiffLlamaAttention):
'''
DiffLlama flash attention module. This module inherits from `DiffLlamaAttention` 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... | 4 | 1 | 70 | 11 | 52 | 8 | 5 | 0.19 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 14 | 148 | 23 | 105 | 31 | 92 | 20 | 54 | 21 | 51 | 9 | 2 | 2 | 10 |
2,123 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaForCausalLM | from ..gemma.modeling_gemma import GemmaForCausalLM
class DiffLlamaForCausalLM(GemmaForCausalLM):
pass |
class DiffLlamaForCausalLM(GemmaForCausalLM):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,124 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaForQuestionAnswering | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, repeat_kv
class DiffLlamaForQuestionAnswering(LlamaForQuestionAnswering):
pass |
class DiffLlamaForQuestionAnswering(LlamaForQuestionAnswering):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,125 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaForSequenceClassification | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, repeat_kv
class DiffLlamaForSequenceClassification(LlamaForSequenceClassification):
pass |
class DiffLlamaForSequenceClassification(LlamaForSequenceClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,126 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaForTokenClassification | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, repeat_kv
class DiffLlamaForTokenClassification(LlamaForTokenClassification):
pass |
class DiffLlamaForTokenClassification(LlamaForTokenClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,127 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaMLP | from ..mistral.modeling_mistral import MistralMLP
class DiffLlamaMLP(MistralMLP):
pass |
class DiffLlamaMLP(MistralMLP):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,128 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaModel | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, repeat_kv
class DiffLlamaModel(LlamaModel):
pass |
class DiffLlamaModel(LlamaModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,129 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaPreTrainedModel | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, repeat_kv
from ...modeling_utils import PreTrainedModel
class DiffLlamaPreTrainedModel(LlamaPreTrainedModel):
_suppor... |
class DiffLlamaPreTrainedModel(LlamaPreTrainedModel):
def _init_weights(self, module):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 2 | 0 | 0 |
2,130 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/diffllama/modular_diffllama.py | transformers.models.diffllama.modular_diffllama.DiffLlamaSdpaAttention | from ...utils.deprecation import deprecate_kwarg
from typing import Optional
from ..llama.modeling_llama import LlamaDecoderLayer, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaPreTrainedModel, apply_rotary_pos_emb, repeat_kv
from ...cache_utils import Cache, S... |
class DiffLlamaSdpaAttention(DiffLlamaAttention):
'''
DiffLlama attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
`DiffLlamaAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
SDPA API.
'''
... | 3 | 1 | 93 | 14 | 73 | 6 | 7 | 0.16 | 1 | 4 | 1 | 0 | 1 | 2 | 1 | 13 | 101 | 15 | 74 | 26 | 61 | 12 | 40 | 15 | 38 | 7 | 2 | 1 | 7 |
2,131 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/configuration_dinat.py | transformers.models.dinat.configuration_dinat.DinatConfig | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from ...configuration_utils import PretrainedConfig
class DinatConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DinatModel`]. It is used to ins... |
class DinatConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DinatModel`]. It is used to instantiate a Dinat
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults wi... | 2 | 1 | 48 | 1 | 45 | 2 | 1 | 1.24 | 2 | 3 | 0 | 0 | 1 | 21 | 1 | 6 | 125 | 11 | 51 | 45 | 28 | 63 | 25 | 24 | 23 | 1 | 1 | 0 | 1 |
2,132 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatBackbone | import torch
from ...utils import ModelOutput, OptionalDependencyNotAvailable, auto_docstring, is_natten_available, logging, requires_backends
from ...utils.backbone_utils import BackboneMixin
from ...modeling_outputs import BackboneOutput
from torch import nn
from typing import Optional, Union
@auto_docstring(custom_... | @auto_docstring(custom_intro='\n NAT backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class DinatBackbone(DinatPreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
@auto_docstring
def forward(self, pixel_values:... | 6 | 1 | 31 | 6 | 18 | 7 | 4 | 0.38 | 2 | 9 | 3 | 0 | 3 | 4 | 3 | 16 | 99 | 19 | 58 | 24 | 46 | 22 | 38 | 17 | 34 | 9 | 2 | 2 | 12 |
2,133 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatDownsampler | from torch import nn
import torch
class DinatDownsampler(nn.Module):
"""
Convolutional Downsampling Layer.
Args:
dim (`int`):
Number of input channels.
norm_layer (`nn.Module`, *optional*, defaults to `nn.LayerNorm`):
Normalization layer class.
"""
def __in... |
class DinatDownsampler(nn.Module):
'''
Convolutional Downsampling Layer.
Args:
dim (`int`):
Number of input channels.
norm_layer (`nn.Module`, *optional*, defaults to `nn.LayerNorm`):
Normalization layer class.
'''
def __init__(self, dim: int, no... | 3 | 1 | 5 | 0 | 5 | 0 | 1 | 0.8 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 21 | 3 | 10 | 6 | 7 | 8 | 10 | 6 | 7 | 1 | 1 | 0 | 2 |
2,134 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatDropPath | import torch
from typing import Optional, Union
from torch import nn
class DinatDropPath(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_prob = d... |
class DinatDropPath(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_repr(self) -... | 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 |
2,135 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatEmbeddings | from torch import nn
from typing import Optional, Union
import torch
class DinatEmbeddings(nn.Module):
"""
Construct the patch and position embeddings.
"""
def __init__(self, config):
super().__init__()
self.patch_embeddings = DinatPatchEmbeddings(config)
self.norm = nn.LayerNo... |
class DinatEmbeddings(nn.Module):
'''
Construct the patch and position embeddings.
'''
def __init__(self, config):
pass
def forward(self, pixel_values: Optional[torch.FloatTensor]) -> tuple[torch.Tensor]:
pass | 3 | 1 | 7 | 2 | 5 | 0 | 1 | 0.27 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 20 | 6 | 11 | 7 | 8 | 3 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
2,136 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatEncoder | from torch import nn
from typing import Optional, Union
import torch
class DinatEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.num_levels = len(config.depths)
self.config = config
dpr = [x.item() for x in torch.linspace(0, config.drop_path_rate, sum(config.... |
class DinatEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: Optional[bool]=False, output_hidden_states: Optional[bool]=False, output_hidden_states_before_downsampling: Optional[bool]=False, return_dict: Optional[bool]=True) -> Unio... | 3 | 0 | 33 | 4 | 28 | 2 | 6 | 0.05 | 1 | 10 | 3 | 0 | 2 | 3 | 2 | 12 | 68 | 8 | 57 | 21 | 47 | 3 | 31 | 14 | 28 | 10 | 1 | 2 | 12 |
2,137 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatEncoderOutput | from dataclasses import dataclass
from typing import Optional, Union
import torch
from ...utils import ModelOutput, OptionalDependencyNotAvailable, auto_docstring, is_natten_available, logging, requires_backends
@dataclass
@auto_docstring(custom_intro="\n Dinat encoder's outputs, with potential hidden states and at... | @dataclass
@auto_docstring(custom_intro="\n Dinat encoder's outputs, with potential hidden states and attentions.\n ")
class DinatEncoderOutput(ModelOutput):
'''
reshaped_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidde... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 30 | 5 | 5 | 5 | 4 | 20 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
2,138 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatForImageClassification | from torch import nn
from ...utils import ModelOutput, OptionalDependencyNotAvailable, auto_docstring, is_natten_available, logging, requires_backends
import torch
from typing import Optional, Union
@auto_docstring(custom_intro='\n Dinat Model transformer with an image classification head on top (a linear layer on ... | @auto_docstring(custom_intro='\n Dinat Model transformer with an image classification head on top (a linear layer on top of the final hidden state\n of the [CLS] token) e.g. for ImageNet.\n ')
class DinatForImageClassification(DinatPreTrainedModel):
def __init__(self, config):
pass
@auto_docst... | 5 | 1 | 38 | 6 | 29 | 4 | 7 | 0.12 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 85 | 12 | 65 | 20 | 48 | 8 | 33 | 12 | 30 | 12 | 2 | 3 | 14 |
2,139 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatImageClassifierOutput | from ...utils import ModelOutput, OptionalDependencyNotAvailable, auto_docstring, is_natten_available, logging, requires_backends
from typing import Optional, Union
import torch
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Dinat outputs for image classification.\n ')
class DinatI... | @dataclass
@auto_docstring(custom_intro='\n Dinat outputs for image classification.\n ')
class DinatImageClassifierOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.
l... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.67 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 5 | 6 | 6 | 5 | 22 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
2,140 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatIntermediate | from torch import nn
import torch
from ...activations import ACT2FN
class DinatIntermediate(nn.Module):
def __init__(self, config, dim):
super().__init__()
self.dense = nn.Linear(dim, int(config.mlp_ratio * dim))
if isinstance(config.hidden_act, str):
self.intermediate_act_fn =... |
class DinatIntermediate(nn.Module):
def __init__(self, config, dim):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
2,141 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatLayer | import torch
from torch import nn
from typing import Optional, Union
class DinatLayer(nn.Module):
def __init__(self, config, dim, num_heads, dilation, drop_path_rate=0.0):
super().__init__()
self.chunk_size_feed_forward = config.chunk_size_feed_forward
self.kernel_size = config.kernel_size... |
class DinatLayer(nn.Module):
def __init__(self, config, dim, num_heads, dilation, drop_path_rate=0.0):
pass
def maybe_pad(self, hidden_states, height, width):
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.Tensor, torch.Tensor]... | 4 | 0 | 22 | 4 | 18 | 0 | 3 | 0.02 | 1 | 7 | 4 | 0 | 3 | 11 | 3 | 13 | 69 | 13 | 55 | 33 | 47 | 1 | 45 | 29 | 41 | 5 | 1 | 1 | 10 |
2,142 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatModel | from typing import Optional, Union
from ...utils import ModelOutput, OptionalDependencyNotAvailable, auto_docstring, is_natten_available, logging, requires_backends
from torch import nn
import torch
@auto_docstring
class DinatModel(DinatPreTrainedModel):
def __init__(self, config, add_pooling_layer=True):
... | @auto_docstring
class DinatModel(DinatPreTrainedModel):
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 _p... | 7 | 2 | 18 | 3 | 13 | 1 | 3 | 0.08 | 1 | 7 | 3 | 0 | 4 | 7 | 4 | 5 | 83 | 16 | 62 | 25 | 43 | 5 | 35 | 18 | 30 | 7 | 2 | 1 | 12 |
2,143 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatModelOutput | from ...utils import ModelOutput, OptionalDependencyNotAvailable, auto_docstring, is_natten_available, logging, requires_backends
import torch
from dataclasses import dataclass
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro="\n Dinat model's outputs that also contains a pooling of the la... | @dataclass
@auto_docstring(custom_intro="\n Dinat model's outputs that also contains a pooling of the last hidden states.\n ")
class DinatModelOutput(ModelOutput):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*, returned when `add_pooling_layer=True` is passed):
... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.67 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 5 | 6 | 6 | 5 | 22 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
2,144 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatOutput | from torch import nn
import torch
class DinatOutput(nn.Module):
def __init__(self, config, dim):
super().__init__()
self.dense = nn.Linear(int(config.mlp_ratio * dim), dim)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, hidden_states: torch.Tensor) -> torch.Te... |
class DinatOutput(nn.Module):
def __init__(self, config, dim):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 10 | 1 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
2,145 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatPatchEmbeddings | from typing import Optional, Union
from torch import nn
import torch
class DinatPatchEmbeddings(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, height, width, hidden_size)` to be ... |
class DinatPatchEmbeddings(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, height, width, hidden_size)` to be consumed by a
Transformer.
'''
def __init__(self, config... | 3 | 1 | 13 | 2 | 11 | 1 | 2 | 0.26 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 34 | 5 | 23 | 9 | 20 | 6 | 17 | 9 | 14 | 2 | 1 | 1 | 4 |
2,146 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatPreTrainedModel | from torch import nn
from ...utils import ModelOutput, OptionalDependencyNotAvailable, auto_docstring, is_natten_available, logging, requires_backends
from ...modeling_utils import PreTrainedModel
from .configuration_dinat import DinatConfig
@auto_docstring
class DinatPreTrainedModel(PreTrainedModel):
config: Dina... | @auto_docstring
class DinatPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.58 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 21 | 2 | 12 | 5 | 10 | 7 | 11 | 5 | 9 | 4 | 1 | 2 | 4 |
2,147 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.DinatStage | from typing import Optional, Union
from torch import nn
import torch
class DinatStage(nn.Module):
def __init__(self, config, dim, depth, num_heads, dilations, drop_path_rate, downsample):
super().__init__()
self.config = config
self.dim = dim
self.layers = nn.ModuleList([DinatLayer... |
class DinatStage(nn.Module):
def __init__(self, config, dim, depth, num_heads, dilations, drop_path_rate, downsample):
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.Tensor]:
pass | 3 | 0 | 22 | 3 | 19 | 1 | 3 | 0.03 | 1 | 6 | 1 | 0 | 2 | 5 | 2 | 12 | 45 | 6 | 38 | 17 | 31 | 1 | 22 | 13 | 19 | 4 | 1 | 1 | 6 |
2,148 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.NeighborhoodAttention | from torch import nn
from typing import Optional, Union
import torch
import math
class NeighborhoodAttention(nn.Module):
def __init__(self, config, dim, num_heads, kernel_size, dilation):
super().__init__()
if dim % num_heads != 0:
raise ValueError(f'The hidden size ({dim}) is not a mu... |
class NeighborhoodAttention(nn.Module):
def __init__(self, config, dim, num_heads, kernel_size, dilation):
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.Tensor]:
pass | 3 | 0 | 19 | 4 | 13 | 3 | 2 | 0.21 | 1 | 5 | 0 | 0 | 3 | 10 | 3 | 13 | 60 | 13 | 39 | 27 | 31 | 8 | 33 | 23 | 29 | 2 | 1 | 1 | 5 |
2,149 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.NeighborhoodAttentionModule | from typing import Optional, Union
from torch import nn
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
import torch
class NeighborhoodAttentionModule(nn.Module):
def __init__(self, config, dim, num_heads, kernel_size, dilation):
super().__init__()
self.self = Nei... |
class NeighborhoodAttentionModule(nn.Module):
def __init__(self, config, dim, num_heads, kernel_size, dilation):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.Tensor]:
pass | 4 | 0 | 10 | 1 | 9 | 1 | 1 | 0.11 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 34 | 4 | 28 | 15 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,150 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinat/modeling_dinat.py | transformers.models.dinat.modeling_dinat.NeighborhoodAttentionOutput | from torch import nn
import torch
class NeighborhoodAttentionOutput(nn.Module):
def __init__(self, config, dim):
super().__init__()
self.dense = nn.Linear(dim, dim)
self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
def forward(self, hidden_states: torch.Tensor, input_tens... |
class NeighborhoodAttentionOutput(nn.Module):
def __init__(self, config, dim):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 2 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
2,151 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/configuration_dinov2.py | transformers.models.dinov2.configuration_dinov2.Dinov2Config | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from ...configuration_utils import PretrainedConfig
class Dinov2Config(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Dinov2Model`]. It is used to i... |
class Dinov2Config(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Dinov2Model`]. It is used to instantiate an
Dinov2 model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the default... | 2 | 1 | 48 | 1 | 47 | 0 | 1 | 1.37 | 2 | 2 | 0 | 0 | 1 | 21 | 1 | 6 | 126 | 10 | 49 | 46 | 24 | 67 | 24 | 23 | 22 | 1 | 1 | 0 | 1 |
2,152 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/configuration_dinov2.py | transformers.models.dinov2.configuration_dinov2.Dinov2OnnxConfig | from ...onnx import OnnxConfig
from packaging import version
from collections import OrderedDict
from collections.abc import Mapping
class Dinov2OnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedD... |
class Dinov2OnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass | 5 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 0 | 2 | 2 | 14 | 2 | 12 | 6 | 7 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
2,153 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2Attention | from .configuration_dinov2 import Dinov2Config
import torch
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from typing import Callable, Optional, Union
from torch import nn
class Dinov2Attention(nn.Module):
def __init__(self, config: Dinov2Config):
super().__init__()
... |
class Dinov2Attention(nn.Module):
def __init__(self, config: Dinov2Config):
pass
def prune_heads(self, heads: set[int]):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 4 | 0 | 11 | 1 | 9 | 1 | 1 | 0.1 | 1 | 8 | 3 | 1 | 3 | 3 | 3 | 13 | 37 | 6 | 29 | 16 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,154 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2Backbone | import torch
from ...utils.backbone_utils import BackboneMixin
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from typing import Callable, Optional, Union
from torch import nn
from ...ut... | @auto_docstring(custom_intro='\n Dinov2 backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class Dinov2Backbone(Dinov2PreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
def get_input_embeddings(self) -> Dinov2PatchEmbeddings:
pass
@check_model_inputs
... | 7 | 1 | 29 | 5 | 17 | 8 | 5 | 0.43 | 2 | 9 | 4 | 1 | 3 | 4 | 3 | 16 | 93 | 17 | 53 | 23 | 41 | 23 | 36 | 16 | 32 | 13 | 2 | 3 | 15 |
2,155 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2DropPath | from torch import nn
from typing import Callable, Optional, Union
import torch
class Dinov2DropPath(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.dr... |
class Dinov2DropPath(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_repr(self) ... | 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 |
2,156 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2Embeddings | from .configuration_dinov2 import Dinov2Config
from torch import nn
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
import torch
from typing import Callable, Optional, Union
class Dinov2Embeddings(nn.Module):
"""
Construct the CLS token, mask token, position and patch embeddings.
... |
class Dinov2Embeddings(nn.Module):
'''
Construct the CLS token, mask token, position and patch embeddings.
'''
def __init__(self, config: Dinov2Config) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
... | 4 | 2 | 23 | 5 | 15 | 3 | 2 | 0.28 | 1 | 5 | 2 | 0 | 3 | 7 | 3 | 13 | 77 | 18 | 46 | 25 | 42 | 13 | 39 | 25 | 35 | 2 | 1 | 1 | 5 |
2,157 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2Encoder | from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from .configuration_dinov2 import Dinov2Config
from torch import nn
import torch
from typing import Callable, Optional, Union
class Dinov2Encoder(nn.Module):
def __init__(self, config: Dinov2Config):... |
class Dinov2Encoder(nn.Module):
def __init__(self, config: Dinov2Config):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_hidden_states: bool=False) -> BaseModelOutput:
pass | 3 | 0 | 24 | 4 | 20 | 0 | 6 | 0 | 1 | 9 | 3 | 1 | 2 | 3 | 2 | 12 | 49 | 8 | 41 | 18 | 31 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
2,158 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2ForImageClassification | from ...processing_utils import Unpack
from torch import nn
from ...utils.generic import can_return_tuple, check_model_inputs
from .configuration_dinov2 import Dinov2Config
from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseMo... | @auto_docstring(custom_intro='\n Dinov2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state\n of the [CLS] token) e.g. for ImageNet.\n ')
class Dinov2ForImageClassification(Dinov2PreTrainedModel):
def __init__(self, config: Dinov2Config) -> None:
... | 6 | 1 | 41 | 6 | 31 | 5 | 7 | 0.14 | 1 | 8 | 3 | 1 | 2 | 3 | 2 | 3 | 91 | 13 | 69 | 24 | 51 | 10 | 36 | 15 | 33 | 12 | 2 | 3 | 14 |
2,159 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2Layer | from ...modeling_layers import GradientCheckpointingLayer
import torch
from .configuration_dinov2 import Dinov2Config
from typing import Callable, Optional, Union
from torch import nn
class Dinov2Layer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the original implementation."""
def _... |
class Dinov2Layer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the original implementation.'''
def __init__(self, config: Dinov2Config) -> None:
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 1 | 23 | 5 | 17 | 3 | 2 | 0.18 | 1 | 8 | 5 | 0 | 2 | 7 | 2 | 12 | 49 | 11 | 34 | 19 | 26 | 6 | 24 | 14 | 21 | 3 | 1 | 1 | 4 |
2,160 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2LayerScale | import torch
from torch import nn
class Dinov2LayerScale(nn.Module):
def __init__(self, config) -> None:
super().__init__()
self.lambda1 = nn.Parameter(config.layerscale_value * torch.ones(config.hidden_size))
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
return hidde... |
class Dinov2LayerScale(nn.Module):
def __init__(self, config) -> None:
pass
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 12 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
2,161 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2MLP | from torch import nn
from ...activations import ACT2FN
import torch
class Dinov2MLP(nn.Module):
def __init__(self, config) -> None:
super().__init__()
in_features = out_features = config.hidden_size
hidden_features = int(config.hidden_size * config.mlp_ratio)
self.fc1 = nn.Linear(i... |
class Dinov2MLP(nn.Module):
def __init__(self, config) -> None:
pass
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 17 | 1 | 16 | 8 | 13 | 0 | 15 | 8 | 12 | 2 | 1 | 1 | 3 |
2,162 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2Model | from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
import torch
from typing import Callable, Optional, Union
from ...utils.generic import can_return_tuple, check_model_inputs
from torch import nn
from .configuration_dinov2 import Dinov2Config
from ...utils... | @auto_docstring
class Dinov2Model(Dinov2PreTrainedModel):
def __init__(self, config: Dinov2Config):
pass
def get_input_embeddings(self) -> Dinov2PatchEmbeddings:
pass
def _prune_heads(self, heads_to_prune: dict[int, list[int]]) -> None:
'''
Prunes heads of the model. heads... | 8 | 2 | 17 | 2 | 12 | 3 | 3 | 0.17 | 1 | 10 | 5 | 1 | 4 | 4 | 4 | 5 | 80 | 12 | 58 | 24 | 37 | 10 | 29 | 15 | 24 | 6 | 2 | 1 | 10 |
2,163 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2PatchEmbeddings | from torch import nn
import collections.abc
import torch
class Dinov2PatchEmbeddings(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
... |
class Dinov2PatchEmbeddings(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, config):... | 3 | 1 | 12 | 1 | 11 | 0 | 3 | 0.23 | 1 | 4 | 0 | 1 | 2 | 5 | 2 | 12 | 31 | 4 | 22 | 13 | 19 | 5 | 19 | 13 | 16 | 3 | 1 | 1 | 5 |
2,164 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2PreTrainedModel | from ...utils import TransformersKwargs, auto_docstring, logging, torch_int
from .configuration_dinov2 import Dinov2Config
from torch import nn
import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
@auto_docstring
class Dinov2PreTrainedModel(Pr... | @auto_docstring
class Dinov2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 25 | 1 | 21 | 3 | 5 | 0.25 | 1 | 1 | 1 | 4 | 1 | 0 | 1 | 1 | 38 | 3 | 28 | 8 | 26 | 7 | 16 | 8 | 14 | 5 | 1 | 2 | 5 |
2,165 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2SelfAttention | import torch
from typing import Callable, Optional, Union
from torch import nn
from .configuration_dinov2 import Dinov2Config
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
class Dinov2SelfAttention(nn.Module):
def __init__(self, config: Dinov2Config):
super().__init__()
if... |
class Dinov2SelfAttention(nn.Module):
def __init__(self, config: Dinov2Config):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 0 | 18 | 4 | 12 | 2 | 2 | 0.13 | 1 | 6 | 1 | 1 | 3 | 7 | 3 | 13 | 58 | 15 | 38 | 23 | 32 | 5 | 33 | 21 | 29 | 3 | 1 | 1 | 6 |
2,166 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2SelfOutput | from .configuration_dinov2 import Dinov2Config
from torch import nn
import torch
class Dinov2SelfOutput(nn.Module):
"""
The residual connection is defined in Dinov2Layer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, confi... |
class Dinov2SelfOutput(nn.Module):
'''
The residual connection is defined in Dinov2Layer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: Dinov2Config):
pass
def forward(self, hidden_states: torch.Tensor... | 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 |
2,167 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2/modeling_dinov2.py | transformers.models.dinov2.modeling_dinov2.Dinov2SwiGLUFFN | from torch import nn
import torch
class Dinov2SwiGLUFFN(nn.Module):
def __init__(self, config) -> None:
super().__init__()
in_features = out_features = config.hidden_size
hidden_features = int(config.hidden_size * config.mlp_ratio)
hidden_features = (int(hidden_features * 2 / 3) + ... |
class Dinov2SwiGLUFFN(nn.Module):
def __init__(self, config) -> None:
pass
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 1 | 6 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 15 | 2 | 13 | 9 | 10 | 0 | 13 | 9 | 10 | 1 | 1 | 0 | 2 |
2,168 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersAttention | from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
import torch
from typing import Callable, Optional, Union
from torch import nn
from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
class Dinov2WithRegistersAttention(nn.Module):
def __init__(self, config: Dino... |
class Dinov2WithRegistersAttention(nn.Module):
def __init__(self, config: Dinov2WithRegistersConfig):
pass
def prune_heads(self, heads: set[int]):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 4 | 0 | 11 | 1 | 9 | 1 | 1 | 0.1 | 1 | 8 | 3 | 1 | 3 | 3 | 3 | 13 | 37 | 6 | 29 | 16 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,169 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersBackbone | import torch
from ...utils import TransformersKwargs, auto_docstring, torch_int
from ...utils.generic import can_return_tuple, check_model_inputs
from ...utils.backbone_utils import BackboneMixin
from typing import Callable, Optional, Union
from torch import nn
from ...modeling_outputs import BackboneOutput, BaseModelO... | @auto_docstring(custom_intro='\n Dinov2WithRegisters backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class Dinov2WithRegistersBackbone(Dinov2WithRegistersPreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
def get_input_embeddings(self) -> Dinov2WithRegistersPat... | 7 | 1 | 31 | 6 | 17 | 8 | 5 | 0.46 | 2 | 9 | 4 | 0 | 3 | 5 | 3 | 16 | 98 | 19 | 54 | 24 | 42 | 25 | 37 | 17 | 33 | 13 | 2 | 3 | 15 |
2,170 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersDropPath | from typing import Callable, Optional, Union
import torch
from torch import nn
class Dinov2WithRegistersDropPath(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__()
... |
class Dinov2WithRegistersDropPath(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 extr... | 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 |
2,171 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersEmbeddings | import torch
from torch import nn
from ...utils import TransformersKwargs, auto_docstring, torch_int
from typing import Callable, Optional, Union
from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
class Dinov2WithRegistersEmbeddings(nn.Module):
"""
Construct the CLS token, mask token, r... |
class Dinov2WithRegistersEmbeddings(nn.Module):
'''
Construct the CLS token, mask token, register tokens, position and patch embeddings.
'''
def __init__(self, config: Dinov2WithRegistersConfig) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width:... | 4 | 2 | 30 | 6 | 18 | 7 | 2 | 0.44 | 1 | 6 | 2 | 0 | 3 | 8 | 3 | 13 | 97 | 20 | 54 | 24 | 50 | 24 | 44 | 24 | 40 | 4 | 1 | 2 | 7 |
2,172 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersEncoder | from typing import Callable, Optional, Union
import torch
from torch import nn
from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
class Dinov2WithRegistersEncoder(nn.Module):
... |
class Dinov2WithRegistersEncoder(nn.Module):
def __init__(self, config: Dinov2WithRegistersConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None, output_hidden_states: bool=False) -> BaseModelOutput:
pass | 3 | 0 | 24 | 4 | 20 | 0 | 6 | 0 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 49 | 8 | 41 | 18 | 31 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
2,173 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersForImageClassification | import torch
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, torch_int
from torch import nn
from typing import Callable, Optional, Union
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BackboneOutput, BaseModelOutput, Base... | @auto_docstring(custom_intro='\n Dinov2WithRegisters Model transformer with an image classification head on top (a linear layer on top of the final hidden state\n of the [CLS] token) e.g. for ImageNet.\n ')
class Dinov2WithRegistersForImageClassification(Dinov2WithRegistersPreTrainedModel):
def __init__(s... | 6 | 1 | 41 | 6 | 31 | 5 | 7 | 0.14 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 91 | 13 | 69 | 24 | 51 | 10 | 36 | 15 | 33 | 12 | 2 | 3 | 14 |
2,174 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optional, Union
from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
import torch
class Dinov2WithRegistersLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in t... |
class Dinov2WithRegistersLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the original implementation.'''
def __init__(self, config: Dinov2WithRegistersConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch... | 3 | 1 | 24 | 5 | 18 | 3 | 2 | 0.17 | 1 | 8 | 5 | 0 | 2 | 7 | 2 | 12 | 51 | 11 | 36 | 19 | 28 | 6 | 24 | 14 | 21 | 3 | 1 | 1 | 4 |
2,175 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersLayerScale | import torch
from torch import nn
class Dinov2WithRegistersLayerScale(nn.Module):
def __init__(self, config) -> None:
super().__init__()
self.lambda1 = nn.Parameter(config.layerscale_value * torch.ones(config.hidden_size))
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
... |
class Dinov2WithRegistersLayerScale(nn.Module):
def __init__(self, config) -> None:
pass
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 12 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
2,176 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersMLP | from ...activations import ACT2FN
import torch
from torch import nn
class Dinov2WithRegistersMLP(nn.Module):
def __init__(self, config) -> None:
super().__init__()
in_features = out_features = config.hidden_size
hidden_features = int(config.hidden_size * config.mlp_ratio)
self.fc1 ... |
class Dinov2WithRegistersMLP(nn.Module):
def __init__(self, config) -> None:
pass
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 17 | 1 | 16 | 8 | 13 | 0 | 15 | 8 | 12 | 2 | 1 | 1 | 3 |
2,177 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersModel | from torch import nn
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from typing import Callable, Optional, Union
import torch
from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
from ...utils.generic import can_return_tuple, chec... | @auto_docstring
class Dinov2WithRegistersModel(Dinov2WithRegistersPreTrainedModel):
def __init__(self, config: Dinov2WithRegistersConfig):
pass
def get_input_embeddings(self) -> Dinov2WithRegistersPatchEmbeddings:
pass
def _prune_heads(self, heads_to_prune: dict[int, list[int]]) -> None:
... | 8 | 2 | 17 | 2 | 12 | 3 | 3 | 0.17 | 1 | 10 | 5 | 0 | 4 | 4 | 4 | 5 | 80 | 12 | 58 | 24 | 37 | 10 | 29 | 15 | 24 | 6 | 2 | 1 | 10 |
2,178 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersPatchEmbeddings | import torch
import collections.abc
from torch import nn
class Dinov2WithRegistersPatchEmbeddings(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 c... |
class Dinov2WithRegistersPatchEmbeddings(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__(s... | 3 | 1 | 12 | 1 | 11 | 0 | 3 | 0.23 | 1 | 4 | 0 | 0 | 2 | 5 | 2 | 12 | 31 | 4 | 22 | 13 | 19 | 5 | 19 | 13 | 16 | 3 | 1 | 1 | 5 |
2,179 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersPreTrainedModel | from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
from ...utils import TransformersKwargs, auto_docstring, torch_int
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from typing import Callable, Optional, Union
from torch import nn
@auto_docstring
class Dinov... | @auto_docstring
class Dinov2WithRegistersPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 25 | 1 | 21 | 3 | 5 | 0.25 | 1 | 1 | 1 | 3 | 1 | 0 | 1 | 1 | 38 | 3 | 28 | 8 | 26 | 7 | 16 | 8 | 14 | 5 | 1 | 2 | 5 |
2,180 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersSelfAttention | import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
from torch import nn
class Dinov2WithRegistersSelfAttention(nn.Module):
def __init__(self, config: Dinov2WithR... |
class Dinov2WithRegistersSelfAttention(nn.Module):
def __init__(self, config: Dinov2WithRegistersConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> tuple[torch.Tensor, torch.Tensor]:
pass | 3 | 0 | 18 | 4 | 12 | 2 | 2 | 0.13 | 1 | 6 | 1 | 1 | 3 | 7 | 3 | 13 | 58 | 15 | 38 | 23 | 32 | 5 | 33 | 21 | 29 | 3 | 1 | 1 | 6 |
2,181 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersSelfOutput | from .configuration_dinov2_with_registers import Dinov2WithRegistersConfig
import torch
from torch import nn
class Dinov2WithRegistersSelfOutput(nn.Module):
"""
The residual connection is defined in Dinov2WithRegistersLayer instead of here (as is the case with other models), due to the
layernorm applied be... |
class Dinov2WithRegistersSelfOutput(nn.Module):
'''
The residual connection is defined in Dinov2WithRegistersLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: Dinov2WithRegistersConfig):
pass
def fo... | 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 |
2,182 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modeling_dinov2_with_registers.Dinov2WithRegistersSwiGLUFFN | from torch import nn
import torch
class Dinov2WithRegistersSwiGLUFFN(nn.Module):
def __init__(self, config) -> None:
super().__init__()
in_features = out_features = config.hidden_size
hidden_features = int(config.hidden_size * config.mlp_ratio)
hidden_features = (int(hidden_feature... |
class Dinov2WithRegistersSwiGLUFFN(nn.Module):
def __init__(self, config) -> None:
pass
def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 1 | 6 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 15 | 2 | 13 | 9 | 10 | 0 | 13 | 9 | 10 | 1 | 1 | 0 | 2 |
2,183 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersBackbone | from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from typing import Optional, Union
import torch
from ....transformers.models.dinov2.modeling_dinov2 import Dinov2Backbone, Dinov2Encoder, Dinov2ForImageClassification, Dinov2Model, Dinov2PatchEmbeddings, D... |
class Dinov2WithRegistersBackbone(Dinov2Backbone):
def __init__(self, config):
pass
def get_input_embeddings(self) -> Dinov2WithRegistersPatchEmbeddings:
pass
def forward(self, pixel_values: torch.Tensor, output_hidden_states: Optional[bool]=None, **kwargs) -> BackboneOutput:
'''... | 4 | 1 | 30 | 5 | 17 | 8 | 5 | 0.44 | 1 | 9 | 4 | 0 | 3 | 5 | 3 | 19 | 92 | 17 | 52 | 23 | 42 | 23 | 37 | 17 | 33 | 13 | 3 | 3 | 15 |
2,184 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersConfig | from ...configuration_utils import PretrainedConfig
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
class Dinov2WithRegistersConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Dinov2WithRegiste... |
class Dinov2WithRegistersConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Dinov2WithRegistersModel`]. It is used to instantiate an
Dinov2WithRegisters model according to the specified arguments, defining the model architecture. Instantiati... | 2 | 1 | 50 | 1 | 49 | 0 | 1 | 1.35 | 2 | 2 | 0 | 0 | 1 | 22 | 1 | 38 | 130 | 10 | 51 | 48 | 25 | 69 | 25 | 24 | 23 | 1 | 2 | 0 | 1 |
2,185 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersEmbeddings | from torch import nn
import torch
from ...utils import TransformersKwargs, logging, torch_int
from typing import Optional, Union
class Dinov2WithRegistersEmbeddings(nn.Module):
"""
Construct the CLS token, mask token, register tokens, position and patch embeddings.
"""
def __init__(self, config: Dinov... |
class Dinov2WithRegistersEmbeddings(nn.Module):
'''
Construct the CLS token, mask token, register tokens, position and patch embeddings.
'''
def __init__(self, config: Dinov2WithRegistersConfig) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width:... | 4 | 2 | 30 | 6 | 18 | 7 | 2 | 0.44 | 1 | 6 | 2 | 0 | 3 | 8 | 3 | 13 | 97 | 20 | 54 | 24 | 50 | 24 | 44 | 24 | 40 | 4 | 1 | 2 | 7 |
2,186 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersEncoder | from ....transformers.models.dinov2.modeling_dinov2 import Dinov2Backbone, Dinov2Encoder, Dinov2ForImageClassification, Dinov2Model, Dinov2PatchEmbeddings, Dinov2PreTrainedModel
class Dinov2WithRegistersEncoder(Dinov2Encoder):
pass |
class Dinov2WithRegistersEncoder(Dinov2Encoder):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,187 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersForImageClassification | from typing import Optional, Union
import torch
from ...processing_utils import Unpack
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from ....transformers.models.dinov2.modeling_dinov2 import Dinov2Backbone, Dinov2Encoder, Dinov2ForImageClassification... |
class Dinov2WithRegistersForImageClassification(Dinov2ForImageClassification):
def forward(self, pixel_values: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, labels: Optional[torch.Tensor]=None, **kwargs: Unpack[TransformersKwargs]) -> ImageClassifierOutput:
'''
labels (`torc... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,188 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersModel | from ....transformers.models.dinov2.modeling_dinov2 import Dinov2Backbone, Dinov2Encoder, Dinov2ForImageClassification, Dinov2Model, Dinov2PatchEmbeddings, Dinov2PreTrainedModel
class Dinov2WithRegistersModel(Dinov2Model):
pass |
class Dinov2WithRegistersModel(Dinov2Model):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
2,189 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersPatchEmbeddings | from ....transformers.models.dinov2.modeling_dinov2 import Dinov2Backbone, Dinov2Encoder, Dinov2ForImageClassification, Dinov2Model, Dinov2PatchEmbeddings, Dinov2PreTrainedModel
class Dinov2WithRegistersPatchEmbeddings(Dinov2PatchEmbeddings):
pass |
class Dinov2WithRegistersPatchEmbeddings(Dinov2PatchEmbeddings):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,190 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | transformers.models.dinov2_with_registers.modular_dinov2_with_registers.Dinov2WithRegistersPreTrainedModel | from ....transformers.models.dinov2.modeling_dinov2 import Dinov2Backbone, Dinov2Encoder, Dinov2ForImageClassification, Dinov2Model, Dinov2PatchEmbeddings, Dinov2PreTrainedModel
from torch import nn
import torch
from typing import Optional, Union
class Dinov2WithRegistersPreTrainedModel(Dinov2PreTrainedModel):
de... |
class Dinov2WithRegistersPreTrainedModel(Dinov2PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,191 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/configuration_distilbert.py | transformers.models.distilbert.configuration_distilbert.DistilBertConfig | from ...configuration_utils import PretrainedConfig
class DistilBertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DistilBertModel`] or a [`TFDistilBertModel`]. It
is used to instantiate a DistilBERT model according to the specified arguments, defining the m... |
class DistilBertConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DistilBertModel`] or a [`TFDistilBertModel`]. It
is used to instantiate a DistilBERT model according to the specified arguments, defining the model architecture.
Instantiating a configuration... | 2 | 1 | 32 | 0 | 32 | 0 | 1 | 1.23 | 1 | 1 | 0 | 0 | 1 | 13 | 1 | 1 | 96 | 9 | 39 | 34 | 20 | 48 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
2,192 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/configuration_distilbert.py | transformers.models.distilbert.configuration_distilbert.DistilBertOnnxConfig | from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
class DistilBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequ... |
class DistilBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 11 | 0 | 11 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 13 | 0 | 13 | 4 | 10 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
2,193 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertFlashAttention2 | from typing import Optional, Union
import torch
from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available
class DistilBertFlashAttention2(MultiHeadSelfAttention):
"""
DistilBert flash attention module. This module inherits from `MultiHeadSelfAttention` as the weig... |
class DistilBertFlashAttention2(MultiHeadSelfAttention):
'''
DistilBert flash attention module. This module inherits from `MultiHeadSelfAttention` 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... | 4 | 3 | 30 | 4 | 18 | 8 | 3 | 0.52 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 15 | 94 | 15 | 52 | 23 | 40 | 27 | 28 | 15 | 24 | 6 | 2 | 2 | 8 |
2,194 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertForMaskedLM | from ...utils import auto_docstring, logging
from ...activations import get_activation
from ...configuration_utils import PretrainedConfig
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch ... | @auto_docstring(custom_intro='\n DistilBert Model with a `masked language modeling` head on top.\n ')
class DistilBertForMaskedLM(DistilBertPreTrainedModel):
def __init__(self, config: PretrainedConfig):
pass
def get_position_embeddings(self) -> nn.Embedding:
'''
Returns the posi... | 9 | 3 | 14 | 2 | 9 | 4 | 2 | 0.4 | 1 | 6 | 2 | 0 | 6 | 6 | 6 | 7 | 98 | 15 | 63 | 30 | 40 | 25 | 34 | 19 | 27 | 5 | 2 | 1 | 10 |
2,195 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertForMultipleChoice | from typing import Optional, Union
from torch import nn
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from torch.nn import BCEWithLogitsLo... | @auto_docstring
class DistilBertForMultipleChoice(DistilBertPreTrainedModel):
def __init__(self, config: PretrainedConfig):
pass
def get_position_embeddings(self) -> nn.Embedding:
'''
Returns the position embeddings
'''
pass
def resize_position_embeddings(self, new... | 7 | 3 | 28 | 4 | 15 | 11 | 3 | 0.66 | 1 | 6 | 2 | 0 | 4 | 4 | 4 | 5 | 121 | 20 | 65 | 31 | 46 | 43 | 34 | 18 | 29 | 9 | 2 | 1 | 12 |
2,196 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertForQuestionAnswering | from torch import nn
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, logging
from typing import Optional, Union
from ...configuration_utils import PretrainedConf... | @auto_docstring
class DistilBertForQuestionAnswering(DistilBertPreTrainedModel):
def __init__(self, config: PretrainedConfig):
pass
def get_position_embeddings(self) -> nn.Embedding:
'''
Returns the position embeddings
'''
pass
def resize_position_embeddings(self, ... | 7 | 3 | 25 | 3 | 16 | 8 | 3 | 0.44 | 1 | 7 | 2 | 0 | 4 | 3 | 4 | 5 | 109 | 13 | 70 | 30 | 48 | 31 | 39 | 18 | 34 | 7 | 2 | 2 | 11 |
2,197 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertForSequenceClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifier... | @auto_docstring(custom_intro='\n DistilBert 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 DistilBertForSequenceClassification(DistilBertPreTrainedModel):
def __init__(self, config: PretrainedConfig):
... | 7 | 3 | 25 | 2 | 18 | 7 | 4 | 0.34 | 1 | 6 | 2 | 0 | 4 | 6 | 4 | 5 | 108 | 11 | 77 | 29 | 56 | 26 | 43 | 18 | 38 | 12 | 2 | 3 | 15 |
2,198 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertForTokenClassification | from ...utils import auto_docstring, logging
from ...configuration_utils import PretrainedConfig
from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ... | @auto_docstring
class DistilBertForTokenClassification(DistilBertPreTrainedModel):
def __init__(self, config: PretrainedConfig):
pass
def get_position_embeddings(self) -> nn.Embedding:
'''
Returns the position embeddings
'''
pass
def resize_position_embeddings(self... | 7 | 3 | 19 | 2 | 12 | 5 | 2 | 0.33 | 1 | 6 | 2 | 0 | 4 | 4 | 4 | 5 | 85 | 12 | 55 | 26 | 34 | 18 | 26 | 15 | 21 | 5 | 2 | 1 | 8 |
2,199 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/distilbert/modeling_distilbert.py | transformers.models.distilbert.modeling_distilbert.DistilBertModel | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask_for_sdpa
import torch
from ...utils import auto_docstring, logging
from ...configuration_utils import PretrainedConfig
from torch import nn
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoic... | @auto_docstring
class DistilBertModel(DistilBertPreTrainedModel):
def __init__(self, config: PretrainedConfig):
pass
def get_position_embeddings(self) -> nn.Embedding:
'''
Returns the position embeddings
'''
pass
def resize_position_embeddings(self, new_num_positio... | 10 | 4 | 17 | 2 | 12 | 4 | 3 | 0.27 | 1 | 8 | 3 | 0 | 7 | 4 | 7 | 8 | 133 | 21 | 91 | 29 | 68 | 25 | 53 | 19 | 45 | 12 | 2 | 3 | 22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.