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,600 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.ConvLayer | from ...activations import ACT2FN
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
class ConvLayer(nn.Module):
def __init__(self, config):
super().__init__()
kernel_size = getattr(config, 'conv_kernel_size', 3)
groups = getattr(config, 'conv... |
class ConvLayer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, residual_states, input_mask):
pass | 3 | 0 | 16 | 2 | 14 | 0 | 3 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 34 | 5 | 29 | 15 | 26 | 0 | 26 | 15 | 23 | 4 | 1 | 3 | 5 |
1,601 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2Attention | import torch
from typing import Optional, Union
from torch import nn
class DebertaV2Attention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = DisentangledSelfAttention(config)
self.output = DebertaV2SelfOutput(config)
self.config = config
def forward(sel... |
class DebertaV2Attention(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,602 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2Embeddings | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
import torch
from torch import nn
class DebertaV2Embeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
pad_token_id = getat... |
class DebertaV2Embeddings(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 | 1 | 0 | 0 | 2 | 9 | 2 | 12 | 79 | 18 | 59 | 18 | 56 | 2 | 52 | 18 | 49 | 12 | 1 | 3 | 16 |
1,603 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2Encoder | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
import torch
from typing import Optional, Union
from... |
class DebertaV2Encoder(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,... | 6 | 1 | 24 | 3 | 21 | 0 | 6 | 0.01 | 1 | 9 | 3 | 0 | 5 | 9 | 5 | 15 | 127 | 21 | 105 | 34 | 90 | 1 | 64 | 25 | 58 | 13 | 1 | 3 | 28 |
1,604 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2ForMaskedLM | from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, logging
import torch
from typing import Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss,... | @auto_docstring
class DebertaV2ForMaskedLM(DebertaV2PreTrainedModel):
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, atte... | 7 | 1 | 19 | 2 | 16 | 2 | 3 | 0.12 | 1 | 7 | 4 | 0 | 4 | 4 | 4 | 5 | 91 | 10 | 73 | 29 | 50 | 9 | 37 | 17 | 32 | 6 | 2 | 1 | 12 |
1,605 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2ForMultipleChoice | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
from ...utils import auto_docstring, logging
import ... | @auto_docstring
class DebertaV2ForMultipleChoice(DebertaV2PreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, ... | 7 | 1 | 21 | 3 | 17 | 2 | 4 | 0.08 | 1 | 6 | 3 | 0 | 4 | 5 | 4 | 5 | 93 | 13 | 74 | 39 | 52 | 6 | 39 | 27 | 34 | 11 | 2 | 1 | 15 |
1,606 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2ForQuestionAnswering | from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
from ...utils import auto_docstring, logging
import torch
from typing import Optional, Union
from torch.nn import BCEWithLogitsLo... | @auto_docstring
class DebertaV2ForQuestionAnswering(DebertaV2PreTrainedModel):
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[... | 5 | 0 | 40 | 5 | 29 | 7 | 4 | 0.21 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 91 | 10 | 67 | 29 | 44 | 14 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
1,607 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2ForSequenceClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
from ...utils import auto_docstring, logging
import ... | @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 DebertaV2ForSequenceClassification(DebertaV2PreTrainedModel):
def __init__(self, config):
pass
def ge... | 7 | 1 | 25 | 2 | 21 | 2 | 4 | 0.1 | 1 | 6 | 3 | 0 | 4 | 5 | 4 | 5 | 110 | 11 | 90 | 36 | 68 | 9 | 53 | 24 | 48 | 13 | 2 | 4 | 17 |
1,608 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2ForTokenClassification | from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
from ...utils import auto_docstring, logging
import torch
from typing import Optional, Union
from torch.nn import BCEWithLogitsLo... | @auto_docstring
class DebertaV2ForTokenClassification(DebertaV2PreTrainedModel):
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: Optiona... | 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,609 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2Intermediate | from ...activations import ACT2FN
import torch
from torch import nn
class DebertaV2Intermediate(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.intermedia... |
class DebertaV2Intermediate(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,610 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2LMPredictionHead | from ...activations import ACT2FN
import torch
from torch import nn
class DebertaV2LMPredictionHead(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.h... |
class DebertaV2LMPredictionHead(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 | 9 | 2 | 8 | 0 | 2 | 0.13 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 23 | 5 | 16 | 7 | 13 | 2 | 15 | 7 | 12 | 2 | 1 | 1 | 3 |
1,611 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2Layer | from ...modeling_layers import GradientCheckpointingLayer
import torch
from typing import Optional, Union
class DebertaV2Layer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = DebertaV2Attention(config)
self.intermediate = DebertaV2Intermediate(c... |
class DebertaV2Layer(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,612 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2Model | from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from typing import Optional, Union
from ...utils import auto_docstring, logging
@auto_docstring
class DebertaV2Model(DebertaV2PreTrained... | @auto_docstring
class DebertaV2Model(DebertaV2PreTrainedModel):
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. he... | 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,613 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2OnlyMLMHead | from torch import nn
class DebertaV2OnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.lm_head = DebertaV2LMPredictionHead(config)
def forward(self, sequence_output, word_embeddings):
prediction_scores = self.lm_head(sequence_output, word_embeddings)
r... |
class DebertaV2OnlyMLMHead(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,614 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2Output | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from torch import nn
class DebertaV2Output(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = LayerNorm(config.hidden_s... |
class DebertaV2Output(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
1,615 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2PreTrainedModel | from .configuration_deberta_v2 import DebertaV2Config
from ...modeling_utils import PreTrainedModel
from torch import nn
from ...utils import auto_docstring, logging
@auto_docstring
class DebertaV2PreTrainedModel(PreTrainedModel):
config: DebertaV2Config
base_model_prefix = 'deberta'
_keys_to_ignore_on_loa... | @auto_docstring
class DebertaV2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights.'''
pass | 3 | 1 | 12 | 0 | 9 | 3 | 5 | 0.5 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 23 | 2 | 14 | 6 | 12 | 7 | 13 | 6 | 11 | 5 | 1 | 2 | 5 |
1,616 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2SelfOutput | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from torch import nn
class DebertaV2SelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = LayerNorm(config.hidden_siz... |
class DebertaV2SelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
1,617 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.DisentangledSelfAttention | import torch
from torch import nn
class DisentangledSelfAttention(nn.Module):
"""
Disentangled self-attention module
Parameters:
config (`DebertaV2Config`):
A model config class instance with the configuration to build a new model. The schema is similar to
*BertConfig*, for... |
class DisentangledSelfAttention(nn.Module):
'''
Disentangled self-attention module
Parameters:
config (`DebertaV2Config`):
A model config class instance with the configuration to build a new model. The schema is similar to
*BertConfig*, for more details, please refer [`Deber... | 5 | 2 | 49 | 6 | 37 | 7 | 7 | 0.23 | 1 | 3 | 0 | 0 | 4 | 16 | 4 | 14 | 210 | 28 | 149 | 51 | 136 | 35 | 98 | 43 | 93 | 10 | 1 | 3 | 27 |
1,618 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.LegacyDebertaV2LMPredictionHead | from torch import nn
import torch
class LegacyDebertaV2LMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = LegacyDebertaV2PredictionHeadTransform(config)
self.embedding_size = getattr(config, 'embedding_size', config.hidden_size)
self.decode... |
class LegacyDebertaV2LMPredictionHead(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,619 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.LegacyDebertaV2OnlyMLMHead | from torch import nn
class LegacyDebertaV2OnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = LegacyDebertaV2LMPredictionHead(config)
def forward(self, sequence_output):
prediction_scores = self.predictions(sequence_output)
return predicti... |
class LegacyDebertaV2OnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
1,620 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/modeling_deberta_v2.py | transformers.models.deberta_v2.modeling_deberta_v2.LegacyDebertaV2PredictionHeadTransform | from ...activations import ACT2FN
from torch import nn
class LegacyDebertaV2PredictionHeadTransform(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.embeddi... |
class LegacyDebertaV2PredictionHeadTransform(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,621 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/tokenization_deberta_v2.py | transformers.models.deberta_v2.tokenization_deberta_v2.DebertaV2Tokenizer | from typing import Any, Optional
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils.import_utils import requires
import os
@requires(backends=('sentencepiece',))
class DebertaV2Tokenizer(PreTrainedTokenizer):
"""
Constructs a DeBERTa-v2 tokenizer. Based on [SentencePiece](https://g... | @requires(backends=('sentencepiece',))
class DebertaV2Tokenizer(PreTrainedTokenizer):
'''
Constructs a DeBERTa-v2 tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
Args:
vocab_file (`str`):
[SentencePiece](https://github.com/google/sentencepiece) file (general... | 16 | 7 | 11 | 1 | 7 | 4 | 2 | 0.98 | 1 | 5 | 1 | 0 | 13 | 5 | 13 | 102 | 211 | 31 | 91 | 42 | 61 | 89 | 56 | 26 | 42 | 4 | 3 | 1 | 23 |
1,622 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/tokenization_deberta_v2.py | transformers.models.deberta_v2.tokenization_deberta_v2.SPMTokenizer | import sentencepiece as sp
from typing import Any, Optional
import os
class SPMTokenizer:
"""
Constructs a tokenizer based on [SentencePiece](https://github.com/google/sentencepiece).
Args:
vocab_file (`str`):
[SentencePiece](https://github.com/google/sentencepiece) file (generally has... |
class SPMTokenizer:
'''
Constructs a tokenizer based on [SentencePiece](https://github.com/google/sentencepiece).
Args:
vocab_file (`str`):
[SentencePiece](https://github.com/google/sentencepiece) file (generally has a *.spm* extension) that
contains the vocabulary necessary... | 20 | 2 | 10 | 0 | 9 | 1 | 3 | 0.19 | 0 | 7 | 0 | 0 | 19 | 8 | 19 | 19 | 227 | 31 | 165 | 69 | 143 | 31 | 150 | 66 | 130 | 9 | 0 | 4 | 48 |
1,623 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deberta_v2/tokenization_deberta_v2_fast.py | transformers.models.deberta_v2.tokenization_deberta_v2_fast.DebertaV2TokenizerFast | import os
from shutil import copyfile
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
class DebertaV2TokenizerFast(PreTrainedTokenizerFast):
"""
Constructs a DeBERTa-v2 fast tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
Args:
... |
class DebertaV2TokenizerFast(PreTrainedTokenizerFast):
'''
Constructs a DeBERTa-v2 fast tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
Args:
vocab_file (`str`):
[SentencePiece](https://github.com/google/sentencepiece) file (generally has a *.spm* extension... | 5 | 3 | 21 | 3 | 12 | 7 | 3 | 1.16 | 1 | 4 | 0 | 0 | 6 | 3 | 6 | 94 | 185 | 27 | 73 | 32 | 51 | 85 | 38 | 17 | 31 | 5 | 3 | 1 | 15 |
1,624 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/configuration_decision_transformer.py | transformers.models.decision_transformer.configuration_decision_transformer.DecisionTransformerConfig | from ...configuration_utils import PretrainedConfig
class DecisionTransformerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DecisionTransformerModel`]. It is used to
instantiate a Decision Transformer model according to the specified arguments, defining the ... |
class DecisionTransformerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DecisionTransformerModel`]. It is used to
instantiate a Decision Transformer model according to the specified arguments, defining the model architecture.
Instantiating a configuratio... | 2 | 1 | 51 | 2 | 49 | 0 | 1 | 1.09 | 1 | 1 | 0 | 0 | 1 | 22 | 1 | 1 | 131 | 12 | 57 | 52 | 30 | 62 | 28 | 27 | 26 | 1 | 1 | 0 | 1 |
1,625 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/modeling_decision_transformer.py | transformers.models.decision_transformer.modeling_decision_transformer.DecisionTransformerGPT2Attention | from ...utils.deprecation import deprecate_kwarg
from typing import Callable, Optional, Union
from torch import nn
from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch
from ...modeling_utils import ALL_... |
class DecisionTransformerGPT2Attention(nn.Module):
def __init__(self, config, is_cross_attention=False, layer_idx=None):
pass
def prune_heads(self, heads):
pass
def _upcast_and_reordered_attn(self, query, key, value, attention_mask=None, head_mask=None):
pass
@deprecate_kwarg... | 6 | 0 | 49 | 8 | 37 | 4 | 6 | 0.11 | 1 | 9 | 1 | 0 | 4 | 17 | 4 | 14 | 199 | 33 | 150 | 57 | 134 | 17 | 107 | 46 | 102 | 10 | 1 | 2 | 22 |
1,626 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/modeling_decision_transformer.py | transformers.models.decision_transformer.modeling_decision_transformer.DecisionTransformerGPT2Block | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from ...utils.deprecation import deprecate_kwarg
from typing import Callable, Optional, Union
class DecisionTransformerGPT2Block(GradientCheckpointingLayer):
... |
class DecisionTransformerGPT2Block(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]], past_key_values: Optional[Cache]=None... | 4 | 0 | 38 | 4 | 33 | 4 | 4 | 0.12 | 1 | 6 | 2 | 0 | 2 | 6 | 2 | 12 | 79 | 8 | 66 | 27 | 53 | 8 | 36 | 17 | 33 | 4 | 1 | 2 | 7 |
1,627 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/modeling_decision_transformer.py | transformers.models.decision_transformer.modeling_decision_transformer.DecisionTransformerGPT2MLP | import torch
from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer
from ...activations import ACT2FN
from typing import Callable, Optional, Union
from torch import nn
class DecisionTransformerGPT2MLP(nn.Module):
def __init__(self, intermediate_size, config):
super().__i... |
class DecisionTransformerGPT2MLP(nn.Module):
def __init__(self, intermediate_size, config):
pass
def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]]) -> torch.FloatTensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 15 | 1 | 14 | 8 | 11 | 0 | 14 | 8 | 11 | 1 | 1 | 0 | 2 |
1,628 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/modeling_decision_transformer.py | transformers.models.decision_transformer.modeling_decision_transformer.DecisionTransformerGPT2Model | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions
from torch import nn
from typing import Callable, Optional, Union
import torch
class DecisionTransformerGPT2Model(DecisionTransformerGPT2PreTrainedModel):
def __init__(self... |
class DecisionTransformerGPT2Model(DecisionTransformerGPT2PreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_value... | 5 | 0 | 53 | 7 | 40 | 6 | 11 | 0.16 | 1 | 11 | 2 | 0 | 4 | 9 | 4 | 6 | 215 | 30 | 161 | 46 | 141 | 25 | 105 | 31 | 100 | 41 | 2 | 4 | 44 |
1,629 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/modeling_decision_transformer.py | transformers.models.decision_transformer.modeling_decision_transformer.DecisionTransformerGPT2PreTrainedModel | import math
from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer
from .configuration_decision_transformer import DecisionTransformerConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
from ...utils import ModelOutput, auto_docstring, lo... | @auto_docstring
class DecisionTransformerGPT2PreTrainedModel(PreTrainedModel):
def __init__(self, *inputs, **kwargs):
pass
def _init_weights(self, module):
'''Initialize the weights.'''
pass | 4 | 1 | 14 | 1 | 9 | 5 | 5 | 0.61 | 1 | 2 | 1 | 1 | 2 | 0 | 2 | 2 | 41 | 4 | 23 | 9 | 20 | 14 | 21 | 9 | 18 | 8 | 1 | 2 | 9 |
1,630 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/modeling_decision_transformer.py | transformers.models.decision_transformer.modeling_decision_transformer.DecisionTransformerModel | from torch import nn
from typing import Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
import torch
@auto_docstring(custom_intro='\n The Decision Transformer Model\n ')
class DecisionTransformerModel(DecisionTransformerPreTrainedModel):
"""
The model builds upon the ... | @auto_docstring(custom_intro='\n The Decision Transformer Model\n ')
class DecisionTransformerModel(DecisionTransformerPreTrainedModel):
'''
The model builds upon the GPT2 architecture to perform autoregressive prediction of actions in an offline RL
setting. Refer to the paper for more details: https:... | 5 | 2 | 72 | 10 | 39 | 25 | 4 | 0.65 | 1 | 4 | 2 | 0 | 2 | 11 | 2 | 3 | 155 | 24 | 81 | 39 | 65 | 53 | 42 | 27 | 39 | 6 | 2 | 1 | 8 |
1,631 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/decision_transformer/modeling_decision_transformer.py | transformers.models.decision_transformer.modeling_decision_transformer.DecisionTransformerPreTrainedModel | from torch import nn
from .configuration_decision_transformer import DecisionTransformerConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
class DecisionTransformerPreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for down... |
class DecisionTransformerPreTrainedModel(PreTrainedModel):
'''
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
'''
def _init_weights(self, module):
'''Initialize the weights'''
pass | 2 | 2 | 15 | 0 | 12 | 3 | 6 | 0.41 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 26 | 2 | 17 | 6 | 15 | 7 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
1,632 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/configuration_deformable_detr.py | transformers.models.deformable_detr.configuration_deformable_detr.DeformableDetrConfig | from ...configuration_utils import PretrainedConfig
from ..auto import CONFIG_MAPPING
from ...utils.backbone_utils import verify_backbone_config_arguments
class DeformableDetrConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DeformableDetrModel`]. It is used to ins... |
class DeformableDetrConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DeformableDetrModel`]. It is used to instantiate
a Deformable DETR model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defa... | 8 | 1 | 41 | 1 | 39 | 2 | 3 | 0.94 | 1 | 4 | 0 | 0 | 3 | 41 | 3 | 3 | 254 | 13 | 124 | 97 | 72 | 117 | 65 | 49 | 61 | 8 | 1 | 2 | 10 |
1,633 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/feature_extraction_deformable_detr.py | transformers.models.deformable_detr.feature_extraction_deformable_detr.DeformableDetrFeatureExtractor | import warnings
from ...utils.import_utils import requires
from .image_processing_deformable_detr import DeformableDetrImageProcessor
@requires(backends=('vision',))
class DeformableDetrFeatureExtractor(DeformableDetrImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class De... | @requires(backends=('vision',))
class DeformableDetrFeatureExtractor(DeformableDetrImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 34 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
1,634 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/image_processing_deformable_detr.py | transformers.models.deformable_detr.image_processing_deformable_detr.DeformableDetrImageProcessor | from ...feature_extraction_utils import BatchFeature
from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, AnnotationFormat, AnnotationType, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, vali... | @requires(backends=('torch', 'vision'))
class DeformableDetrImageProcessor(BaseImageProcessor):
'''
Constructs a Deformable DETR image processor.
Args:
format (`str`, *optional*, defaults to `"coco_detection"`):
Data format of the annotations. One of "coco_detection" or "coco_panoptic".
... | 16 | 13 | 58 | 4 | 38 | 16 | 6 | 0.55 | 1 | 16 | 4 | 1 | 12 | 13 | 13 | 33 | 828 | 65 | 492 | 180 | 383 | 272 | 230 | 85 | 216 | 32 | 3 | 3 | 80 |
1,635 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/image_processing_deformable_detr_fast.py | transformers.models.deformable_detr.image_processing_deformable_detr_fast.DeformableDetrImageProcessorFast | from ...utils import TensorType, auto_docstring, is_torchvision_v2_available, logging
from .image_processing_deformable_detr import get_size_with_aspect_ratio
from ...image_processing_utils import BatchFeature, get_size_dict
import pathlib
from ...image_processing_utils_fast import BaseImageProcessorFast, DefaultFastIm... | @auto_docstring
@requires(backends=('torchvision', 'torch'))
class DeformableDetrImageProcessorFast(BaseImageProcessorFast):
def __init__(self, **kwargs: Unpack[DeformableDetrFastImageProcessorKwargs]) -> None:
pass
@classmethod
def from_dict(cls, image_processor_dict: dict[str, Any], **kwargs):
... | 17 | 9 | 41 | 4 | 30 | 7 | 6 | 0.22 | 1 | 18 | 6 | 0 | 11 | 1 | 12 | 46 | 554 | 54 | 412 | 186 | 303 | 89 | 227 | 90 | 214 | 22 | 4 | 3 | 74 |
1,636 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrConvEncoder | from ...utils.backbone_utils import load_backbone
from torch import Tensor, nn
import torch.nn.functional as F
import torch
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
class DeformableDetrConvEncoder(nn.Module):
"""
Convolutional backbone, using either the Au... |
class DeformableDetrConvEncoder(nn.Module):
'''
Convolutional backbone, using either the AutoBackbone API or one from the timm library.
nn.BatchNorm2d layers are replaced by DeformableDetrFrozenBatchNorm2d as defined above.
'''
def __init__(self, config):
pass
def forward(self, pixel_... | 3 | 1 | 31 | 3 | 25 | 3 | 8 | 0.22 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 71 | 10 | 50 | 16 | 47 | 11 | 37 | 16 | 34 | 13 | 1 | 4 | 16 |
1,637 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrConvModel | from torch import Tensor, nn
class DeformableDetrConvModel(nn.Module):
"""
This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder.
"""
def __init__(self, conv_encoder, position_embedding):
super().__init__()
self.conv_encoder = conv_encode... |
class DeformableDetrConvModel(nn.Module):
'''
This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder.
'''
def __init__(self, conv_encoder, position_embedding):
pass
def forward(self, pixel_values, pixel_mask):
pass | 3 | 1 | 7 | 1 | 5 | 1 | 2 | 0.45 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 3 | 11 | 8 | 8 | 5 | 11 | 8 | 8 | 2 | 1 | 1 | 3 |
1,638 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrDecoder | from .configuration_deformable_detr import DeformableDetrConfig
import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DeformableDetrDecoder(DeformableDetrPreTrainedModel):
"""
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`DeformableDetrDecoderLaye... |
class DeformableDetrDecoder(DeformableDetrPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`DeformableDetrDecoderLayer`].
The decoder updates the query embeddings through multiple self-attention and cross-attention layers.
Some tweaks for Deformab... | 3 | 2 | 87 | 9 | 60 | 19 | 11 | 0.38 | 1 | 8 | 3 | 0 | 2 | 5 | 2 | 3 | 189 | 23 | 120 | 34 | 103 | 46 | 56 | 20 | 53 | 20 | 2 | 3 | 21 |
1,639 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrDecoderLayer | from .configuration_deformable_detr import DeformableDetrConfig
from ...activations import ACT2FN
from typing import Any, Optional, Union
from torch import Tensor, nn
from ...modeling_layers import GradientCheckpointingLayer
import torch.nn.functional as F
import torch
class DeformableDetrDecoderLayer(GradientCheckpoi... |
class DeformableDetrDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: DeformableDetrConfig):
pass
def forward(self, hidden_states: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, reference_points=None, spatial_shapes=None, spatial_shapes_list=None, level_start_index... | 3 | 1 | 55 | 6 | 35 | 14 | 2 | 0.38 | 1 | 6 | 3 | 0 | 2 | 11 | 2 | 12 | 111 | 13 | 71 | 30 | 57 | 27 | 37 | 19 | 34 | 2 | 1 | 1 | 3 |
1,640 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrDecoderOutput | from typing import Any, Optional, Union
from dataclasses import dataclass
import torch.nn.functional as F
import torch
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
@dataclass
@auto_docstring(custom_intro='\n Base class for outputs of the DeformableDetrDecoder. This... | @dataclass
@auto_docstring(custom_intro='\n Base class for outputs of the DeformableDetrDecoder. This class adds two attributes to\n BaseModelOutputWithCrossAttentions, namely:\n - a stacked tensor of intermediate decoder hidden states (i.e. the output of each decoder layer)\n - a stacked tensor of intermed... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.57 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 2 | 7 | 7 | 6 | 25 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
1,641 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrEncoder | from .configuration_deformable_detr import DeformableDetrConfig
from ...pytorch_utils import meshgrid
from ...modeling_outputs import BaseModelOutput
from torch import Tensor, nn
import torch.nn.functional as F
import torch
class DeformableDetrEncoder(DeformableDetrPreTrainedModel):
"""
Transformer encoder con... |
class DeformableDetrEncoder(DeformableDetrPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* deformable attention layers. Each layer is a
[`DeformableDetrEncoderLayer`].
The encoder updates the flattened multi-scale feature maps through multiple deformable attention layers.... | 5 | 3 | 44 | 3 | 27 | 13 | 5 | 0.57 | 1 | 7 | 3 | 0 | 2 | 3 | 3 | 4 | 145 | 15 | 83 | 32 | 66 | 47 | 42 | 19 | 38 | 12 | 2 | 2 | 15 |
1,642 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrEncoderLayer | from .configuration_deformable_detr import DeformableDetrConfig
from ...activations import ACT2FN
from typing import Any, Optional, Union
from torch import Tensor, nn
from ...modeling_layers import GradientCheckpointingLayer
import torch.nn.functional as F
import torch
class DeformableDetrEncoderLayer(GradientCheckpoi... |
class DeformableDetrEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: DeformableDetrConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, reference_points=None, spatial_shapes=None, spatial_shape... | 3 | 1 | 42 | 5 | 28 | 10 | 3 | 0.34 | 1 | 5 | 2 | 0 | 2 | 9 | 2 | 12 | 85 | 10 | 56 | 26 | 43 | 19 | 33 | 16 | 30 | 4 | 1 | 2 | 5 |
1,643 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrForObjectDetection | from .configuration_deformable_detr import DeformableDetrConfig
from typing import Any, Optional, Union
from torch import Tensor, nn
import torch.nn.functional as F
import torch
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
@auto_docstring(custom_intro='\n Deformabl... | null | 5 | 1 | 87 | 10 | 56 | 21 | 9 | 0.37 | 1 | 9 | 4 | 0 | 2 | 3 | 2 | 3 | 182 | 22 | 117 | 44 | 100 | 43 | 66 | 30 | 63 | 13 | 2 | 2 | 18 |
1,644 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrFrozenBatchNorm2d | import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DeformableDetrFrozenBatchNorm2d(nn.Module):
"""
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
... |
class DeformableDetrFrozenBatchNorm2d(nn.Module):
'''
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
torchvision.models.resnet[18,34,50,101] produce nans.
'''
def ... | 4 | 1 | 9 | 0 | 8 | 1 | 1 | 0.28 | 1 | 1 | 0 | 0 | 3 | 0 | 3 | 13 | 37 | 5 | 25 | 13 | 19 | 7 | 21 | 11 | 17 | 2 | 1 | 1 | 4 |
1,645 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrLearnedPositionEmbedding | import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DeformableDetrLearnedPositionEmbedding(nn.Module):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, embedding_dim=256):
super().__init__()
self.row_embeddings ... |
class DeformableDetrLearnedPositionEmbedding(nn.Module):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, embedding_dim=256):
pass
def forward(self, pixel_values, pixel_mask=None):
pass | 3 | 1 | 8 | 0 | 8 | 0 | 1 | 0.19 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 21 | 2 | 16 | 11 | 13 | 3 | 16 | 11 | 13 | 1 | 1 | 0 | 2 |
1,646 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrMLPPredictionHead | from torch import Tensor, nn
class DeformableDetrMLPPredictionHead(nn.Module):
"""
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blob... |
class DeformableDetrMLPPredictionHead(nn.Module):
'''
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blob/master/models/detr.py
'''... | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.5 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 4 | 10 | 7 | 7 | 5 | 10 | 7 | 7 | 3 | 1 | 1 | 4 |
1,647 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrModel | from .configuration_deformable_detr import DeformableDetrConfig
from ...pytorch_utils import meshgrid
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput
from torch import Tensor, nn
import torch.nn.functional as F
import math
import torch
from ...utils import ModelOutput, auto_docst... | null | 11 | 4 | 38 | 4 | 28 | 6 | 4 | 0.21 | 1 | 16 | 7 | 0 | 9 | 11 | 9 | 10 | 351 | 46 | 252 | 101 | 229 | 54 | 164 | 89 | 154 | 18 | 2 | 3 | 34 |
1,648 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrMultiheadAttention | from typing import Any, Optional, Union
from torch import Tensor, nn
import torch.nn.functional as F
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
import torch
class DeformableDetrMultiheadAttention(nn.Module):
"""
Multi-headed attention from 'Attention Is All You Need' paper.
Here, w... |
class DeformableDetrMultiheadAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper.
Here, we add position embeddings to the queries and keys (as explained in the Deformable DETR paper).
'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, bia... | 5 | 2 | 26 | 4 | 20 | 2 | 3 | 0.16 | 1 | 6 | 0 | 0 | 4 | 9 | 4 | 14 | 115 | 22 | 80 | 37 | 63 | 13 | 55 | 25 | 50 | 8 | 1 | 2 | 13 |
1,649 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrMultiscaleDeformableAttention | from .configuration_deformable_detr import DeformableDetrConfig
from typing import Any, Optional, Union
from torch import Tensor, nn
import warnings
import torch.nn.functional as F
import torch
class DeformableDetrMultiscaleDeformableAttention(nn.Module):
"""
Multiscale deformable attention as proposed in Defo... |
class DeformableDetrMultiscaleDeformableAttention(nn.Module):
'''
Multiscale deformable attention as proposed in Deformable DETR.
'''
def __init__(self, config: DeformableDetrConfig, num_heads: int, n_points: int):
pass
def with_pos_embed(self, tensor: torch.Tensor, position_embedding... | 4 | 1 | 39 | 3 | 33 | 2 | 5 | 0.1 | 1 | 9 | 2 | 0 | 3 | 10 | 3 | 13 | 124 | 13 | 101 | 39 | 85 | 10 | 55 | 26 | 51 | 8 | 1 | 2 | 15 |
1,650 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrObjectDetectionOutput | from typing import Any, Optional, Union
from dataclasses import dataclass
import torch.nn.functional as F
import torch
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
@dataclass
@auto_docstring(custom_intro='\n Output type of [`DeformableDetrForObjectDetection`].\n ... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`DeformableDetrForObjectDetection`].\n ')
class DeformableDetrObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a ne... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 77 | 2 | 18 | 18 | 17 | 57 | 18 | 18 | 17 | 0 | 1 | 0 | 0 |
1,651 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrPreTrainedModel | from .configuration_deformable_detr import DeformableDetrConfig
from ...modeling_utils import PreTrainedModel
from torch import Tensor, nn
import torch.nn.functional as F
import math
import torch
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
@auto_docstring
class Defor... | @auto_docstring
class DeformableDetrPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 43 | 1 | 40 | 2 | 10 | 0.04 | 1 | 3 | 2 | 4 | 1 | 0 | 1 | 1 | 50 | 2 | 46 | 12 | 44 | 2 | 37 | 12 | 35 | 10 | 1 | 2 | 10 |
1,652 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modeling_deformable_detr.py | transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrSinePositionEmbedding | import math
import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DeformableDetrSinePositionEmbedding(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.
... |
class DeformableDetrSinePositionEmbedding(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, scal... | 3 | 1 | 15 | 1 | 14 | 0 | 3 | 0.14 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 36 | 4 | 28 | 14 | 25 | 4 | 28 | 14 | 25 | 3 | 1 | 1 | 6 |
1,653 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deformable_detr/modular_deformable_detr.py | transformers.models.deformable_detr.modular_deformable_detr.DeformableDetrImageProcessorFast | from transformers.models.detr.image_processing_detr_fast import DetrImageProcessorFast
from ...utils import TensorType, logging
import torch
from typing import Union
from ...image_transforms import center_to_corners_format
class DeformableDetrImageProcessorFast(DetrImageProcessorFast):
def post_process(self, outp... |
class DeformableDetrImageProcessorFast(DetrImageProcessorFast):
def post_process(self, outputs, target_sizes):
'''
Converts the raw output of [`DeformableDetrForObjectDetection`] into final bounding boxes in (top_left_x,
top_left_y, bottom_right_x, bottom_right_y) format. Only supports PyT... | 9 | 2 | 14 | 2 | 8 | 4 | 2 | 0.49 | 1 | 7 | 1 | 0 | 8 | 0 | 8 | 50 | 122 | 21 | 68 | 37 | 57 | 33 | 60 | 35 | 51 | 6 | 5 | 2 | 15 |
1,654 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/configuration_deit.py | transformers.models.deit.configuration_deit.DeiTConfig | from ...configuration_utils import PretrainedConfig
class DeiTConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DeiTModel`]. It is used to instantiate an DeiT
model according to the specified arguments, defining the model architecture. Instantiating a configura... |
class DeiTConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DeiTModel`]. It is used to instantiate an DeiT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar conf... | 2 | 1 | 34 | 1 | 33 | 0 | 1 | 1.37 | 1 | 1 | 0 | 0 | 1 | 14 | 1 | 1 | 94 | 11 | 35 | 34 | 16 | 48 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
1,655 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/configuration_deit.py | transformers.models.deit.configuration_deit.DeiTOnnxConfig | from collections.abc import Mapping
from ...onnx import OnnxConfig
from collections import OrderedDict
from packaging import version
class DeiTOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDic... |
class DeiTOnnxConfig(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 |
1,656 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/feature_extraction_deit.py | transformers.models.deit.feature_extraction_deit.DeiTFeatureExtractor | import warnings
from ...utils.import_utils import requires
from .image_processing_deit import DeiTImageProcessor
@requires(backends=('vision',))
class DeiTFeatureExtractor(DeiTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class DeiTFeatureExtractor is deprecated and will... | @requires(backends=('vision',))
class DeiTFeatureExtractor(DeiTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
1,657 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/image_processing_deit.py | transformers.models.deit.image_processing_deit.DeiTImageProcessor | import numpy as np
from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging
from typing import Optional, Union
from ...image_transforms import resize, to_channel_dimension_format
from ...utils.import_utils import requires
from ...image_processing_utils import BaseImageProcessor, Ba... | @requires(backends=('vision',))
class DeiTImageProcessor(BaseImageProcessor):
'''
Constructs a DeiT image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
... | 6 | 3 | 70 | 5 | 41 | 24 | 9 | 0.82 | 1 | 8 | 2 | 1 | 3 | 10 | 3 | 23 | 251 | 20 | 127 | 56 | 85 | 104 | 60 | 18 | 56 | 19 | 3 | 2 | 26 |
1,658 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/image_processing_deit_fast.py | transformers.models.deit.image_processing_deit_fast.DeiTImageProcessorFast | from ...image_processing_utils_fast import BaseImageProcessorFast
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, PILImageResampling
from ...utils import auto_docstring
@auto_docstring
class DeiTImageProcessorFast(BaseImageProcessorFast):
resample = PILImageResampling.BICUBIC
image_me... | @auto_docstring
class DeiTImageProcessorFast(BaseImageProcessorFast):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 12 | 0 | 10 | 10 | 9 | 2 | 10 | 10 | 9 | 0 | 4 | 0 | 0 |
1,659 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTAttention | from torch import nn
from .configuration_deit import DeiTConfig
import torch
from typing import Callable, Optional, Union
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
class DeiTAttention(nn.Module):
def __init__(self, config: DeiTConfig):
super().__init__()
sel... |
class DeiTAttention(nn.Module):
def __init__(self, config: DeiTConfig):
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 |
1,660 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTEmbeddings | from .configuration_deit import DeiTConfig
from typing import Callable, Optional, Union
from torch import nn
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
class DeiTEmbeddings(nn.Module):
"""
Construct the CLS token, distillation token, position and patch... |
class DeiTEmbeddings(nn.Module):
'''
Construct the CLS token, distillation token, position and patch embeddings. Optionally, also the mask token.
'''
def __init__(self, config: DeiTConfig, use_mask_token: bool=False) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tenso... | 4 | 2 | 27 | 6 | 18 | 3 | 2 | 0.22 | 1 | 6 | 2 | 0 | 3 | 7 | 3 | 13 | 87 | 21 | 54 | 33 | 45 | 12 | 44 | 28 | 40 | 3 | 1 | 1 | 7 |
1,661 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTEncoder | import torch
from torch import nn
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
from .configuration_deit import DeiTConfig
class DeiTEncoder(nn.Module):
def __init__(self, config: DeiTConfi... |
class DeiTEncoder(nn.Module):
def __init__(self, config: DeiTConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> 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 |
1,662 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTForImageClassification | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
from typing import Callable, Optional, Union
from ...utils.generic import can_return_tuple, check_model_i... | @auto_docstring(custom_intro='\n DeiT Model transformer with an image classification head on top (a linear layer on top of the final hidden state of\n the [CLS] token) e.g. for ImageNet.\n ')
class DeiTForImageClassification(DeiTPreTrainedModel):
def __init__(self, config: DeiTConfig) -> None:
pas... | 6 | 1 | 52 | 8 | 29 | 15 | 7 | 0.49 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 107 | 16 | 61 | 22 | 47 | 30 | 33 | 12 | 30 | 12 | 2 | 3 | 14 |
1,663 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTForImageClassificationWithTeacher | from torch import nn
from .configuration_deit import DeiTConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
from ...processing_utils import Unpack
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging,... | @auto_docstring(custom_intro='\n DeiT Model transformer with image classification heads on top (a linear layer on top of the final hidden state of\n the [CLS] token and a linear layer on top of the final hidden state of the distillation token) e.g. for ImageNet.\n\n .. warning::\n\n This model suppor... | 6 | 0 | 28 | 5 | 22 | 2 | 3 | 0.06 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 3 | 64 | 10 | 51 | 22 | 33 | 3 | 19 | 13 | 16 | 3 | 2 | 1 | 6 |
1,664 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTForMaskedImageModeling | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
from .configuration_deit import DeiTConfig
from torch import nn
im... | @auto_docstring(custom_intro='\n DeiT Model with a decoder on top for masked image modeling, as proposed in [SimMIM](https://huggingface.co/papers/2111.09886).\n\n <Tip>\n\n Note that we provide a script to pre-train this model on custom data in our [examples\n directory](https://github.com/huggingface/tran... | 6 | 1 | 51 | 8 | 30 | 13 | 3 | 0.42 | 1 | 8 | 3 | 0 | 2 | 2 | 2 | 3 | 105 | 17 | 62 | 25 | 48 | 26 | 26 | 15 | 23 | 5 | 2 | 1 | 6 |
1,665 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTIntermediate | from torch import nn
from .configuration_deit import DeiTConfig
import torch
from ...activations import ACT2FN
class DeiTIntermediate(nn.Module):
def __init__(self, config: DeiTConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(co... |
class DeiTIntermediate(nn.Module):
def __init__(self, config: DeiTConfig):
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,666 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTLayer | from .configuration_deit import DeiTConfig
from torch import nn
from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
import torch
class DeiTLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""
def __init__(se... |
class DeiTLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: DeiTConfig):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=None) -> torch.Tensor:
pass | 3 | 1 | 18 | 3 | 14 | 3 | 1 | 0.21 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 40 | 7 | 29 | 19 | 21 | 6 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
1,667 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTModel | from .configuration_deit import DeiTConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, MaskedImageModelingOutput
from torch import... | @auto_docstring
class DeiTModel(DeiTPreTrainedModel):
def __init__(self, config: DeiTConfig, add_pooling_layer: bool=True, use_mask_token: bool=False) -> None:
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
use_mask_token (`bool`, *o... | 8 | 3 | 20 | 3 | 14 | 4 | 4 | 0.23 | 1 | 10 | 6 | 0 | 4 | 5 | 4 | 5 | 93 | 13 | 65 | 27 | 43 | 15 | 33 | 17 | 28 | 9 | 2 | 1 | 14 |
1,668 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTOutput | from .configuration_deit import DeiTConfig
from torch import nn
import torch
class DeiTOutput(nn.Module):
def __init__(self, config: DeiTConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
... |
class DeiTOutput(nn.Module):
def __init__(self, config: DeiTConfig):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 13 | 3 | 10 | 5 | 7 | 0 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
1,669 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTPatchEmbeddings | import collections.abc
import torch
from torch import nn
class DeiTPatchEmbeddings(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 DeiTPatchEmbeddings(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 | 11 | 1 | 10 | 0 | 3 | 0.24 | 1 | 4 | 0 | 0 | 2 | 5 | 2 | 12 | 30 | 4 | 21 | 13 | 18 | 5 | 19 | 13 | 16 | 3 | 1 | 1 | 5 |
1,670 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTPooler | from .configuration_deit import DeiTConfig
from torch import nn
import torch
from ...activations import ACT2FN
class DeiTPooler(nn.Module):
def __init__(self, config: DeiTConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.pooler_output_size)
self.activation = ACT... |
class DeiTPooler(nn.Module):
def __init__(self, config: DeiTConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 1 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
1,671 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTPreTrainedModel | from .configuration_deit import DeiTConfig
from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging, torch_int
import torch
@auto_docstring
class DeiTPreTrainedM... | @auto_docstring
class DeiTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 13 | 0 | 10 | 3 | 4 | 0.41 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 26 | 2 | 17 | 8 | 15 | 7 | 14 | 8 | 12 | 4 | 1 | 2 | 4 |
1,672 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTSelfAttention | from .configuration_deit import DeiTConfig
from typing import Callable, Optional, Union
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
class DeiTSelfAttention(nn.Module):
def __init__(self, config: DeiTConfig):
super().__init__()
if config.... |
class DeiTSelfAttention(nn.Module):
def __init__(self, config: DeiTConfig):
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 |
1,673 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deit/modeling_deit.py | transformers.models.deit.modeling_deit.DeiTSelfOutput | from torch import nn
from .configuration_deit import DeiTConfig
import torch
class DeiTSelfOutput(nn.Module):
"""
The residual connection is defined in DeiTLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, config: DeiTC... |
class DeiTSelfOutput(nn.Module):
'''
The residual connection is defined in DeiTLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: DeiTConfig):
pass
def forward(self, hidden_states: torch.Tensor, inpu... | 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,674 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/configuration_deta.py | transformers.models.deprecated.deta.configuration_deta.DetaConfig | from ...auto import CONFIG_MAPPING
from ....configuration_utils import PretrainedConfig
class DetaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`DetaModel`]. It is used to instantiate a DETA
model according to the specified arguments, defining the model arch... |
class DetaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`DetaModel`]. It is used to instantiate a DETA
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar confi... | 8 | 1 | 39 | 1 | 36 | 1 | 3 | 0.95 | 1 | 4 | 0 | 0 | 3 | 41 | 3 | 35 | 243 | 15 | 117 | 97 | 65 | 111 | 65 | 49 | 61 | 7 | 2 | 2 | 9 |
1,675 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/image_processing_deta.py | transformers.models.deprecated.deta.image_processing_deta.DetaImageProcessor | from ....image_transforms import PaddingMode, center_to_corners_format, corners_to_center_format, pad, rescale, resize, rgb_to_id, to_channel_dimension_format
from typing import Any, Optional, Union
import pathlib
from ....image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, AnnotationFormat, AnnotationType,... |
class DetaImageProcessor(BaseImageProcessor):
'''
Constructs a Deformable DETR image processor.
Args:
format (`str`, *optional*, defaults to `"coco_detection"`):
Data format of the annotations. One of "coco_detection" or "coco_panoptic".
do_resize (`bool`, *optional*, defaults t... | 12 | 11 | 60 | 4 | 39 | 17 | 6 | 0.56 | 1 | 17 | 5 | 0 | 11 | 12 | 11 | 31 | 728 | 59 | 429 | 169 | 319 | 241 | 197 | 71 | 185 | 32 | 3 | 3 | 71 |
1,676 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaBackboneWithPositionalEncodings | import torch
import torch.nn.functional as F
from torch import Tensor, nn
from ....utils.backbone_utils import load_backbone
class DetaBackboneWithPositionalEncodings(nn.Module):
"""
Backbone model with positional embeddings.
nn.BatchNorm2d layers are replaced by DetaFrozenBatchNorm2d as defined above.
... |
class DetaBackboneWithPositionalEncodings(nn.Module):
'''
Backbone model with positional embeddings.
nn.BatchNorm2d layers are replaced by DetaFrozenBatchNorm2d as defined above.
'''
def __init__(self, config):
pass
def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.T... | 3 | 2 | 18 | 3 | 11 | 4 | 3 | 0.52 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 43 | 8 | 23 | 14 | 20 | 12 | 23 | 14 | 20 | 4 | 1 | 3 | 6 |
1,677 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaDecoder | import torch
import torch.nn.functional as F
from torch import Tensor, nn
from .configuration_deta import DetaConfig
class DetaDecoder(DetaPreTrainedModel):
"""
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`DetaDecoderLayer`].
The decoder updates the query embeddings ... |
class DetaDecoder(DetaPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`DetaDecoderLayer`].
The decoder updates the query embeddings through multiple self-attention and cross-attention layers.
Some tweaks for Deformable DETR:
- `position_embed... | 3 | 2 | 84 | 9 | 57 | 19 | 11 | 0.4 | 1 | 8 | 3 | 0 | 2 | 5 | 2 | 132 | 184 | 23 | 115 | 32 | 99 | 46 | 56 | 19 | 53 | 20 | 3 | 4 | 21 |
1,678 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaDecoderLayer | from ....activations import ACT2FN
import torch
from .configuration_deta import DetaConfig
from typing import Optional, Union
from torch import Tensor, nn
import torch.nn.functional as F
from ....modeling_layers import GradientCheckpointingLayer
class DetaDecoderLayer(GradientCheckpointingLayer):
def __init__(sel... |
class DetaDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: DetaConfig):
pass
def forward(self, hidden_states: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, reference_points=None, spatial_shapes=None, level_start_index=None, encoder_hidden_states: Optional[torch.T... | 3 | 1 | 54 | 6 | 34 | 14 | 2 | 0.39 | 1 | 6 | 3 | 0 | 2 | 11 | 2 | 12 | 109 | 13 | 69 | 29 | 56 | 27 | 37 | 19 | 34 | 2 | 1 | 1 | 3 |
1,679 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaDecoderOutput | import torch
from typing import Optional, Union
from dataclasses import dataclass
from ....file_utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, is_scipy_available, is_torch_cuda_available, is_vision_available, replace_return_docstrings
import torch.nn.functional as F
@dataclass
c... | @dataclass
class DetaDecoderOutput(ModelOutput):
'''
Base class for outputs of the DetaDecoder. This class adds two attributes to
BaseModelOutputWithCrossAttentions, namely:
- a stacked tensor of intermediate decoder hidden states (i.e. the output of each decoder layer)
- a stacked tensor of interme... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 3.57 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 2 | 7 | 7 | 6 | 25 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
1,680 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaEncoder | from torch import Tensor, nn
from ....modeling_outputs import BaseModelOutput
import torch.nn.functional as F
import torch
from .configuration_deta import DetaConfig
from ....pytorch_utils import meshgrid
class DetaEncoder(DetaPreTrainedModel):
"""
Transformer encoder consisting of *config.encoder_layers* defo... |
class DetaEncoder(DetaPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* deformable attention layers. Each layer is a
[`DetaEncoderLayer`].
The encoder updates the flattened multi-scale feature maps through multiple deformable attention layers.
Args:
config: Det... | 5 | 3 | 38 | 3 | 22 | 13 | 5 | 0.7 | 1 | 7 | 3 | 0 | 2 | 3 | 3 | 133 | 129 | 15 | 67 | 30 | 51 | 47 | 39 | 18 | 35 | 11 | 3 | 2 | 14 |
1,681 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaEncoderLayer | from ....activations import ACT2FN
import torch
from .configuration_deta import DetaConfig
from typing import Optional, Union
from torch import Tensor, nn
import torch.nn.functional as F
class DetaEncoderLayer(nn.Module):
def __init__(self, config: DetaConfig):
super().__init__()
self.embed_dim = ... |
class DetaEncoderLayer(nn.Module):
def __init__(self, config: DetaConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, reference_points=None, spatial_shapes=None, level_start_index=None, output_attentions: bool=Fa... | 3 | 1 | 42 | 5 | 28 | 10 | 3 | 0.34 | 1 | 5 | 2 | 0 | 2 | 9 | 2 | 12 | 85 | 10 | 56 | 25 | 44 | 19 | 33 | 16 | 30 | 4 | 1 | 2 | 5 |
1,682 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaForObjectDetection | from torch import Tensor, nn
from ....file_utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, is_scipy_available, is_torch_cuda_available, is_vision_available, replace_return_docstrings
import torch.nn.functional as F
import torch
import math
from .configuration_deta import DetaConfi... | @add_start_docstrings('\n DETA Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks\n such as COCO detection.\n ', DETA_START_DOCSTRING)
class DetaForObjectDetection(DetaPreTrainedModel):
def __init__(self, config: DetaConfig):
pass
@to... | 8 | 1 | 76 | 8 | 51 | 17 | 8 | 0.33 | 1 | 12 | 6 | 0 | 3 | 3 | 3 | 133 | 239 | 26 | 160 | 55 | 141 | 53 | 92 | 40 | 88 | 17 | 3 | 3 | 23 |
1,683 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaFrozenBatchNorm2d | import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DetaFrozenBatchNorm2d(nn.Module):
"""
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
torchv... |
class DetaFrozenBatchNorm2d(nn.Module):
'''
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
torchvision.models.resnet[18,34,50,101] produce nans.
'''
def __init__(s... | 4 | 1 | 9 | 0 | 8 | 1 | 1 | 0.28 | 1 | 1 | 0 | 0 | 3 | 0 | 3 | 13 | 37 | 5 | 25 | 13 | 19 | 7 | 21 | 11 | 17 | 2 | 1 | 1 | 4 |
1,684 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaHungarianMatcher | import torch
import torch.nn.functional as F
from ....utils import is_accelerate_available, is_ninja_available, is_torchvision_available, logging, requires_backends
from torch import Tensor, nn
class DetaHungarianMatcher(nn.Module):
"""
This class computes an assignment between the targets and the predictions ... |
class DetaHungarianMatcher(nn.Module):
'''
This class computes an assignment between the targets and the predictions of the network.
For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more
predictions than targets. In this case, we do a 1-to-1 matchi... | 4 | 2 | 30 | 5 | 13 | 13 | 2 | 1.39 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 78 | 13 | 28 | 22 | 24 | 39 | 27 | 21 | 24 | 2 | 1 | 1 | 3 |
1,685 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaLearnedPositionEmbedding | import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DetaLearnedPositionEmbedding(nn.Module):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, embedding_dim=256):
super().__init__()
self.row_embeddings = nn.Embed... |
class DetaLearnedPositionEmbedding(nn.Module):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, embedding_dim=256):
pass
def forward(self, pixel_values, pixel_mask=None):
pass | 3 | 1 | 8 | 0 | 8 | 0 | 1 | 0.19 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 21 | 2 | 16 | 11 | 13 | 3 | 16 | 11 | 13 | 1 | 1 | 0 | 2 |
1,686 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaLoss | import torch
from ....utils import is_accelerate_available, is_ninja_available, is_torchvision_available, logging, requires_backends
import copy
from torch import Tensor, nn
import torch.nn.functional as F
class DetaLoss(nn.Module):
"""
This class computes the losses for `DetaForObjectDetection`. The process h... |
class DetaLoss(nn.Module):
'''
This class computes the losses for `DetaForObjectDetection`. The process happens in two steps: 1) we compute
hungarian assignment between ground truth boxes and the outputs of the model 2) we supervise each pair of matched
ground-truth / prediction (supervised class and b... | 10 | 5 | 21 | 2 | 15 | 4 | 3 | 0.35 | 1 | 9 | 2 | 0 | 8 | 8 | 8 | 18 | 195 | 26 | 125 | 62 | 106 | 44 | 97 | 52 | 88 | 13 | 1 | 3 | 25 |
1,687 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaMLPPredictionHead | from torch import Tensor, nn
class DetaMLPPredictionHead(nn.Module):
"""
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blob/master/mo... |
class DetaMLPPredictionHead(nn.Module):
'''
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blob/master/models/detr.py
'''
def ... | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.5 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 4 | 10 | 7 | 7 | 5 | 10 | 7 | 7 | 3 | 1 | 1 | 4 |
1,688 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaMatcher | import torch
import torch.nn.functional as F
class DetaMatcher:
"""
This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will
have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements.
The matchi... |
class DetaMatcher:
'''
This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will
have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements.
The matching is determined by the MxN match_quality_matr... | 4 | 4 | 31 | 3 | 12 | 16 | 3 | 1.51 | 0 | 5 | 0 | 0 | 3 | 3 | 3 | 3 | 107 | 14 | 37 | 15 | 33 | 56 | 35 | 15 | 31 | 5 | 0 | 1 | 10 |
1,689 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaModel | from torch import Tensor, nn
from ....modeling_outputs import BaseModelOutput
from ....file_utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, is_scipy_available, is_torch_cuda_available, is_vision_available, replace_return_docstrings
import torch.nn.functional as F
from ....pytorch_... | @add_start_docstrings('\n The bare DETA Model (consisting of a backbone and encoder-decoder Transformer) outputting raw hidden-states without\n any specific head on top.\n ', DETA_START_DOCSTRING)
class DetaModel(DetaPreTrainedModel):
def __init__(self, config: DetaConfig):
pass
def get_encod... | 12 | 4 | 44 | 6 | 32 | 7 | 4 | 0.2 | 1 | 14 | 6 | 0 | 9 | 15 | 9 | 139 | 409 | 58 | 294 | 122 | 271 | 60 | 198 | 110 | 188 | 23 | 3 | 4 | 40 |
1,690 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaModelOutput | from dataclasses import dataclass
from ....file_utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, is_scipy_available, is_torch_cuda_available, is_vision_available, replace_return_docstrings
import torch.nn.functional as F
import torch
from typing import Optional, Union
@dataclass
c... | @dataclass
class DetaModelOutput(ModelOutput):
'''
Base class for outputs of the Deformable DETR encoder-decoder model.
Args:
init_reference_points (`torch.FloatTensor` of shape `(batch_size, num_queries, 4)`):
Initial reference points sent through the Transformer decoder.
last_... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 58 | 2 | 14 | 14 | 13 | 42 | 14 | 14 | 13 | 0 | 1 | 0 | 0 |
1,691 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaMultiheadAttention | import torch
from ....modeling_attn_mask_utils import _prepare_4d_attention_mask
from typing import Optional, Union
from torch import Tensor, nn
import torch.nn.functional as F
class DetaMultiheadAttention(nn.Module):
"""
Multi-headed attention from 'Attention Is All You Need' paper.
Here, we add position... |
class DetaMultiheadAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper.
Here, we add position embeddings to the queries and keys (as explained in the Deformable DETR paper).
'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, bias: bool=Tr... | 5 | 2 | 26 | 4 | 20 | 2 | 3 | 0.16 | 1 | 6 | 0 | 0 | 4 | 9 | 4 | 14 | 115 | 22 | 80 | 37 | 63 | 13 | 55 | 25 | 50 | 8 | 1 | 2 | 13 |
1,692 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaMultiscaleDeformableAttention | import torch
from ....utils import is_accelerate_available, is_ninja_available, is_torchvision_available, logging, requires_backends
import math
from .configuration_deta import DetaConfig
from typing import Optional, Union
from torch import Tensor, nn
from ....file_utils import ModelOutput, add_start_docstrings, add_st... |
class DetaMultiscaleDeformableAttention(nn.Module):
'''
Multiscale deformable attention as proposed in Deformable DETR.
'''
def __init__(self, config: DetaConfig, num_heads: int, n_points: int):
pass
def _reset_parameters(self):
pass
def with_pos_embed(self, tensor: torch... | 5 | 1 | 33 | 3 | 29 | 2 | 4 | 0.09 | 1 | 10 | 2 | 0 | 4 | 10 | 4 | 14 | 141 | 15 | 116 | 42 | 100 | 10 | 71 | 30 | 66 | 8 | 1 | 2 | 17 |
1,693 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaObjectDetectionOutput | from dataclasses import dataclass
from ....file_utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, is_scipy_available, is_torch_cuda_available, is_vision_available, replace_return_docstrings
import torch.nn.functional as F
import torch
from typing import Optional, Union
@dataclass
c... | @dataclass
class DetaObjectDetectionOutput(ModelOutput):
'''
Output type of [`DetaForObjectDetection`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likehood (cross-entropy) for cl... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 3.11 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 80 | 2 | 19 | 19 | 18 | 59 | 19 | 19 | 18 | 0 | 1 | 0 | 0 |
1,694 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaPreTrainedModel | from ....modeling_utils import PreTrainedModel
from .configuration_deta import DetaConfig
from torch import Tensor, nn
class DetaPreTrainedModel(PreTrainedModel):
config: DetaConfig
base_model_prefix = 'model'
main_input_name = 'pixel_values'
_no_split_modules = ['DetaBackboneWithPositionalEncodings', ... |
class DetaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 2 | 0 | 23 | 1 | 20 | 2 | 9 | 0.08 | 1 | 2 | 2 | 4 | 1 | 0 | 1 | 130 | 30 | 2 | 26 | 8 | 24 | 2 | 23 | 8 | 21 | 9 | 2 | 2 | 9 |
1,695 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaSinePositionEmbedding | import math
import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DetaSinePositionEmbedding(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.
"""
d... |
class DetaSinePositionEmbedding(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 | 15 | 1 | 14 | 0 | 3 | 0.14 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 36 | 4 | 28 | 14 | 25 | 4 | 28 | 14 | 25 | 3 | 1 | 1 | 6 |
1,696 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaStage1Assigner | import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DetaStage1Assigner(nn.Module):
def __init__(self, t_low=0.3, t_high=0.7, max_k=4):
super().__init__()
self.positive_fraction = 0.5
self.batch_size_per_image = 256
self.k = max_k
self.t_low = t_l... |
class DetaStage1Assigner(nn.Module):
def __init__(self, t_low=0.3, t_high=0.7, max_k=4):
pass
def _subsample_labels(self, label):
'''
Randomly sample a subset of positive and negative examples, and overwrite the label vector to the ignore value
(-1) for all elements that are n... | 5 | 1 | 14 | 1 | 12 | 2 | 2 | 0.17 | 1 | 3 | 1 | 0 | 4 | 6 | 4 | 14 | 59 | 5 | 47 | 21 | 42 | 8 | 35 | 21 | 30 | 3 | 1 | 2 | 6 |
1,697 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.DetaStage2Assigner | import torch
import torch.nn.functional as F
from torch import Tensor, nn
class DetaStage2Assigner(nn.Module):
def __init__(self, num_queries, max_k=4):
super().__init__()
self.positive_fraction = 0.25
self.bg_label = 400
self.batch_size_per_image = num_queries
self.proposa... |
class DetaStage2Assigner(nn.Module):
def __init__(self, num_queries, max_k=4):
pass
def _sample_proposals(self, matched_idxs: torch.Tensor, matched_labels: torch.Tensor, gt_classes: torch.Tensor):
'''
Based on the matching between N proposals and M groundtruth, sample the proposals an... | 5 | 1 | 18 | 1 | 12 | 6 | 2 | 0.45 | 1 | 4 | 1 | 0 | 4 | 5 | 4 | 14 | 76 | 8 | 49 | 23 | 44 | 22 | 36 | 22 | 31 | 3 | 1 | 1 | 7 |
1,698 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/deta/modeling_deta.py | transformers.models.deprecated.deta.modeling_deta.MultiScaleDeformableAttentionFunction | from torch.autograd import Function
from torch.autograd.function import once_differentiable
class MultiScaleDeformableAttentionFunction(Function):
@staticmethod
def forward(context, value, value_spatial_shapes, value_level_start_index, sampling_locations, attention_weights, im2col_step):
context.im2co... |
class MultiScaleDeformableAttentionFunction(Function):
@staticmethod
def forward(context, value, value_spatial_shapes, value_level_start_index, sampling_locations, attention_weights, im2col_step):
pass
@staticmethod
@once_differentiable
def backward(context, grad_output):
pass | 6 | 0 | 21 | 1 | 20 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | 46 | 2 | 44 | 20 | 30 | 0 | 10 | 6 | 7 | 1 | 1 | 0 | 2 |
1,699 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/deprecated/efficientformer/configuration_efficientformer.py | transformers.models.deprecated.efficientformer.configuration_efficientformer.EfficientFormerConfig | from ....configuration_utils import PretrainedConfig
class EfficientFormerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`EfficientFormerModel`]. It is used to
instantiate an EfficientFormer model according to the specified arguments, defining the model arch... |
class EfficientFormerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`EfficientFormerModel`]. It is used to
instantiate an EfficientFormer model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the ... | 2 | 1 | 60 | 1 | 59 | 0 | 1 | 1.16 | 1 | 5 | 0 | 0 | 1 | 27 | 1 | 33 | 142 | 10 | 61 | 60 | 29 | 71 | 31 | 30 | 29 | 1 | 2 | 0 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.