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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,300 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Callable, Optional, Union
import torch
from .configuration_yolos import YolosConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
from ...utils.generic import can_return_tuple, check_model_inpu... | @auto_docstring
class YolosModel(YolosPreTrainedModel):
def __init__(self, config: YolosConfig, add_pooling_layer: bool=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(self) -> Yol... | 8 | 2 | 19 | 3 | 13 | 3 | 3 | 0.22 | 1 | 11 | 6 | 0 | 4 | 5 | 4 | 5 | 86 | 13 | 60 | 24 | 40 | 13 | 30 | 16 | 25 | 8 | 2 | 1 | 13 |
6,301 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosObjectDetectionOutput | import torch
from typing import Callable, Optional, Union
from dataclasses import dataclass
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n Output type of [`YolosForObjectDetection`].\n ')
class YolosObjectDetectionOutput(ModelOutput):
... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`YolosForObjectDetection`].\n ')
class YolosObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likehoo... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.44 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 42 | 2 | 9 | 9 | 8 | 31 | 9 | 9 | 8 | 0 | 1 | 0 | 0 |
6,302 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosOutput | from .configuration_yolos import YolosConfig
import torch
from torch import nn
class YolosOutput(nn.Module):
def __init__(self, config: YolosConfig):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob... |
class YolosOutput(nn.Module):
def __init__(self, config: YolosConfig):
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 |
6,303 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosPatchEmbeddings | import collections.abc
import torch
from torch import nn
class YolosPatchEmbeddings(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 YolosPatchEmbeddings(nn.Module):
'''
This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial
`hidden_states` (patch embeddings) of shape `(batch_size, seq_length, hidden_size)` to be consumed by a
Transformer.
'''
def __init__(self, config):
... | 3 | 1 | 12 | 2 | 10 | 0 | 3 | 0.24 | 1 | 4 | 0 | 0 | 2 | 5 | 2 | 12 | 31 | 5 | 21 | 13 | 18 | 5 | 19 | 13 | 16 | 3 | 1 | 1 | 5 |
6,304 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosPooler | import torch
from torch import nn
from .configuration_yolos import YolosConfig
class YolosPooler(nn.Module):
def __init__(self, config: YolosConfig):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_... |
class YolosPooler(nn.Module):
def __init__(self, config: YolosConfig):
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 |
6,305 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosPreTrainedModel | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, logging
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_yolos import YolosConfig
from typing import Callable, Optional, Union
@auto_docstring
class YolosPreTrainedModel(PreTrainedModel)... | @auto_docstring
class YolosPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.47 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 24 | 2 | 15 | 8 | 13 | 7 | 14 | 8 | 12 | 4 | 1 | 2 | 4 |
6,306 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosSelfAttention | from .configuration_yolos import YolosConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
from typing import Callable, Optional, Union
import torch
class YolosSelfAttention(nn.Module):
def __init__(self, config: YolosConfig):
super().__init__()
if con... |
class YolosSelfAttention(nn.Module):
def __init__(self, config: YolosConfig):
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 |
6,307 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yolos/modeling_yolos.py | transformers.models.yolos.modeling_yolos.YolosSelfOutput | from torch import nn
from .configuration_yolos import YolosConfig
import torch
class YolosSelfOutput(nn.Module):
"""
The residual connection is defined in YolosLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
"""
def __init__(self, config: Y... |
class YolosSelfOutput(nn.Module):
'''
The residual connection is defined in YolosLayer instead of here (as is the case with other models), due to the
layernorm applied before each block.
'''
def __init__(self, config: YolosConfig):
pass
def forward(self, hidden_states: torch.Tensor, i... | 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 |
6,308 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/configuration_yoso.py | transformers.models.yoso.configuration_yoso.YosoConfig | from ...configuration_utils import PretrainedConfig
class YosoConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`YosoModel`]. It is used to instantiate an YOSO
model according to the specified arguments, defining the model architecture. Instantiating a configura... |
class YosoConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`YosoModel`]. It is used to instantiate an YOSO
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar conf... | 2 | 1 | 47 | 1 | 46 | 0 | 1 | 1.23 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 118 | 11 | 48 | 47 | 21 | 59 | 23 | 22 | 21 | 1 | 1 | 0 | 1 |
6,309 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoAttention | from torch import nn
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class YosoAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
super().__init__()
self.self = YosoSelfAttention(config, position_embedding_ty... |
class YosoAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False):
pass | 4 | 0 | 9 | 1 | 8 | 1 | 1 | 0.13 | 1 | 4 | 2 | 0 | 3 | 3 | 3 | 13 | 30 | 4 | 24 | 11 | 20 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
6,310 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoClassificationHead | from ...activations import ACT2FN
from torch import nn
class YosoClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.dropout = nn.Dropout(co... |
class YosoClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 8 | 1 | 7 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 19 | 3 | 15 | 8 | 12 | 2 | 15 | 8 | 12 | 1 | 1 | 0 | 2 |
6,311 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoCumulation | import math
import torch
class YosoCumulation(torch.autograd.Function):
@staticmethod
def forward(ctx, query_mask, key_mask, query, key, value, config):
hash_code_len = config['hash_code_len']
expectation = (1 - torch.acos(torch.matmul(query, key.transpose(-1, -2))) / math.pi) ** hash_code_len... |
class YosoCumulation(torch.autograd.Function):
@staticmethod
def forward(ctx, query_mask, key_mask, query, key, value, config):
pass
@staticmethod
def backward(ctx, grad):
pass | 5 | 0 | 13 | 4 | 9 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 32 | 29 | 8 | 21 | 15 | 16 | 0 | 19 | 13 | 16 | 1 | 5 | 0 | 2 |
6,312 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoEmbeddings | from torch import nn
import torch
class YosoEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_toke... |
class YosoEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None):
pass | 3 | 1 | 27 | 4 | 21 | 3 | 4 | 0.17 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 58 | 9 | 42 | 16 | 39 | 7 | 34 | 16 | 31 | 7 | 1 | 2 | 8 |
6,313 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoEncoder | from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
class YosoEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config... |
class YosoEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True):
pass | 3 | 0 | 23 | 3 | 20 | 0 | 5 | 0 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 47 | 6 | 41 | 18 | 30 | 0 | 23 | 10 | 20 | 9 | 1 | 2 | 10 |
6,314 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoForMaskedLM | import torch
from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch.nn import BCEWith... | @auto_docstring
class YosoForMaskedLM(YosoPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask... | 7 | 1 | 16 | 2 | 13 | 2 | 2 | 0.14 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 76 | 11 | 58 | 27 | 35 | 8 | 25 | 14 | 20 | 5 | 2 | 1 | 8 |
6,315 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoForMultipleChoice | from torch import nn
from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torch
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleCho... | @auto_docstring
class YosoForMultipleChoice(YosoPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]... | 5 | 1 | 38 | 5 | 30 | 6 | 6 | 0.16 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 84 | 10 | 67 | 28 | 46 | 11 | 30 | 15 | 27 | 11 | 2 | 1 | 12 |
6,316 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoForQuestionAnswering | from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from torch import nn
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutpu... | @auto_docstring
class YosoForQuestionAnswering(YosoPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tens... | 5 | 0 | 42 | 5 | 31 | 7 | 4 | 0.19 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 92 | 11 | 68 | 30 | 46 | 13 | 33 | 16 | 30 | 7 | 2 | 2 | 8 |
6,317 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoForSequenceClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
import torch
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, Quest... | @auto_docstring(custom_intro='\n YOSO Model transformer with a sequence classification/regression head on top (a linear layer on top of\n the pooled output) e.g. for GLUE tasks.\n ')
class YosoForSequenceClassification(YosoPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
... | 5 | 1 | 38 | 3 | 32 | 4 | 7 | 0.1 | 1 | 7 | 3 | 0 | 2 | 3 | 2 | 3 | 84 | 7 | 70 | 25 | 49 | 7 | 32 | 12 | 29 | 12 | 2 | 3 | 13 |
6,318 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoForTokenClassification | from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, Se... | @auto_docstring
class YosoForTokenClassification(YosoPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Te... | 5 | 1 | 35 | 4 | 28 | 3 | 4 | 0.1 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 78 | 9 | 63 | 29 | 42 | 6 | 27 | 16 | 24 | 6 | 2 | 2 | 7 |
6,319 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoIntermediate | from ...activations import ACT2FN
from torch import nn
import torch
class YosoIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.intermediate_ac... |
class YosoIntermediate(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 |
6,320 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoLMPredictionHead | import torch
from torch import nn
class YosoLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = YosoPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.bias = nn.Parameter(torch.ze... |
class YosoLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def _tie_weights(self):
pass
def forward(self, hidden_states):
pass | 4 | 0 | 6 | 1 | 4 | 1 | 1 | 0.23 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 21 | 5 | 13 | 7 | 9 | 3 | 13 | 7 | 9 | 1 | 1 | 0 | 3 |
6,321 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoLSHCumulation | import math
import torch
class YosoLSHCumulation(torch.autograd.Function):
@staticmethod
def forward(ctx, query_mask, key_mask, query, key, value, config):
if query_mask.size(0) != key_mask.size(0):
raise ValueError('Query mask and Key mask differ in sizes in dimension 0')
if query... |
class YosoLSHCumulation(torch.autograd.Function):
@staticmethod
def forward(ctx, query_mask, key_mask, query, key, value, config):
pass
@staticmethod
def backward(ctx, grad):
pass | 5 | 0 | 42 | 5 | 37 | 0 | 5 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 2 | 32 | 87 | 11 | 76 | 21 | 71 | 0 | 44 | 19 | 41 | 8 | 5 | 1 | 10 |
6,322 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoLayer | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...modeling_layers import GradientCheckpointingLayer
class YosoLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.chunk_size_feed_forward = config.c... |
class YosoLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False):
pass
def feed_forward_chunk(self, attention_output):
pass | 4 | 0 | 8 | 1 | 7 | 0 | 1 | 0.05 | 1 | 4 | 3 | 0 | 3 | 6 | 3 | 13 | 27 | 5 | 22 | 16 | 18 | 1 | 20 | 16 | 16 | 1 | 1 | 0 | 3 |
6,323 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoModel | import torch
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
from typing import Optional,... | @auto_docstring
class YosoModel(YosoPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prune: dict ... | 8 | 1 | 19 | 2 | 15 | 2 | 3 | 0.12 | 1 | 7 | 3 | 0 | 5 | 3 | 5 | 6 | 105 | 14 | 81 | 30 | 58 | 10 | 41 | 18 | 35 | 12 | 2 | 2 | 17 |
6,324 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoOnlyMLMHead | import torch
from torch import nn
class YosoOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = YosoLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predictions(sequence_output)
... |
class YosoOnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
6,325 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoOutput | import torch
from torch import nn
class YosoOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(... |
class YosoOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
6,326 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoPreTrainedModel | from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
from .configuration_yoso import YosoConfig
from torch import nn
@auto_docstring
class YosoPreTrainedModel(PreTrainedModel):
config: YosoConfig
base_model_prefix = 'yoso'
s... | @auto_docstring
class YosoPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.44 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 25 | 2 | 16 | 5 | 14 | 7 | 14 | 5 | 12 | 6 | 1 | 2 | 6 |
6,327 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoPredictionHeadTransform | from torch import nn
import torch
from ...activations import ACT2FN
class YosoPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
if isinstance(config.hidden_act, str):
self.transform_... |
class YosoPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
6,328 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoSelfAttention | from ...utils import auto_docstring, is_ninja_available, is_torch_cuda_available, logging
from torch import nn
import torch
class YosoSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and (... |
class YosoSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False):
pass | 3 | 0 | 45 | 8 | 37 | 1 | 5 | 0.02 | 1 | 6 | 2 | 0 | 3 | 16 | 3 | 13 | 139 | 25 | 112 | 34 | 108 | 2 | 67 | 33 | 63 | 8 | 1 | 2 | 15 |
6,329 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/yoso/modeling_yoso.py | transformers.models.yoso.modeling_yoso.YosoSelfOutput | import torch
from torch import nn
class YosoSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(co... |
class YosoSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
6,330 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/configuration_zamba.py | transformers.models.zamba.configuration_zamba.ZambaConfig | import math
from ...configuration_utils import PretrainedConfig
class ZambaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ZambaModel`]. It is used to instantiate a
Zamba model according to the specified arguments, defining the model architecture. Instantiati... |
class ZambaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ZambaModel`]. It is used to instantiate a
Zamba model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar co... | 3 | 1 | 49 | 4 | 46 | 0 | 3 | 0.96 | 1 | 2 | 0 | 0 | 2 | 31 | 2 | 2 | 199 | 15 | 94 | 73 | 55 | 90 | 44 | 37 | 41 | 4 | 1 | 1 | 6 |
6,331 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaAttention | from typing import Any, Callable, Optional, Union
from ...processing_utils import Unpack
from ...utils.deprecation import deprecate_kwarg
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from torch import nn
import torch
from .conf... |
class ZambaAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
and "Generating Long Sequences with Sparse Transformers".
Adapted from transformers.models.mistral.modeling_mistral.MistralAttention:
The input di... | 4 | 1 | 30 | 4 | 26 | 0 | 3 | 0.21 | 1 | 6 | 3 | 1 | 2 | 13 | 2 | 12 | 74 | 10 | 53 | 30 | 43 | 11 | 33 | 23 | 30 | 5 | 1 | 2 | 6 |
6,332 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaAttentionDecoderLayer | from ...utils.deprecation import deprecate_kwarg
from .configuration_zamba import ZambaConfig
from typing import Any, Callable, Optional, Union
from torch import nn
import torch
from ...processing_utils import Unpack
from ...modeling_flash_attention_utils import FlashAttentionKwargs
class ZambaAttentionDecoderLayer(nn... |
class ZambaAttentionDecoderLayer(nn.Module):
def __init__(self, config: ZambaConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, original_hidden_states: torch.Tensor, layer_idx: i... | 4 | 1 | 30 | 2 | 17 | 11 | 2 | 0.6 | 1 | 10 | 6 | 1 | 2 | 4 | 2 | 12 | 61 | 5 | 35 | 19 | 22 | 21 | 17 | 9 | 14 | 2 | 1 | 1 | 3 |
6,333 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaForCausalLM | from ...utils import auto_docstring, logging
from typing import Any, Callable, Optional, Union
from torch import nn
import torch
from .configuration_zamba import ZambaConfig
from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutpu... |
class ZambaForCausalLM(ZambaPreTrainedModel, GenerationMixin):
def __init__(self, config: ZambaConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Op... | 5 | 1 | 19 | 2 | 12 | 5 | 2 | 0.35 | 2 | 9 | 4 | 1 | 9 | 6 | 9 | 11 | 181 | 28 | 116 | 49 | 78 | 41 | 52 | 22 | 42 | 8 | 2 | 2 | 22 |
6,334 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaForSequenceClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Any, Callable, Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
from ...utils import auto_docstring, logging
import torch
from ...cac... | null | 5 | 1 | 26 | 2 | 22 | 2 | 5 | 0.09 | 1 | 8 | 3 | 1 | 4 | 4 | 4 | 6 | 110 | 11 | 91 | 33 | 73 | 8 | 51 | 20 | 46 | 16 | 2 | 3 | 19 |
6,335 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaHybridDynamicCache | import torch
from typing import Any, Callable, Optional, Union
class ZambaHybridDynamicCache:
"""
A dynamic cache that can handle both the attention cache (which has a seq_len dimension) and the mamba cache
(which has a constant shape regardless of seq_len).
This cache has two sets of lists of tensors... | null | 7 | 3 | 12 | 1 | 10 | 1 | 2 | 0.3 | 1 | 6 | 0 | 1 | 5 | 15 | 6 | 37 | 92 | 10 | 64 | 33 | 50 | 19 | 49 | 26 | 42 | 3 | 3 | 2 | 12 |
6,336 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaHybridLayer | import torch
from ...utils.deprecation import deprecate_kwarg
from typing import Any, Callable, Optional, Union
from torch import nn
class ZambaHybridLayer(nn.Module):
def __init__(self, shared_transf: ZambaAttentionDecoderLayer, linear: nn.Linear, mamba: ZambaMambaDecoderLayer):
super().__init__()
... |
class ZambaHybridLayer(nn.Module):
def __init__(self, shared_transf: ZambaAttentionDecoderLayer, linear: nn.Linear, mamba: ZambaMambaDecoderLayer):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, original_hidden_sta... | 4 | 1 | 34 | 4 | 22 | 9 | 2 | 0.41 | 1 | 7 | 3 | 1 | 2 | 3 | 2 | 12 | 70 | 8 | 44 | 20 | 30 | 18 | 16 | 9 | 13 | 3 | 1 | 1 | 4 |
6,337 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaMLP | from torch import nn
from ...activations import ACT2FN
class ZambaMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.hidd... |
class ZambaMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
6,338 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaMambaDecoderLayer | from ...utils.deprecation import deprecate_kwarg
from .configuration_zamba import ZambaConfig
from torch import nn
from typing import Any, Callable, Optional, Union
import torch
class ZambaMambaDecoderLayer(nn.Module):
def __init__(self, config: ZambaConfig, layer_idx: int):
super().__init__()
sel... |
class ZambaMambaDecoderLayer(nn.Module):
def __init__(self, config: ZambaConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, original_hidden_states: Optional[torch.Tensor]=None, layer_idx: Optio... | 4 | 1 | 32 | 5 | 19 | 9 | 3 | 0.47 | 1 | 8 | 4 | 1 | 2 | 3 | 2 | 12 | 66 | 10 | 38 | 22 | 22 | 18 | 19 | 9 | 16 | 4 | 1 | 1 | 5 |
6,339 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaMambaMixer | from .configuration_zamba import ZambaConfig
from torch import nn
import torch
from ...activations import ACT2FN
class ZambaMambaMixer(nn.Module):
"""
Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`.
A, D are input independent (see Mamba paper [1] Section 3.5.2 ... |
class ZambaMambaMixer(nn.Module):
'''
Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`.
A, D are input independent (see Mamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective)
∆, B, C are input-dependent (this is a key difference betwee... | 5 | 1 | 65 | 7 | 53 | 5 | 7 | 0.14 | 1 | 6 | 2 | 0 | 4 | 22 | 4 | 14 | 276 | 32 | 214 | 65 | 207 | 31 | 132 | 63 | 127 | 11 | 1 | 3 | 26 |
6,340 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaModel | from ...modeling_attn_mask_utils import AttentionMaskConverter
from .configuration_zamba import ZambaConfig
from torch import nn
from typing import Any, Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
import torch
from ...utils ... | @auto_docstring
class ZambaModel(ZambaPreTrainedModel):
'''
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`ZambaDecoderLayer`]
Args:
config: ZambaConfig
'''
def __init__(self, config: ZambaConfig):
pass
@auto_docstring
def forward(self... | 6 | 1 | 38 | 5 | 32 | 2 | 7 | 0.09 | 1 | 14 | 8 | 1 | 5 | 9 | 5 | 7 | 206 | 30 | 163 | 51 | 144 | 14 | 98 | 38 | 92 | 22 | 2 | 3 | 37 |
6,341 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from ...utils import auto_docstring, logging
from torch import nn
from .configuration_zamba import ZambaConfig
import math
@auto_docstring
class ZambaPreTrainedModel(PreTrainedModel):
config: ZambaConfig
base_model_prefix = 'mo... | @auto_docstring
class ZambaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 26 | 3 | 20 | 3 | 4 | 0.13 | 1 | 5 | 1 | 3 | 1 | 0 | 2 | 2 | 65 | 7 | 52 | 25 | 40 | 7 | 35 | 17 | 32 | 6 | 1 | 2 | 8 |
6,342 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba/modeling_zamba.py | transformers.models.zamba.modeling_zamba.ZambaRMSNorm | import torch
from torch import nn
class ZambaRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
ZambaRMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps
def... |
class ZambaRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
ZambaRMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 4 | 1 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 1 | 3 | 2 | 3 | 13 | 18 | 2 | 13 | 8 | 9 | 3 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
6,343 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/configuration_zamba2.py | transformers.models.zamba2.configuration_zamba2.Zamba2Config | from ...configuration_utils import PretrainedConfig
class Zamba2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Zamba2Model`]. It is used to instantiate a
Zamba2 model according to the specified arguments, defining the model architecture. Instantiating a conf... |
class Zamba2Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Zamba2Model`]. It is used to instantiate a
Zamba2 model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar... | 2 | 1 | 108 | 0 | 107 | 1 | 6 | 0.89 | 1 | 3 | 0 | 0 | 1 | 39 | 1 | 1 | 212 | 4 | 110 | 83 | 69 | 98 | 56 | 44 | 54 | 6 | 1 | 1 | 6 |
6,344 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2Attention | from ...utils.deprecation import deprecate_kwarg
import torch
from ...processing_utils import Unpack
from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, ... |
class Zamba2Attention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper.
Adapted from transformers.models.mistral.modeling_mistral.MistralAttention:
The input dimension here is attention_hidden_size = 2 * hidden_size, and head_dim = attention_hidden_size // num_heads.
Th... | 4 | 1 | 56 | 6 | 50 | 0 | 6 | 0.22 | 1 | 8 | 3 | 0 | 2 | 20 | 2 | 12 | 139 | 17 | 100 | 50 | 83 | 22 | 63 | 36 | 60 | 7 | 1 | 3 | 11 |
6,345 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2AttentionDecoderLayer | from ...processing_utils import Unpack
from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from torch import nn
from ...utils.deprecation import deprecate_kwarg
import torch
class Zamba2AttentionDecoderLayer... |
class Zamba2AttentionDecoderLayer(nn.Module):
def __init__(self, config: Zamba2Config, block_id: Optional[int]=None, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, original_hidden_st... | 4 | 1 | 30 | 2 | 18 | 10 | 2 | 0.54 | 1 | 10 | 6 | 0 | 2 | 5 | 2 | 12 | 62 | 5 | 37 | 21 | 24 | 20 | 19 | 11 | 16 | 2 | 1 | 1 | 3 |
6,346 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2ForCausalLM | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
from torch import nn
from ...generation import GenerationMixin
import torch
from ...utils import auto_docstri... |
class Zamba2ForCausalLM(Zamba2PreTrainedModel, GenerationMixin):
def __init__(self, config: Zamba2Config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values:... | 5 | 1 | 19 | 2 | 12 | 5 | 2 | 0.35 | 2 | 9 | 4 | 0 | 9 | 6 | 9 | 10 | 181 | 28 | 116 | 49 | 78 | 41 | 52 | 22 | 42 | 8 | 2 | 2 | 22 |
6,347 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2ForSequenceClassification | import torch
from ...cache_utils import Cache
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
from typing import Any, Callable, Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss... | null | 5 | 1 | 26 | 2 | 22 | 2 | 5 | 0.09 | 1 | 8 | 3 | 0 | 4 | 4 | 4 | 5 | 110 | 11 | 91 | 33 | 73 | 8 | 51 | 20 | 46 | 16 | 2 | 3 | 19 |
6,348 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2HybridDynamicCache | from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
import torch
class Zamba2HybridDynamicCache:
"""
A dynamic cache that can handle both the attention cache (which has a seq_len dimension) and the mamba cache
(which has a constant shape regardless of seq_len).
... | null | 9 | 3 | 11 | 0 | 10 | 1 | 2 | 0.19 | 1 | 7 | 1 | 0 | 7 | 15 | 8 | 39 | 106 | 12 | 79 | 39 | 59 | 15 | 59 | 28 | 50 | 3 | 3 | 2 | 14 |
6,349 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2HybridLayer | from torch import nn
from ...utils.deprecation import deprecate_kwarg
from typing import Any, Callable, Optional, Union
import torch
class Zamba2HybridLayer(nn.Module):
def __init__(self, shared_transformer: Zamba2AttentionDecoderLayer, linear: nn.Linear, mamba: Zamba2MambaDecoderLayer):
super().__init__(... |
class Zamba2HybridLayer(nn.Module):
def __init__(self, shared_transformer: Zamba2AttentionDecoderLayer, linear: nn.Linear, mamba: Zamba2MambaDecoderLayer):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, original_hi... | 4 | 1 | 35 | 4 | 22 | 10 | 2 | 0.42 | 1 | 7 | 3 | 0 | 2 | 3 | 2 | 12 | 72 | 8 | 45 | 22 | 29 | 19 | 16 | 9 | 13 | 3 | 1 | 1 | 4 |
6,350 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2MLP | import torch
from ...activations import ACT2FN
from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
from torch import nn
class Zamba2MLP(nn.Module):
def __init__(self, config: Zamba2Config, num_fwd_mem_blocks=None, block_id: Optional[int]=None):
"""
This... |
class Zamba2MLP(nn.Module):
def __init__(self, config: Zamba2Config, num_fwd_mem_blocks=None, block_id: Optional[int]=None):
'''
This MLP layer contributes to tied transformer blocks aimed to increasing compute without increasing model size. Because this layer
is tied, un-tied adapter modu... | 3 | 1 | 19 | 2 | 15 | 2 | 2 | 0.13 | 1 | 5 | 1 | 0 | 2 | 10 | 2 | 12 | 40 | 5 | 31 | 18 | 28 | 4 | 27 | 18 | 24 | 3 | 1 | 2 | 4 |
6,351 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2MambaDecoderLayer | from ...utils.deprecation import deprecate_kwarg
import torch
from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
from torch import nn
class Zamba2MambaDecoderLayer(nn.Module):
def __init__(self, config: Zamba2Config, layer_idx: int):
super().__init__()
... |
class Zamba2MambaDecoderLayer(nn.Module):
def __init__(self, config: Zamba2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, original_hidden_states: Optional[torch.Tensor]=None, layer_idx: Opt... | 4 | 1 | 32 | 5 | 19 | 9 | 3 | 0.47 | 1 | 8 | 4 | 0 | 2 | 3 | 2 | 12 | 66 | 10 | 38 | 22 | 22 | 18 | 19 | 9 | 16 | 4 | 1 | 1 | 5 |
6,352 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2MambaMixer | from torch import nn
from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
import torch
class Zamba2MambaMixer(nn.Module):
"""
Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`.
A, D are input independent (see Mamba paper... |
class Zamba2MambaMixer(nn.Module):
'''
Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`.
A, D are input independent (see Mamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective)
∆, B, C are input-dependent (this is a key difference betwe... | 5 | 1 | 104 | 11 | 79 | 18 | 7 | 0.25 | 1 | 6 | 3 | 0 | 4 | 25 | 4 | 14 | 428 | 49 | 315 | 105 | 300 | 80 | 198 | 95 | 193 | 13 | 1 | 3 | 27 |
6,353 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2Model | from torch import nn
import re
import torch
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
from .configuration_zamba2 import Zamba2Config
from typing import Any, Callable, Optional, Union
from itertools impor... | @auto_docstring
class Zamba2Model(Zamba2PreTrainedModel):
'''
Model consisting of *config.num_hidden_layers* layers.
Args:
config: Zamba2Config
'''
def __init__(self, config: Zamba2Config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, at... | 7 | 1 | 40 | 4 | 34 | 2 | 8 | 0.07 | 1 | 17 | 9 | 0 | 6 | 13 | 6 | 7 | 253 | 33 | 207 | 65 | 187 | 14 | 130 | 51 | 123 | 25 | 2 | 6 | 50 |
6,354 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2PreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_zamba2 import Zamba2Config
import torch
import math
class Zamba2PreTrainedModel(PreTrainedModel):
config: Zamba2Config
base_model_prefix = 'model'
supports_gradient_checkpointing = True
_no_split_modules = ['Zamb... |
class Zamba2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 2 | 0 | 25 | 2 | 22 | 1 | 6 | 0.06 | 1 | 1 | 1 | 3 | 1 | 0 | 1 | 1 | 37 | 3 | 33 | 15 | 31 | 2 | 27 | 15 | 25 | 6 | 1 | 2 | 6 |
6,355 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2RMSNorm | import torch
from torch import nn
class Zamba2RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Zamba2RMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps
d... |
class Zamba2RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Zamba2RMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 4 | 1 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 18 | 2 | 13 | 8 | 9 | 3 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
6,356 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modeling_zamba2.py | transformers.models.zamba2.modeling_zamba2.Zamba2RotaryEmbedding | from .configuration_zamba2 import Zamba2Config
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from torch import nn
class Zamba2RotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Zamba2Config, device=None):
super().__init__()
... |
class Zamba2RotaryEmbedding(nn.Module):
def __init__(self, config: Zamba2Config, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 20 | 2 | 15 | 5 | 3 | 0.33 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 65 | 7 | 46 | 25 | 37 | 15 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
6,357 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2Attention | from ..llama.modeling_llama import LlamaRotaryEmbedding, apply_rotary_pos_emb
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils.deprecation import deprecate_kwarg
from ..zamba.modeling_zamba import ZambaAttention, Zamb... |
class Zamba2Attention(ZambaAttention):
'''
Multi-headed attention from 'Attention Is All You Need' paper.
Adapted from transformers.models.mistral.modeling_mistral.MistralAttention:
The input dimension here is attention_hidden_size = 2 * hidden_size, and head_dim = attention_hidden_size // num_heads.
... | 4 | 1 | 48 | 5 | 43 | 0 | 6 | 0.15 | 1 | 8 | 3 | 0 | 2 | 9 | 2 | 14 | 113 | 13 | 87 | 39 | 70 | 13 | 50 | 23 | 47 | 7 | 2 | 3 | 11 |
6,358 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2AttentionDecoderLayer | from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, ZambaForSequenceClassification, ZambaHybridDynamicCache, ZambaHybridLayer, ZambaMambaDecoderLayer, ZambaModel, ZambaRMSNorm, eager_attention_forward
from typing import Callable, Optional, Union
from .configuration_zamba2 im... |
class Zamba2AttentionDecoderLayer(ZambaAttentionDecoderLayer):
def __init__(self, config: Zamba2Config, block_id: Optional[int]=None, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, o... | 4 | 1 | 29 | 2 | 17 | 10 | 2 | 0.57 | 1 | 9 | 5 | 0 | 2 | 3 | 2 | 14 | 60 | 5 | 35 | 19 | 22 | 20 | 17 | 9 | 14 | 2 | 2 | 1 | 3 |
6,359 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2ForCausalLM | from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, ZambaForSequenceClassification, ZambaHybridDynamicCache, ZambaHybridLayer, ZambaMambaDecoderLayer, ZambaModel, ZambaRMSNorm, eager_attention_forward
class Zamba2ForCausalLM(ZambaForCausalLM):
pass |
class Zamba2ForCausalLM(ZambaForCausalLM):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
6,360 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2ForSequenceClassification | from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, ZambaForSequenceClassification, ZambaHybridDynamicCache, ZambaHybridLayer, ZambaMambaDecoderLayer, ZambaModel, ZambaRMSNorm, eager_attention_forward
class Zamba2ForSequenceClassification(ZambaForSequenceClassification):
... |
class Zamba2ForSequenceClassification(ZambaForSequenceClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
6,361 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2HybridDynamicCache | from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, ZambaForSequenceClassification, ZambaHybridDynamicCache, ZambaHybridLayer, ZambaMambaDecoderLayer, ZambaModel, ZambaRMSNorm, eager_attention_forward
import torch
from .configuration_zamba2 import Zamba2Config
from typing im... | null | 5 | 2 | 13 | 0 | 12 | 1 | 2 | 0.26 | 1 | 5 | 1 | 0 | 4 | 15 | 4 | 41 | 69 | 6 | 50 | 26 | 41 | 13 | 38 | 22 | 33 | 3 | 4 | 2 | 8 |
6,362 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2HybridLayer | from torch import nn
from typing import Callable, Optional, Union
from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, ZambaForSequenceClassification, ZambaHybridDynamicCache, ZambaHybridLayer, ZambaMambaDecoderLayer, ZambaModel, ZambaRMSNorm, eager_attention_forward
import t... |
class Zamba2HybridLayer(ZambaHybridLayer):
def __init__(self, shared_transformer: Zamba2AttentionDecoderLayer, linear: nn.Linear, mamba: Zamba2MambaDecoderLayer):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, orig... | 4 | 1 | 35 | 4 | 22 | 10 | 2 | 0.43 | 1 | 7 | 3 | 0 | 2 | 1 | 2 | 14 | 71 | 8 | 44 | 20 | 28 | 19 | 15 | 7 | 12 | 3 | 2 | 1 | 4 |
6,363 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2MLP | import torch
from typing import Callable, Optional, Union
from ...activations import ACT2FN
from .configuration_zamba2 import Zamba2Config
from torch import nn
class Zamba2MLP(nn.Module):
def __init__(self, config: Zamba2Config, num_fwd_mem_blocks=None, block_id: Optional[int]=None):
"""
This MLP ... |
class Zamba2MLP(nn.Module):
def __init__(self, config: Zamba2Config, num_fwd_mem_blocks=None, block_id: Optional[int]=None):
'''
This MLP layer contributes to tied transformer blocks aimed to increasing compute without increasing model size. Because this layer
is tied, un-tied adapter modu... | 3 | 1 | 19 | 2 | 15 | 2 | 2 | 0.13 | 1 | 5 | 1 | 0 | 2 | 10 | 2 | 12 | 40 | 5 | 31 | 18 | 28 | 4 | 27 | 18 | 24 | 3 | 1 | 2 | 4 |
6,364 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2MambaDecoderLayer | from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, ZambaForSequenceClassification, ZambaHybridDynamicCache, ZambaHybridLayer, ZambaMambaDecoderLayer, ZambaModel, ZambaRMSNorm, eager_attention_forward
from .configuration_zamba2 import Zamba2Config
class Zamba2MambaDecoderLa... |
class Zamba2MambaDecoderLayer(ZambaMambaDecoderLayer):
def __init__(self, config: Zamba2Config, layer_idx: int):
pass | 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 5 | 3 | 0 | 1 | 2 | 1 | 13 | 5 | 0 | 5 | 4 | 3 | 0 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
6,365 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2MambaMixer | from .configuration_zamba2 import Zamba2Config
from ..mamba2.modeling_mamba2 import pad_tensor_by_size, reshape_into_chunks, segment_sum
from torch import nn
from typing import Callable, Optional, Union
import torch
class Zamba2MambaMixer(nn.Module):
"""
Compute ∆, A, B, C, and D the state space parameters and... |
class Zamba2MambaMixer(nn.Module):
'''
Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`.
A, D are input independent (see Mamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective)
∆, B, C are input-dependent (this is a key difference betwe... | 5 | 1 | 104 | 11 | 79 | 18 | 7 | 0.25 | 1 | 6 | 3 | 0 | 4 | 25 | 4 | 14 | 428 | 49 | 315 | 105 | 300 | 80 | 198 | 95 | 193 | 13 | 1 | 3 | 27 |
6,366 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2Model | from ...modeling_outputs import BaseModelOutputWithPast
from typing import Callable, Optional, Union
import re
import torch
from .configuration_zamba2 import Zamba2Config
from torch import nn
from itertools import cycle
from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, Zam... |
class Zamba2Model(ZambaModel, Zamba2PreTrainedModel):
'''
Model consisting of *config.num_hidden_layers* layers.
Args:
config: Zamba2Config
'''
def __init__(self, config: Zamba2Config):
pass
def get_layers(self, blocks, linear_layers, mamba_layers):
pass
def forwa... | 4 | 1 | 67 | 7 | 58 | 2 | 14 | 0.06 | 2 | 15 | 8 | 0 | 3 | 13 | 3 | 140 | 211 | 26 | 175 | 54 | 159 | 10 | 103 | 41 | 99 | 25 | 3 | 6 | 41 |
6,367 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2PreTrainedModel | import torch
import math
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_zamba2 import Zamba2Config
class Zamba2PreTrainedModel(PreTrainedModel):
config: Zamba2Config
base_model_prefix = 'model'
supports_gradient_checkpointing = True
_no_split_modules = ['Zamb... |
class Zamba2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 2 | 0 | 25 | 2 | 22 | 1 | 6 | 0.06 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 130 | 37 | 3 | 33 | 15 | 31 | 2 | 27 | 15 | 25 | 6 | 2 | 2 | 6 |
6,368 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2RMSNorm | from ..zamba.modeling_zamba import ZambaAttention, ZambaAttentionDecoderLayer, ZambaForCausalLM, ZambaForSequenceClassification, ZambaHybridDynamicCache, ZambaHybridLayer, ZambaMambaDecoderLayer, ZambaModel, ZambaRMSNorm, eager_attention_forward
class Zamba2RMSNorm(ZambaRMSNorm):
pass |
class Zamba2RMSNorm(ZambaRMSNorm):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
6,369 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2RMSNormGated | from torch import nn
import torch
class Zamba2RMSNormGated(torch.nn.Module):
def __init__(self, hidden_size, group_size, eps=1e-06):
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps
self.group_size = group_size
def forward(self... |
class Zamba2RMSNormGated(torch.nn.Module):
def __init__(self, hidden_size, group_size, eps=1e-06):
pass
def forward(self, hidden_states, gate=None):
pass | 3 | 0 | 9 | 0 | 9 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 19 | 1 | 18 | 11 | 15 | 0 | 18 | 11 | 15 | 2 | 1 | 1 | 3 |
6,370 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zamba2/modular_zamba2.py | transformers.models.zamba2.modular_zamba2.Zamba2RotaryEmbedding | from ..llama.modeling_llama import LlamaRotaryEmbedding, apply_rotary_pos_emb
class Zamba2RotaryEmbedding(LlamaRotaryEmbedding):
pass |
class Zamba2RotaryEmbedding(LlamaRotaryEmbedding):
pass | 1 | 0 | 10 | 0 | 9 | 1 | 1 | 0.1 | 1 | 2 | 1 | 0 | 1 | 1 | 1 | 14 | 11 | 0 | 10 | 7 | 4 | 1 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
6,371 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/configuration_zoedepth.py | transformers.models.zoedepth.configuration_zoedepth.ZoeDepthConfig | from ...configuration_utils import PretrainedConfig
from ..auto.configuration_auto import CONFIG_MAPPING
class ZoeDepthConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ZoeDepthForDepthEstimation`]. It is used to instantiate an ZoeDepth
model according to the s... | null | 4 | 1 | 98 | 8 | 90 | 0 | 8 | 1.04 | 1 | 3 | 0 | 0 | 1 | 29 | 1 | 1 | 206 | 18 | 92 | 67 | 57 | 96 | 49 | 34 | 47 | 8 | 1 | 1 | 8 |
6,372 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/image_processing_zoedepth.py | transformers.models.zoedepth.image_processing_zoedepth.ZoeDepthImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, val... |
class ZoeDepthImageProcessor(BaseImageProcessor):
'''
Constructs a ZoeDepth image processor.
Args:
do_pad (`bool`, *optional*, defaults to `True`):
Whether to apply pad the input.
do_rescale (`bool`, *optional*, defaults to `True`):
Whether to rescale the image by th... | 7 | 5 | 81 | 8 | 45 | 28 | 9 | 0.79 | 1 | 10 | 3 | 0 | 5 | 11 | 5 | 25 | 457 | 50 | 227 | 87 | 167 | 180 | 111 | 33 | 105 | 19 | 3 | 3 | 44 |
6,373 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.LogBinomialSoftmax | from torch import nn
import torch
class LogBinomialSoftmax(nn.Module):
def __init__(self, n_classes=256, act=torch.softmax):
"""Compute log binomial distribution for n_classes
Args:
n_classes (`int`, *optional*, defaults to 256):
Number of output classes.
a... |
class LogBinomialSoftmax(nn.Module):
def __init__(self, n_classes=256, act=torch.softmax):
'''Compute log binomial distribution for n_classes
Args:
n_classes (`int`, *optional*, defaults to 256):
Number of output classes.
act (`torch.nn.Module`, *optional*, ... | 3 | 2 | 20 | 2 | 9 | 10 | 2 | 1.11 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 42 | 5 | 18 | 7 | 15 | 20 | 14 | 7 | 11 | 2 | 1 | 1 | 3 |
6,374 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthAttractorLayer | from torch import nn
import torch
class ZoeDepthAttractorLayer(nn.Module):
def __init__(self, config, n_bins, n_attractors=16, min_depth=0.001, max_depth=10, memory_efficient=False):
"""
Attractor layer for bin centers. Bin centers are bounded on the interval (min_depth, max_depth)
"""
... |
class ZoeDepthAttractorLayer(nn.Module):
def __init__(self, config, n_bins, n_attractors=16, min_depth=0.001, max_depth=10, memory_efficient=False):
'''
Attractor layer for bin centers. Bin centers are bounded on the interval (min_depth, max_depth)
'''
pass
def forward(self, x... | 3 | 2 | 46 | 6 | 27 | 14 | 4 | 0.52 | 1 | 2 | 0 | 0 | 2 | 12 | 2 | 12 | 93 | 13 | 54 | 32 | 43 | 28 | 43 | 24 | 40 | 6 | 1 | 2 | 7 |
6,375 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthAttractorLayerUnnormed | from torch import nn
import torch
class ZoeDepthAttractorLayerUnnormed(nn.Module):
def __init__(self, config, n_bins, n_attractors=16, min_depth=0.001, max_depth=10, memory_efficient=True):
"""
Attractor layer for bin centers. Bin centers are unbounded
"""
super().__init__()
... |
class ZoeDepthAttractorLayerUnnormed(nn.Module):
def __init__(self, config, n_bins, n_attractors=16, min_depth=0.001, max_depth=10, memory_efficient=True):
'''
Attractor layer for bin centers. Bin centers are unbounded
'''
pass
def forward(self, x, prev_bin, prev_bin_embedding... | 3 | 2 | 40 | 6 | 24 | 11 | 4 | 0.43 | 1 | 2 | 0 | 0 | 2 | 12 | 2 | 12 | 82 | 12 | 49 | 31 | 38 | 21 | 38 | 23 | 35 | 6 | 1 | 2 | 7 |
6,376 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthConditionalLogBinomialSoftmax | import torch
from torch import nn
class ZoeDepthConditionalLogBinomialSoftmax(nn.Module):
def __init__(self, config, in_features, condition_dim, n_classes=256, bottleneck_factor=2):
"""Per-pixel MLP followed by a Conditional Log Binomial softmax.
Args:
in_features (`int`):
... |
class ZoeDepthConditionalLogBinomialSoftmax(nn.Module):
def __init__(self, config, in_features, condition_dim, n_classes=256, bottleneck_factor=2):
'''Per-pixel MLP followed by a Conditional Log Binomial softmax.
Args:
in_features (`int`):
Number of input channels in th... | 3 | 2 | 32 | 4 | 17 | 11 | 1 | 0.65 | 1 | 2 | 1 | 0 | 2 | 5 | 2 | 12 | 65 | 9 | 34 | 18 | 24 | 22 | 19 | 11 | 16 | 1 | 1 | 0 | 2 |
6,377 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthDepthEstimatorOutput | import torch
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Extension of `DepthEstimatorOutput` to include domain logits (ZoeDepth specific).\n ')
class ZoeDepthDepthEstimatorOutput(ModelOu... | @dataclass
@auto_docstring(custom_intro='\n Extension of `DepthEstimatorOutput` to include domain logits (ZoeDepth specific).\n ')
class ZoeDepthDepthEstimatorOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or reg... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 31 | 6 | 6 | 6 | 5 | 19 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
6,378 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthFeatureFusionLayer | from typing import Optional, Union
from torch import nn
from .configuration_zoedepth import ZoeDepthConfig
import torch
class ZoeDepthFeatureFusionLayer(nn.Module):
"""Feature fusion layer, merges feature maps from different stages.
Args:
config (`[ZoeDepthConfig]`):
Model configuration cl... |
class ZoeDepthFeatureFusionLayer(nn.Module):
'''Feature fusion layer, merges feature maps from different stages.
Args:
config (`[ZoeDepthConfig]`):
Model configuration class defining the model architecture.
align_corners (`bool`, *optional*, defaults to `True`):
The alig... | 3 | 1 | 12 | 3 | 10 | 0 | 2 | 0.35 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 35 | 8 | 20 | 7 | 17 | 7 | 16 | 7 | 13 | 3 | 1 | 2 | 4 |
6,379 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthFeatureFusionStage | from .configuration_zoedepth import ZoeDepthConfig
from torch import nn
class ZoeDepthFeatureFusionStage(nn.Module):
def __init__(self, config: ZoeDepthConfig):
super().__init__()
self.layers = nn.ModuleList()
for _ in range(len(config.neck_hidden_sizes)):
self.layers.append(Zo... |
class ZoeDepthFeatureFusionStage(nn.Module):
def __init__(self, config: ZoeDepthConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 1 | 8 | 1 | 3 | 0.12 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 12 | 22 | 3 | 17 | 8 | 14 | 2 | 16 | 8 | 13 | 3 | 1 | 2 | 5 |
6,380 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthForDepthEstimation | from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import DepthEstimatorOutput
import torch
from typing import Optional, Union
from ...utils.backbone_utils import load_backbone
@auto_docstring(custom_intro='\n ZoeDepth model with one or multiple metric depth estimation head(s) on top... | @auto_docstring(custom_intro='\n ZoeDepth model with one or multiple metric depth estimation head(s) on top.\n ')
class ZoeDepthForDepthEstimation(ZoeDepthPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: torch.FloatTensor, labels: Optional[tor... | 5 | 1 | 59 | 12 | 32 | 16 | 6 | 0.47 | 1 | 11 | 6 | 0 | 2 | 5 | 2 | 3 | 122 | 25 | 66 | 28 | 54 | 31 | 37 | 20 | 34 | 8 | 2 | 2 | 11 |
6,381 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthMLPClassifier | from torch import nn
class ZoeDepthMLPClassifier(nn.Module):
def __init__(self, in_features, out_features) -> None:
super().__init__()
hidden_features = in_features
self.linear1 = nn.Linear(in_features, hidden_features)
self.activation = nn.ReLU()
self.linear2 = nn.Linear(h... |
class ZoeDepthMLPClassifier(nn.Module):
def __init__(self, in_features, out_features) -> None:
pass
def forward(self, hidden_state):
pass | 3 | 0 | 7 | 1 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 3 | 12 | 8 | 9 | 0 | 12 | 8 | 9 | 1 | 1 | 0 | 2 |
6,382 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthMetricDepthEstimationHead | import torch
from torch import nn
class ZoeDepthMetricDepthEstimationHead(nn.Module):
def __init__(self, config):
super().__init__()
bin_configuration = config.bin_configurations[0]
n_bins = bin_configuration['n_bins']
min_depth = bin_configuration['min_depth']
max_depth = ... |
class ZoeDepthMetricDepthEstimationHead(nn.Module):
def __init__(self, config):
pass
def forward(self, outconv_activation, bottleneck, feature_blocks, relative_depth):
pass | 3 | 0 | 47 | 8 | 36 | 4 | 3 | 0.1 | 1 | 8 | 5 | 0 | 2 | 9 | 2 | 12 | 95 | 17 | 72 | 33 | 69 | 7 | 45 | 32 | 42 | 3 | 1 | 1 | 6 |
6,383 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthMultiheadAttention | from torch import nn
import math
import torch
from typing import Optional, Union
class ZoeDepthMultiheadAttention(nn.Module):
"""Equivalent implementation of nn.MultiheadAttention with `batch_first=True`."""
def __init__(self, hidden_size, num_attention_heads, dropout):
super().__init__()
if h... |
class ZoeDepthMultiheadAttention(nn.Module):
'''Equivalent implementation of nn.MultiheadAttention with `batch_first=True`.'''
def __init__(self, hidden_size, num_attention_heads, dropout):
pass
def forward(self, queries: torch.Tensor, keys: torch.Tensor, values: torch.Tensor, attention_mask: Opt... | 3 | 1 | 20 | 4 | 14 | 2 | 2 | 0.16 | 1 | 5 | 0 | 0 | 3 | 8 | 3 | 13 | 67 | 16 | 44 | 28 | 33 | 7 | 34 | 21 | 30 | 3 | 1 | 1 | 6 |
6,384 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthMultipleMetricDepthEstimationHeads | from torch import nn
import torch
class ZoeDepthMultipleMetricDepthEstimationHeads(nn.Module):
"""
Multiple metric depth estimation heads. A MLP classifier is used to route between 2 different heads.
"""
def __init__(self, config):
super().__init__()
bin_embedding_dim = config.bin_embe... |
class ZoeDepthMultipleMetricDepthEstimationHeads(nn.Module):
'''
Multiple metric depth estimation heads. A MLP classifier is used to route between 2 different heads.
'''
def __init__(self, config):
pass
def forward(self, outconv_activation, bottleneck, feature_blocks, relative_depth):... | 3 | 1 | 67 | 10 | 51 | 7 | 4 | 0.16 | 1 | 12 | 7 | 0 | 2 | 10 | 2 | 12 | 139 | 21 | 102 | 39 | 99 | 16 | 52 | 38 | 49 | 4 | 1 | 1 | 7 |
6,385 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthNeck | from .configuration_zoedepth import ZoeDepthConfig
import torch
from torch import nn
class ZoeDepthNeck(nn.Module):
"""
ZoeDepthNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as
input and produces another list of tensors as output. For ZoeDepth,... |
class ZoeDepthNeck(nn.Module):
'''
ZoeDepthNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as
input and produces another list of tensors as output. For ZoeDepth, it includes 2 stages:
* ZoeDepthReassembleStage
* ZoeDepthFeatureFusionStage... | 3 | 2 | 19 | 4 | 11 | 5 | 4 | 0.82 | 1 | 9 | 2 | 0 | 2 | 4 | 2 | 12 | 52 | 12 | 22 | 10 | 19 | 18 | 21 | 10 | 18 | 4 | 1 | 1 | 7 |
6,386 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthPatchTransformerEncoder | import torch
from torch import nn
class ZoeDepthPatchTransformerEncoder(nn.Module):
def __init__(self, config):
"""ViT-like transformer block
Args:
config (`ZoeDepthConfig`):
Model configuration class defining the model architecture.
"""
super().__init_... |
class ZoeDepthPatchTransformerEncoder(nn.Module):
def __init__(self, config):
'''ViT-like transformer block
Args:
config (`ZoeDepthConfig`):
Model configuration class defining the model architecture.
'''
pass
def positional_encoding_1d(self, batch_s... | 4 | 3 | 19 | 4 | 9 | 7 | 1 | 0.69 | 1 | 3 | 1 | 0 | 3 | 2 | 3 | 13 | 61 | 13 | 29 | 15 | 25 | 20 | 23 | 14 | 19 | 2 | 1 | 1 | 4 |
6,387 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthPreActResidualLayer | import torch
from torch import nn
class ZoeDepthPreActResidualLayer(nn.Module):
"""
ResidualConvUnit, pre-activate residual unit.
Args:
config (`[ZoeDepthConfig]`):
Model configuration class defining the model architecture.
"""
def __init__(self, config):
super().__ini... |
class ZoeDepthPreActResidualLayer(nn.Module):
'''
ResidualConvUnit, pre-activate residual unit.
Args:
config (`[ZoeDepthConfig]`):
Model configuration class defining the model architecture.
'''
def __init__(self, config):
pass
def forward(self, hidden_s... | 3 | 1 | 25 | 5 | 20 | 0 | 3 | 0.17 | 1 | 2 | 0 | 0 | 2 | 7 | 2 | 12 | 60 | 12 | 41 | 12 | 38 | 7 | 23 | 12 | 20 | 3 | 1 | 1 | 6 |
6,388 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthPreTrainedModel | from torch import nn
from ...utils import ModelOutput, auto_docstring, logging
from .configuration_zoedepth import ZoeDepthConfig
from ...modeling_utils import PreTrainedModel
@auto_docstring
class ZoeDepthPreTrainedModel(PreTrainedModel):
config: ZoeDepthConfig
base_model_prefix = 'zoedepth'
main_input_na... | @auto_docstring
class ZoeDepthPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.54 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 22 | 2 | 13 | 6 | 11 | 7 | 12 | 6 | 10 | 4 | 1 | 2 | 4 |
6,389 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthProjector | import torch
from torch import nn
class ZoeDepthProjector(nn.Module):
def __init__(self, in_features, out_features, mlp_dim=128):
"""Projector MLP.
Args:
in_features (`int`):
Number of input channels.
out_features (`int`):
Number of output c... |
class ZoeDepthProjector(nn.Module):
def __init__(self, in_features, out_features, mlp_dim=128):
'''Projector MLP.
Args:
in_features (`int`):
Number of input channels.
out_features (`int`):
Number of output channels.
mlp_dim (`int`... | 3 | 1 | 11 | 2 | 5 | 5 | 1 | 0.82 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 24 | 4 | 11 | 6 | 8 | 9 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
6,390 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthReassembleLayer | from torch import nn
class ZoeDepthReassembleLayer(nn.Module):
def __init__(self, config, channels, factor):
super().__init__()
hidden_size = config.backbone_hidden_size
self.projection = nn.Conv2d(in_channels=hidden_size, out_channels=channels, kernel_size=1)
if factor > 1:
... |
class ZoeDepthReassembleLayer(nn.Module):
def __init__(self, config, channels, factor):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 9 | 1 | 7 | 2 | 3 | 0.27 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 21 | 2 | 15 | 6 | 12 | 4 | 13 | 6 | 10 | 4 | 1 | 1 | 5 |
6,391 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthReassembleStage | from ...activations import ACT2FN
import torch
from torch import nn
class ZoeDepthReassembleStage(nn.Module):
"""
This class reassembles the hidden states of the backbone into image-like feature representations at various
resolutions.
This happens in 3 stages:
1. Map the N + 1 tokens to a set of N... |
class ZoeDepthReassembleStage(nn.Module):
'''
This class reassembles the hidden states of the backbone into image-like feature representations at various
resolutions.
This happens in 3 stages:
1. Map the N + 1 tokens to a set of N tokens, by taking into account the readout ([CLS]) token according t... | 3 | 2 | 28 | 5 | 17 | 6 | 5 | 0.69 | 1 | 5 | 1 | 0 | 2 | 3 | 2 | 12 | 72 | 13 | 35 | 15 | 32 | 24 | 32 | 15 | 29 | 5 | 1 | 2 | 9 |
6,392 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthRelativeDepthEstimationHead | from torch import nn
import torch
class ZoeDepthRelativeDepthEstimationHead(nn.Module):
"""
Relative depth estimation head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples
the predictions to the input resolution after the first convolutional layer (details c... |
class ZoeDepthRelativeDepthEstimationHead(nn.Module):
'''
Relative depth estimation head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples
the predictions to the input resolution after the first convolutional layer (details can be found in DPT's paper's
s... | 3 | 1 | 17 | 4 | 13 | 1 | 2 | 0.27 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 42 | 9 | 26 | 12 | 23 | 7 | 26 | 12 | 23 | 2 | 1 | 1 | 4 |
6,393 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthSeedBinRegressor | from torch import nn
import torch
class ZoeDepthSeedBinRegressor(nn.Module):
def __init__(self, config, n_bins=16, mlp_dim=256, min_depth=0.001, max_depth=10):
"""Bin center regressor network.
Can be "normed" or "unnormed". If "normed", bin centers are bounded on the (min_depth, max_depth) interv... |
class ZoeDepthSeedBinRegressor(nn.Module):
def __init__(self, config, n_bins=16, mlp_dim=256, min_depth=0.001, max_depth=10):
'''Bin center regressor network.
Can be "normed" or "unnormed". If "normed", bin centers are bounded on the (min_depth, max_depth) interval.
Args:
confi... | 3 | 2 | 26 | 4 | 13 | 10 | 2 | 0.77 | 1 | 1 | 0 | 0 | 2 | 8 | 2 | 12 | 54 | 8 | 26 | 15 | 23 | 20 | 25 | 15 | 22 | 2 | 1 | 1 | 4 |
6,394 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/zoedepth/modeling_zoedepth.py | transformers.models.zoedepth.modeling_zoedepth.ZoeDepthTransformerEncoderLayer | from ...activations import ACT2FN
from torch import nn
from typing import Optional, Union
import torch
class ZoeDepthTransformerEncoderLayer(nn.Module):
def __init__(self, config, dropout=0.1, activation='relu'):
super().__init__()
hidden_size = config.patch_transformer_hidden_size
interme... |
class ZoeDepthTransformerEncoderLayer(nn.Module):
def __init__(self, config, dropout=0.1, activation='relu'):
pass
def forward(self, src, src_mask: Optional[torch.Tensor]=None):
pass | 3 | 0 | 16 | 3 | 14 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 9 | 2 | 12 | 34 | 6 | 28 | 21 | 21 | 0 | 24 | 17 | 21 | 1 | 1 | 0 | 2 |
6,395 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/onnx/config.py | transformers.onnx.config.OnnxConfig | from collections import OrderedDict
import numpy as np
from typing import TYPE_CHECKING, Any, Callable, Optional, Union
import copy
from .utils import ParameterFormat, compute_effective_axis_dimension, compute_serialized_parameters_size
import dataclasses
import warnings
from packaging import version
from collections.a... |
class OnnxConfig(ABC):
'''
Base class for ONNX exportable model describing metadata on how to export the model through the ONNX format.
'''
def __init__(self, config: 'PretrainedConfig', task: str='default', patching_specs: Optional[list[PatchingSpec]]=None):
pass
@classmethod
def ... | 33 | 15 | 16 | 2 | 8 | 6 | 2 | 0.61 | 1 | 17 | 5 | 2 | 16 | 3 | 19 | 39 | 373 | 49 | 201 | 82 | 144 | 123 | 106 | 51 | 81 | 11 | 4 | 3 | 41 |
6,396 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/onnx/config.py | transformers.onnx.config.OnnxConfigWithPast | from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Callable, Optional, Union
from collections.abc import Iterable, Mapping
from ..utils import is_torch_available, is_vision_available, logging
class OnnxConfigWithPast(OnnxConfig, ABC):
def __init__(self, config: 'PretrainedConfig', task: st... |
class OnnxConfigWithPast(OnnxConfig, ABC):
def __init__(self, config: 'PretrainedConfig', task: str='default', patching_specs: Optional[list[PatchingSpec]]=None, use_past: bool=False):
pass
@classmethod
def with_past(cls, config: 'PretrainedConfig', task: str='default') -> 'OnnxConfigWithPast':
... | 16 | 4 | 13 | 1 | 9 | 3 | 2 | 0.27 | 2 | 10 | 1 | 1 | 9 | 1 | 10 | 49 | 145 | 22 | 97 | 44 | 65 | 26 | 58 | 24 | 46 | 5 | 5 | 2 | 24 |
6,397 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/onnx/config.py | transformers.onnx.config.OnnxSeq2SeqConfigWithPast | from collections.abc import Iterable, Mapping
from typing import TYPE_CHECKING, Any, Callable, Optional, Union
from ..utils import is_torch_available, is_vision_available, logging
class OnnxSeq2SeqConfigWithPast(OnnxConfigWithPast):
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
commo... |
class OnnxSeq2SeqConfigWithPast(OnnxConfigWithPast):
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def num_layers(self) -> tuple[int]:
pass
@property
def num_attention_heads(self) -> tuple[int]:
pass
def generate_dummy_inputs(self, ... | 10 | 0 | 24 | 2 | 20 | 2 | 5 | 0.07 | 1 | 9 | 0 | 0 | 6 | 0 | 6 | 55 | 152 | 18 | 125 | 48 | 107 | 9 | 82 | 38 | 74 | 8 | 6 | 3 | 29 |
6,398 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/onnx/features.py | transformers.onnx.features.FeaturesManager | from functools import partial, reduce
from .. import PretrainedConfig, is_torch_available
from .config import OnnxConfig
from typing import TYPE_CHECKING, Callable, Optional
class FeaturesManager:
_TASKS_TO_AUTOMODELS = {}
if is_torch_available():
_TASKS_TO_AUTOMODELS = {'default': AutoModel, 'masked-l... |
class FeaturesManager:
@staticmethod
def get_supported_features_for_model_type(model_type: str, model_name: Optional[str]=None) -> dict[str, Callable[[PretrainedConfig], OnnxConfig]]:
'''
Tries to retrieve the feature -> OnnxConfig constructor map from the model type.
Args:
... | 12 | 5 | 23 | 3 | 11 | 9 | 3 | 0.13 | 0 | 8 | 1 | 0 | 1 | 0 | 8 | 8 | 665 | 32 | 560 | 35 | 538 | 73 | 69 | 22 | 60 | 7 | 0 | 2 | 24 |
6,399 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/onnx/utils.py | transformers.onnx.utils.ParameterFormat | from enum import Enum
from ctypes import c_float, sizeof
class ParameterFormat(Enum):
Float = c_float
@property
def size(self) -> int:
"""
Number of byte required for this data type
Returns:
Integer > 0
"""
return sizeof(self.value) |
class ParameterFormat(Enum):
@property
def size(self) -> int:
'''
Number of byte required for this data type
Returns:
Integer > 0
'''
pass | 3 | 1 | 8 | 1 | 2 | 5 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 50 | 12 | 2 | 5 | 4 | 2 | 5 | 4 | 3 | 2 | 1 | 4 | 0 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.