id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,900 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoLearnedPositionEmbedding | from torch import Tensor, nn
import torch
import torch.nn.functional as F
class GroundingDinoLearnedPositionEmbedding(nn.Module):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, config):
super().__init__()
embedding_dim = config.d_model /... |
class GroundingDinoLearnedPositionEmbedding(nn.Module):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, config):
pass
def forward(self, pixel_values, pixel_mask=None):
pass | 3 | 1 | 9 | 1 | 8 | 0 | 1 | 0.18 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 23 | 3 | 17 | 12 | 14 | 3 | 17 | 12 | 14 | 1 | 1 | 0 | 2 |
2,901 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoMLPPredictionHead | from torch import Tensor, nn
class GroundingDinoMLPPredictionHead(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 GroundingDinoMLPPredictionHead(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 |
2,902 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoModel | import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
from ...pytorch_utils import meshgrid
from .configuration_grounding_dino import GroundingDinoConfig
from torch import Tensor, nn
from ..auto import AutoModel
import torch.nn.functional as F
@auto_docstring(custom_intro='\n ... | @auto_docstring(custom_intro='\n The bare Grounding DINO Model (consisting of a backbone and encoder-decoder Transformer) outputting raw\n hidden-states without any specific head on top.\n ')
class GroundingDinoModel(GroundingDinoPreTrainedModel):
def __init__(self, config: GroundingDinoConfig):
p... | 9 | 3 | 47 | 6 | 35 | 7 | 5 | 0.19 | 1 | 18 | 10 | 0 | 8 | 13 | 8 | 10 | 386 | 51 | 283 | 101 | 261 | 54 | 173 | 89 | 164 | 23 | 2 | 3 | 39 |
2,903 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoModelOutput | from dataclasses import dataclass
import torch.nn.functional as F
import torch
from ...file_utils import ModelOutput, is_timm_available, requires_backends
from ...utils import auto_docstring, logging
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Base class for outputs of the Groundi... | @dataclass
@auto_docstring(custom_intro='\n Base class for outputs of the Grounding DINO encoder-decoder model.\n ')
class GroundingDinoModelOutput(ModelOutput):
'''
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_queries, hidden_size)`):
Sequence of hidden-states at the output o... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.14 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 60 | 2 | 14 | 14 | 13 | 44 | 14 | 14 | 13 | 0 | 1 | 0 | 0 |
2,904 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoMultiheadAttention | import math
import torch
from typing import Optional, Union
from torch import Tensor, nn
import torch.nn.functional as F
class GroundingDinoMultiheadAttention(nn.Module):
"""Equivalent implementation of nn.MultiheadAttention with `batch_first=True`."""
def __init__(self, config, num_attention_heads=None):
... |
class GroundingDinoMultiheadAttention(nn.Module):
'''Equivalent implementation of nn.MultiheadAttention with `batch_first=True`.'''
def __init__(self, config, num_attention_heads=None):
pass
def forward(self, queries: torch.Tensor, keys: torch.Tensor, values: torch.Tensor, attention_mask: Optiona... | 3 | 1 | 20 | 4 | 14 | 2 | 2 | 0.14 | 1 | 5 | 0 | 0 | 3 | 8 | 3 | 13 | 66 | 16 | 44 | 28 | 33 | 6 | 34 | 21 | 30 | 3 | 1 | 1 | 6 |
2,905 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoMultiscaleDeformableAttention | import torch
from typing import Optional, Union
from .configuration_grounding_dino import GroundingDinoConfig
from torch import Tensor, nn
import warnings
import torch.nn.functional as F
class GroundingDinoMultiscaleDeformableAttention(nn.Module):
"""
Multiscale deformable attention as proposed in Deformable D... |
class GroundingDinoMultiscaleDeformableAttention(nn.Module):
'''
Multiscale deformable attention as proposed in Deformable DETR.
'''
def __init__(self, config: GroundingDinoConfig, num_heads: int, n_points: int):
pass
def with_pos_embed(self, tensor: torch.Tensor, position_embeddings:... | 4 | 1 | 38 | 3 | 32 | 3 | 5 | 0.11 | 1 | 9 | 2 | 0 | 3 | 10 | 3 | 13 | 120 | 13 | 96 | 38 | 80 | 11 | 54 | 25 | 50 | 8 | 1 | 2 | 15 |
2,906 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoObjectDetectionOutput | from dataclasses import dataclass
import torch.nn.functional as F
import torch
from ...file_utils import ModelOutput, is_timm_available, requires_backends
from ...utils import auto_docstring, logging
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Output type of [`GroundingDinoForObje... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`GroundingDinoForObjectDetection`].\n ')
class GroundingDinoObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a nega... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 84 | 2 | 20 | 20 | 19 | 62 | 20 | 20 | 19 | 0 | 1 | 0 | 0 |
2,907 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoPreTrainedModel | import math
import torch
from ...utils import auto_docstring, logging
from .configuration_grounding_dino import GroundingDinoConfig
from ...modeling_utils import PreTrainedModel
from torch import Tensor, nn
import torch.nn.functional as F
@auto_docstring
class GroundingDinoPreTrainedModel(PreTrainedModel):
config:... | @auto_docstring
class GroundingDinoPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
def _set_gradient_checkpointing(self, module, value=False):
pass | 4 | 0 | 34 | 1 | 32 | 1 | 9 | 0.03 | 1 | 8 | 7 | 4 | 2 | 0 | 2 | 2 | 73 | 4 | 67 | 12 | 64 | 2 | 55 | 12 | 52 | 15 | 1 | 3 | 17 |
2,908 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoSinePositionEmbedding | import math
from torch import Tensor, nn
import torch
import torch.nn.functional as F
class GroundingDinoSinePositionEmbedding(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 GroundingDinoSinePositionEmbedding(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, config):
pass
def forward(self, pixel_values, ... | 3 | 1 | 11 | 1 | 10 | 0 | 1 | 0.2 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 28 | 4 | 20 | 13 | 17 | 4 | 20 | 13 | 17 | 1 | 1 | 0 | 2 |
2,909 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/modeling_grounding_dino.py | transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoTextEnhancerLayer | from torch import Tensor, nn
import torch.nn.functional as F
import torch
from typing import Optional, Union
from ...activations import ACT2FN
class GroundingDinoTextEnhancerLayer(nn.Module):
"""Vanilla Transformer with text embeddings as input"""
def __init__(self, config):
super().__init__()
... |
class GroundingDinoTextEnhancerLayer(nn.Module):
'''Vanilla Transformer with text embeddings as input'''
def __init__(self, config):
pass
def with_pos_embed(self, hidden_state: Tensor, position_embeddings: Optional[Tensor]):
pass
def forward(self, hidden_states: torch.FloatTensor, at... | 4 | 2 | 25 | 3 | 15 | 7 | 2 | 0.48 | 1 | 3 | 1 | 0 | 3 | 8 | 3 | 13 | 80 | 13 | 46 | 21 | 37 | 22 | 33 | 16 | 29 | 2 | 1 | 1 | 5 |
2,910 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/processing_grounding_dino.py | transformers.models.grounding_dino.processing_grounding_dino.DictWithDeprecationWarning | import warnings
class DictWithDeprecationWarning(dict):
message = 'The key `labels` is will return integer ids in `GroundingDinoProcessor.post_process_grounded_object_detection` output since v4.51.0. Use `text_labels` instead to retrieve string object names.'
def __getitem__(self, key):
if key == 'lab... |
class DictWithDeprecationWarning(dict):
def __getitem__(self, key):
pass
def get(self, key, *args, **kwargs):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 29 | 15 | 2 | 13 | 4 | 10 | 0 | 10 | 4 | 7 | 2 | 2 | 1 | 4 |
2,911 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/processing_grounding_dino.py | transformers.models.grounding_dino.processing_grounding_dino.GroundingDinoImagesKwargs | from ...image_utils import AnnotationFormat, ImageInput
import pathlib
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack
from typing import TYPE_CHECKING, Optional, Union
class GroundingDinoImagesKwargs(ImagesKwargs, total=False):
annotations: Optional[Union[AnnotationType, lis... |
class GroundingDinoImagesKwargs(ImagesKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 0 | 6 | 1 | 5 | 0 | 6 | 1 | 5 | 0 | 2 | 0 | 0 |
2,912 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/processing_grounding_dino.py | transformers.models.grounding_dino.processing_grounding_dino.GroundingDinoProcessor | from ...image_utils import AnnotationFormat, ImageInput
from ...utils import TensorType, is_torch_available
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack
from ...image_transforms import center_to_corners_format
from typing import TYPE_CHECKING, Optional, Union
from ...tokenizati... |
class GroundingDinoProcessor(ProcessorMixin):
'''
Constructs a Grounding DINO processor which wraps a Deformable DETR image processor and a BERT tokenizer into a
single processor.
[`GroundingDinoProcessor`] offers all the functionalities of [`GroundingDinoImageProcessor`] and
[`AutoTokenizer`]. See... | 5 | 4 | 24 | 3 | 12 | 9 | 2 | 0.82 | 1 | 14 | 4 | 0 | 7 | 0 | 7 | 24 | 197 | 30 | 93 | 46 | 68 | 76 | 58 | 29 | 50 | 6 | 2 | 2 | 17 |
2,913 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/grounding_dino/processing_grounding_dino.py | transformers.models.grounding_dino.processing_grounding_dino.GroundingDinoProcessorKwargs | from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack
class GroundingDinoProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: GroundingDinoImagesKwargs
_defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': False, 'stride': 0, 'return_overflowing_tokens':... |
class GroundingDinoProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 0 | 15 | 2 | 14 | 0 | 3 | 2 | 2 | 0 | 3 | 0 | 0 |
2,914 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/configuration_groupvit.py | transformers.models.groupvit.configuration_groupvit.GroupViTConfig | from ...configuration_utils import PretrainedConfig
class GroupViTConfig(PretrainedConfig):
"""
[`GroupViTConfig`] is the configuration class to store the configuration of a [`GroupViTModel`]. It is used to
instantiate a GroupViT model according to the specified arguments, defining the text model and visio... |
class GroupViTConfig(PretrainedConfig):
'''
[`GroupViTConfig`] is the configuration class to store the configuration of a [`GroupViTModel`]. It is used to
instantiate a GroupViT model according to the specified arguments, defining the text model and vision model
configs. Instantiating a configuration w... | 2 | 1 | 53 | 8 | 34 | 12 | 8 | 0.63 | 1 | 4 | 2 | 0 | 1 | 8 | 2 | 2 | 137 | 20 | 72 | 28 | 60 | 45 | 47 | 19 | 44 | 14 | 1 | 4 | 15 |
2,915 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/configuration_groupvit.py | transformers.models.groupvit.configuration_groupvit.GroupViTOnnxConfig | from ...onnx import OnnxConfig
from typing import TYPE_CHECKING, Any
from collections import OrderedDict
from collections.abc import Mapping
class GroupViTOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict([('input_ids', {0: 'batch', 1: 'sequence'... |
class GroupViTOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass
def generate_dummy_inputs(self, pro... | 10 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 6 | 0 | 0 | 5 | 0 | 5 | 5 | 44 | 4 | 40 | 18 | 24 | 0 | 13 | 8 | 7 | 1 | 1 | 0 | 5 |
2,916 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/configuration_groupvit.py | transformers.models.groupvit.configuration_groupvit.GroupViTTextConfig | from ...configuration_utils import PretrainedConfig
class GroupViTTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`GroupViTTextModel`]. It is used to instantiate an
GroupViT model according to the specified arguments, defining the model architecture. Insta... |
class GroupViTTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`GroupViTTextModel`]. It is used to instantiate an
GroupViT model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will ... | 2 | 1 | 33 | 1 | 32 | 0 | 1 | 1.29 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 90 | 10 | 35 | 34 | 15 | 45 | 17 | 16 | 15 | 1 | 1 | 0 | 1 |
2,917 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/configuration_groupvit.py | transformers.models.groupvit.configuration_groupvit.GroupViTVisionConfig | from ...configuration_utils import PretrainedConfig
class GroupViTVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`GroupViTVisionModel`]. It is used to instantiate
an GroupViT model according to the specified arguments, defining the model architecture. I... |
class GroupViTVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`GroupViTVisionModel`]. It is used to instantiate
an GroupViT model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults w... | 2 | 1 | 47 | 1 | 46 | 0 | 2 | 0.96 | 1 | 1 | 0 | 0 | 1 | 18 | 1 | 1 | 106 | 10 | 49 | 43 | 26 | 47 | 25 | 22 | 23 | 2 | 1 | 1 | 2 |
2,918 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTAssignAttention | from torch import nn
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
class GroupViTAssignAttention(nn.Module):
def __init__(self, config: GroupViTVisionConfig):
super().__init__()
self.scale = config.hidden_size ** (-0.5)
self.q_proj = nn.Linear... |
class GroupViTAssignAttention(nn.Module):
def __init__(self, config: GroupViTVisionConfig):
pass
def get_attn(self, attn, gumbel=True, hard=True):
pass
def forward(self, query, key):
pass | 4 | 0 | 14 | 3 | 10 | 1 | 2 | 0.13 | 1 | 2 | 1 | 0 | 3 | 6 | 3 | 13 | 46 | 12 | 30 | 15 | 26 | 4 | 28 | 15 | 24 | 3 | 1 | 2 | 5 |
2,919 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTAttention | import torch
from torch import nn
from typing import Any, Optional, Union
class GroupViTAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config):
super().__init__()
self.config = config
self.embed_dim = config.hidden_size
... |
class GroupViTAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.... | 4 | 2 | 34 | 5 | 27 | 2 | 4 | 0.1 | 1 | 5 | 0 | 0 | 3 | 10 | 3 | 13 | 108 | 19 | 81 | 32 | 70 | 8 | 58 | 25 | 54 | 9 | 1 | 2 | 12 |
2,920 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTCrossAttentionLayer | from torch import nn
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
class GroupViTCrossAttentionLayer(nn.Module):
def __init__(self, config: GroupViTVisionConfig):
super().__init__()
self.attn = GroupViTAttention(config)
self.norm2 = nn.LayerNo... |
class GroupViTCrossAttentionLayer(nn.Module):
def __init__(self, config: GroupViTVisionConfig):
pass
def forward(self, query, key):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 4 | 3 | 0 | 2 | 4 | 2 | 12 | 14 | 1 | 13 | 8 | 10 | 0 | 13 | 8 | 10 | 1 | 1 | 0 | 2 |
2,921 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTEncoderLayer | import torch
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
from torch import nn
from typing import Any, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
class GroupViTEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: GroupV... |
class GroupViTEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: GroupViTConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]:
'''
... | 3 | 1 | 23 | 3 | 16 | 5 | 2 | 0.31 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 48 | 6 | 32 | 17 | 23 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
2,922 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTMLP | from torch import nn
from typing import Any, Optional, Union
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
from ...activations import ACT2FN
import torch
class GroupViTMLP(nn.Module):
def __init__(self, config: GroupViTVisionConfig, hidden_size: Optional[int]=None, i... |
class GroupViTMLP(nn.Module):
def __init__(self, config: GroupViTVisionConfig, hidden_size: Optional[int]=None, intermediate_size: Optional[int]=None, output_size: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 10 | 0 | 10 | 0 | 3 | 0 | 1 | 4 | 1 | 1 | 2 | 4 | 2 | 12 | 22 | 1 | 21 | 13 | 12 | 0 | 15 | 7 | 12 | 4 | 1 | 0 | 5 |
2,923 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTMixerMLP | class GroupViTMixerMLP(GroupViTMLP):
def forward(self, x):
x = super().forward(x.transpose(1, 2))
return x.transpose(1, 2) | class GroupViTMixerMLP(GroupViTMLP):
def forward(self, x):
pass | 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 13 | 4 | 0 | 4 | 2 | 2 | 0 | 4 | 2 | 2 | 1 | 2 | 0 | 1 |
2,924 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTModel | from typing import Any, Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTV... | @auto_docstring
class GroupViTModel(GroupViTPreTrainedModel):
def __init__(self, config: GroupViTConfig):
pass
@filter_out_non_signature_kwargs()
@auto_docstring
def get_text_features(self, input_ids: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor... | 11 | 3 | 69 | 11 | 43 | 16 | 6 | 0.35 | 1 | 11 | 6 | 0 | 4 | 9 | 4 | 5 | 284 | 46 | 177 | 66 | 143 | 62 | 77 | 38 | 72 | 12 | 2 | 2 | 23 |
2,925 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTModelOutput | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
import torch
from typing import Any, Optional, Union
from dataclasses import dataclass
@dataclass
@auto_docstring
class GroupViTModelOutput(M... | @dataclass
@auto_docstring
class GroupViTModelOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for image-text similarity.
logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batch_size)`):
... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 2 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 48 | 6 | 14 | 10 | 12 | 28 | 11 | 10 | 9 | 2 | 1 | 0 | 2 |
2,926 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTPatchEmbeddings | from typing import Any, Optional, Union
import torch
from torch import nn
import collections.abc
class GroupViTPatchEmbeddings(nn.Module):
"""
Image to Patch Embedding.
"""
def __init__(self, image_size: int=224, patch_size: Union[int, tuple[int, int]]=16, num_channels: int=3, embed_dim: int=768):
... |
class GroupViTPatchEmbeddings(nn.Module):
'''
Image to Patch Embedding.
'''
def __init__(self, image_size: int=224, patch_size: Union[int, tuple[int, int]]=16, num_channels: int=3, embed_dim: int=768):
pass
def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding: bool=False... | 3 | 1 | 13 | 1 | 13 | 0 | 3 | 0.12 | 1 | 6 | 0 | 0 | 2 | 4 | 2 | 12 | 32 | 3 | 26 | 16 | 17 | 3 | 17 | 10 | 14 | 3 | 1 | 2 | 6 |
2,927 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTPreTrainedModel | from ...modeling_utils import PreTrainedModel
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
@auto_docstring
class GroupViTPreTrainedModel(PreTrainedM... | @auto_docstring
class GroupViTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 32 | 2 | 27 | 3 | 7 | 0.23 | 1 | 3 | 3 | 3 | 1 | 0 | 1 | 1 | 42 | 4 | 31 | 10 | 29 | 7 | 28 | 10 | 26 | 7 | 1 | 2 | 7 |
2,928 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTStage | from typing import Any, Optional, Union
from torch import nn
import torch
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
class GroupViTStage(nn.Module):
"""This corresponds to the `GroupingLayer` class in the GroupViT implementation."""
def __init__(self, config: ... |
class GroupViTStage(nn.Module):
'''This corresponds to the `GroupingLayer` class in the GroupViT implementation.'''
def __init__(self, config: GroupViTVisionConfig, depth: int, num_prev_group_token: int, num_group_token: int, num_output_group: int):
pass
@property
def with_group_token(self):
... | 7 | 2 | 17 | 2 | 13 | 2 | 3 | 0.14 | 1 | 9 | 4 | 0 | 5 | 6 | 5 | 15 | 92 | 13 | 69 | 32 | 50 | 10 | 44 | 19 | 38 | 6 | 1 | 2 | 15 |
2,929 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTTextEmbeddings | from typing import Any, Optional, Union
from torch import nn
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
import torch
class GroupViTTextEmbeddings(nn.Module):
def __init__(self, config: GroupViTTextConfig):
super().__init__()
embed_dim = config.hidd... |
class GroupViTTextEmbeddings(nn.Module):
def __init__(self, config: GroupViTTextConfig):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None) -> torch.Tensor:
pass | 3 | 0 | 18 | 4 | 14 | 1 | 3 | 0.03 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 38 | 8 | 29 | 15 | 21 | 1 | 19 | 10 | 16 | 5 | 1 | 1 | 6 |
2,930 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTTextEncoder | from typing import Any, Optional, Union
import torch
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import nn
class GroupViTTextEncoder(nn.Module):
"""
Transformer encoder consis... |
class GroupViTTextEncoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self-attention layers. Each layer is a
[`GroupViTEncoderLayer`].
Args:
config: GroupViTTextConfig
'''
def __init__(self, config: GroupViTTextConfig):
pass
def forward(sel... | 3 | 2 | 43 | 5 | 25 | 13 | 7 | 0.61 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 95 | 13 | 51 | 19 | 40 | 31 | 27 | 11 | 24 | 12 | 1 | 2 | 13 |
2,931 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTTextModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import nn
import torch
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from typing imp... |
class GroupViTTextModel(GroupViTPreTrainedModel):
def __init__(self, config: GroupViTTextConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
def set_input_embeddings(self, value):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, a... | 6 | 1 | 11 | 1 | 6 | 3 | 1 | 0.45 | 1 | 6 | 3 | 0 | 4 | 1 | 4 | 5 | 51 | 9 | 29 | 16 | 14 | 13 | 12 | 7 | 7 | 1 | 2 | 0 | 4 |
2,932 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTTextTransformer | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from ...modeling_attn_mask_utils import _create_4d_causal_attention_mask, _prepare_4d_att... |
class GroupViTTextTransformer(nn.Module):
def __init__(self, config: GroupViTTextConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, output_attentions: Optional[bool]=None, o... | 4 | 0 | 46 | 6 | 31 | 9 | 5 | 0.26 | 1 | 9 | 4 | 0 | 2 | 5 | 2 | 12 | 95 | 13 | 65 | 24 | 52 | 17 | 30 | 15 | 27 | 8 | 1 | 1 | 9 |
2,933 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTTokenAssign | from torch import nn
import collections.abc
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
class GroupViTTokenAssign(nn.Module):
def __init__(self, config: GroupViTVisionConfig, num_group_token, num_output_group):
super().__init__()
self.num_output_gro... |
class GroupViTTokenAssign(nn.Module):
def __init__(self, config: GroupViTVisionConfig, num_group_token, num_output_group):
pass
def project_group_token(self, group_tokens):
'''
Args:
group_tokens (torch.Tensor): group tokens, [batch_size, num_group_tokens, channels]
... | 4 | 2 | 17 | 2 | 10 | 5 | 1 | 0.48 | 1 | 8 | 5 | 0 | 3 | 9 | 3 | 13 | 53 | 7 | 31 | 18 | 27 | 15 | 27 | 18 | 23 | 2 | 1 | 0 | 4 |
2,934 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTVisionEmbeddings | from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
import torch
from torch import nn
class GroupViTVisionEmbeddings(nn.Module):
def __init__(self, config: GroupViTVisionC... |
class GroupViTVisionEmbeddings(nn.Module):
def __init__(self, config: GroupViTVisionConfig):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate the pre-trained position encodings, to be able... | 4 | 1 | 23 | 5 | 15 | 3 | 2 | 0.2 | 1 | 6 | 2 | 0 | 3 | 6 | 3 | 13 | 72 | 17 | 46 | 21 | 42 | 9 | 35 | 21 | 31 | 2 | 1 | 1 | 5 |
2,935 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTVisionEncoder | from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
import torch
from torch import nn
class GroupViTVisionEncoder(nn.Module):
def __init__(self, config: Grou... |
class GroupViTVisionEncoder(nn.Module):
def __init__(self, config: GroupViTVisionConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, output_hidden_states: Optional[bool]=None, output_attentions: Optional[bool]=None, return_dict: Optional[bool]=None) -> Union[tuple, BaseModelOutput]:
... | 3 | 0 | 27 | 4 | 23 | 0 | 7 | 0 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 56 | 9 | 47 | 17 | 38 | 0 | 26 | 11 | 23 | 11 | 1 | 2 | 13 |
2,936 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTVisionModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from typing import Any, Optional, Union
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
import to... |
class GroupViTVisionModel(GroupViTPreTrainedModel):
def __init__(self, config: GroupViTVisionConfig):
pass
def get_input_embeddings(self) -> GroupViTPatchEmbeddings:
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool... | 5 | 1 | 14 | 2 | 6 | 6 | 1 | 0.71 | 1 | 6 | 4 | 0 | 3 | 1 | 3 | 4 | 50 | 9 | 24 | 14 | 12 | 17 | 11 | 7 | 7 | 1 | 2 | 0 | 3 |
2,937 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/groupvit/modeling_groupvit.py | transformers.models.groupvit.modeling_groupvit.GroupViTVisionTransformer | import torch
from torch import nn
from typing import Any, Optional, Union
from .configuration_groupvit import GroupViTConfig, GroupViTTextConfig, GroupViTVisionConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kw... |
class GroupViTVisionTransformer(nn.Module):
def __init__(self, config: GroupViTVisionConfig):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_hidden_states: Optional[bool]=None, output_attentions: Optional[bool]=None, return_dict: Optional[bool]=None) ... | 4 | 0 | 26 | 5 | 20 | 2 | 4 | 0.1 | 1 | 7 | 4 | 0 | 2 | 4 | 2 | 12 | 56 | 10 | 42 | 19 | 31 | 4 | 22 | 12 | 19 | 6 | 1 | 1 | 7 |
2,938 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/configuration_helium.py | transformers.models.helium.configuration_helium.HeliumConfig | from ...configuration_utils import PretrainedConfig
class HeliumConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`HeliumModel`]. It is used to instantiate an Helium
model according to the specified arguments, defining the model architecture. Instantiating a con... |
class HeliumConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`HeliumModel`]. It is used to instantiate an Helium
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a simila... | 2 | 1 | 48 | 1 | 47 | 0 | 1 | 1.1 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 127 | 3 | 59 | 44 | 34 | 65 | 22 | 21 | 20 | 1 | 1 | 0 | 1 |
2,939 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumAttention | from .configuration_helium import HeliumConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from typing import Callable, Optional, Union
from ...utils.deprecation import deprecate_kwarg
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...cache_utils import Cache, ... |
class HeliumAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: HeliumConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: to... | 4 | 1 | 34 | 4 | 30 | 1 | 3 | 0.03 | 1 | 6 | 3 | 0 | 2 | 11 | 2 | 12 | 72 | 9 | 61 | 31 | 50 | 2 | 34 | 23 | 31 | 5 | 1 | 2 | 6 |
2,940 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumDecoderLayer | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache
from typing import Callable, Optional, Union
import torch.nn as nn
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenCla... |
class HeliumDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: HeliumConfig, 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, attention_mask: Optional[torch.Tensor]=N... | 4 | 0 | 25 | 4 | 21 | 2 | 2 | 0.07 | 1 | 10 | 6 | 0 | 2 | 5 | 2 | 12 | 52 | 8 | 42 | 22 | 28 | 3 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
2,941 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumForCausalLM | import torch
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...generation import GenerationMixin
from ...cache_utils import Cache, DynamicCache
import torch.nn as nn
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...modeling_outputs import BaseMo... | @auto_docstring
class HeliumForCausalLM(HeliumPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]... | 6 | 1 | 14 | 2 | 9 | 4 | 2 | 0.38 | 2 | 10 | 5 | 0 | 8 | 3 | 8 | 9 | 123 | 21 | 74 | 36 | 47 | 28 | 36 | 20 | 27 | 8 | 2 | 1 | 15 |
2,942 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class HeliumForSequenceClassification(GenericForSequenceClassification, HeliumPreTrainedModel):
pass |
class HeliumForSequenceClassification(GenericForSequenceClassification, HeliumPreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 8 | 4 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
2,943 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumForTokenClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class HeliumForTokenClassification(GenericForTokenClassification, HeliumPreTrainedModel):
pass |
class HeliumForTokenClassification(GenericForTokenClassification, HeliumPreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 6 | 3 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
2,944 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumMLP | from ...activations import ACT2FN
import torch.nn as nn
class HeliumMLP(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.hi... |
class HeliumMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
2,945 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumModel | import torch.nn as nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...utils.generic import check_model_inputs
from ...masking_utils import create_causal_mask
import torch
from .configuration_helium import HeliumConfig
from ...cache_utils import Cache, DynamicCache
from ...process... | @auto_docstring
class HeliumModel(HeliumPreTrainedModel):
def __init__(self, config: HeliumConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, ... | 6 | 0 | 40 | 5 | 30 | 6 | 6 | 0.22 | 1 | 16 | 10 | 0 | 5 | 7 | 6 | 7 | 257 | 34 | 184 | 65 | 146 | 40 | 89 | 34 | 82 | 21 | 2 | 2 | 37 |
2,946 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_helium import HeliumConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
@auto_docstring
class HeliumPreTrainedModel(PreTrainedModel):
config: HeliumConfig
base_model_prefix = 'model'
supp... | @auto_docstring
class HeliumPreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
2,947 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modeling_helium.py | transformers.models.helium.modeling_helium.HeliumRotaryEmbedding | from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from .configuration_helium import HeliumConfig
import torch.nn as nn
class HeliumRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: HeliumConfig, device=None):
super().__init__()
... |
class HeliumRotaryEmbedding(nn.Module):
def __init__(self, config: HeliumConfig, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.35 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 14 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
2,948 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumAttention | import torch.nn as nn
from typing import Optional
import math
from .configuration_helium import HeliumConfig
from ..granite.modeling_granite import GraniteAttention
class HeliumAttention(GraniteAttention):
def __init__(self, config: HeliumConfig, layer_idx: Optional[int]=None):
super().__init__(config, la... |
class HeliumAttention(GraniteAttention):
def __init__(self, config: HeliumConfig, layer_idx: Optional[int]=None):
pass | 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 1 | 2 | 1 | 13 | 5 | 0 | 5 | 4 | 3 | 0 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
2,949 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumDecoderLayer | from .configuration_helium import HeliumConfig
from ..llama.modeling_llama import LlamaDecoderLayer, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
from typing import Optional
class HeliumDecoderLayer(LlamaDecoderLayer):
def __init__(self, config: HeliumConfig, layer_idx: Optional[int]=None):
... |
class HeliumDecoderLayer(LlamaDecoderLayer):
def __init__(self, config: HeliumConfig, layer_idx: Optional[int]=None):
pass | 2 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 1 | 5 | 3 | 0 | 1 | 3 | 1 | 13 | 7 | 1 | 6 | 5 | 4 | 0 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
2,950 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumForCausalLM | from ..gemma.modeling_gemma import GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification
class HeliumForCausalLM(GemmaForCausalLM):
pass |
class HeliumForCausalLM(GemmaForCausalLM):
pass | 1 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 1 | 1 | 1 | 10 | 5 | 0 | 5 | 3 | 3 | 0 | 5 | 3 | 3 | 1 | 3 | 0 | 1 |
2,951 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumForSequenceClassification | from ..gemma.modeling_gemma import GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification
class HeliumForSequenceClassification(GemmaForSequenceClassification):
pass |
class HeliumForSequenceClassification(GemmaForSequenceClassification):
pass | 1 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 1 | 1 | 1 | 6 | 5 | 0 | 5 | 3 | 3 | 0 | 5 | 3 | 3 | 1 | 3 | 0 | 1 |
2,952 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumForTokenClassification | from ..gemma.modeling_gemma import GemmaForCausalLM, GemmaForSequenceClassification, GemmaForTokenClassification
class HeliumForTokenClassification(GemmaForTokenClassification):
pass |
class HeliumForTokenClassification(GemmaForTokenClassification):
pass | 1 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 1 | 1 | 1 | 6 | 5 | 0 | 5 | 3 | 3 | 0 | 5 | 3 | 3 | 1 | 3 | 0 | 1 |
2,953 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumMLP | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
class HeliumMLP(LlamaMLP):
pass |
class HeliumMLP(LlamaMLP):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,954 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumModel | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
from .configuration_helium import HeliumConfig
import torch.nn as nn
class HeliumModel(HeliumPreTrainedModel, LlamaModel):
def __init__(self, config: HeliumConfig):
super().__init__(confi... |
class HeliumModel(HeliumPreTrainedModel, LlamaModel):
def __init__(self, config: HeliumConfig):
pass | 2 | 0 | 11 | 1 | 9 | 1 | 1 | 0.1 | 2 | 6 | 4 | 0 | 1 | 4 | 1 | 8 | 12 | 1 | 10 | 6 | 8 | 1 | 8 | 6 | 6 | 1 | 3 | 0 | 1 |
2,955 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumPreTrainedModel | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
class HeliumPreTrainedModel(LlamaPreTrainedModel):
pass |
class HeliumPreTrainedModel(LlamaPreTrainedModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,956 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumRMSNorm | import torch.nn as nn
import torch
class HeliumRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps
def forward(self, hidden_states):
input_dtype = hidden_states.dtype... |
class HeliumRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 4 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 15 | 2 | 13 | 8 | 9 | 0 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
2,957 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/helium/modular_helium.py | transformers.models.helium.modular_helium.HeliumRotaryEmbedding | from ..llama.modeling_llama import LlamaDecoderLayer, LlamaMLP, LlamaModel, LlamaPreTrainedModel, LlamaRotaryEmbedding
class HeliumRotaryEmbedding(LlamaRotaryEmbedding):
pass |
class HeliumRotaryEmbedding(LlamaRotaryEmbedding):
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 |
2,958 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/herbert/tokenization_herbert.py | transformers.models.herbert.tokenization_herbert.HerbertTokenizer | import os
from typing import Optional
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import json
class HerbertTokenizer(PreTrainedTokenizer):
"""
Construct a BPE tokenizer for HerBERT.
Peculiarities:
- uses BERT's pre-tokenizer: BaseTokenizer split... |
class HerbertTokenizer(PreTrainedTokenizer):
'''
Construct a BPE tokenizer for HerBERT.
Peculiarities:
- uses BERT's pre-tokenizer: BaseTokenizer splits tokens on spaces, and also on punctuation. Each occurrence of a
punctuation character will be treated separately.
- Such pretokenized input ... | 21 | 6 | 17 | 2 | 12 | 3 | 2 | 0.31 | 1 | 14 | 1 | 0 | 19 | 16 | 19 | 108 | 368 | 54 | 240 | 102 | 182 | 74 | 163 | 62 | 140 | 10 | 3 | 3 | 46 |
2,959 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/herbert/tokenization_herbert_fast.py | transformers.models.herbert.tokenization_herbert_fast.HerbertTokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_herbert import HerbertTokenizer
from typing import Optional
class HerbertTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "Fast" BPE tokenizer for HerBERT (backed by HuggingFace's *tokenizers* library).
Peculiarities:... |
class HerbertTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "Fast" BPE tokenizer for HerBERT (backed by HuggingFace's *tokenizers* library).
Peculiarities:
- uses BERT's pre-tokenizer: BertPreTokenizer splits tokens on spaces, and also on punctuation. Each occurrence of
a punctuation cha... | 5 | 3 | 21 | 2 | 10 | 8 | 2 | 0.98 | 1 | 5 | 0 | 0 | 5 | 0 | 5 | 93 | 131 | 22 | 55 | 30 | 32 | 54 | 26 | 13 | 20 | 3 | 3 | 1 | 9 |
2,960 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/configuration_hiera.py | transformers.models.hiera.configuration_hiera.HieraConfig | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from ...configuration_utils import PretrainedConfig
class HieraConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`HieraModel`]. It is used to ins... |
class HieraConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`HieraModel`]. It is used to instantiate a Hiera
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults wi... | 2 | 1 | 74 | 2 | 70 | 2 | 3 | 1.11 | 2 | 4 | 0 | 0 | 1 | 29 | 1 | 6 | 167 | 13 | 73 | 61 | 42 | 81 | 37 | 32 | 35 | 3 | 1 | 1 | 3 |
2,961 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraBackbone | from torch import nn
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, ModelOutput
from typing import Optional, Union
from ...utils import auto_docstring, logging, torch_int
import torch
from ...utils.backbone_utils import BackboneMixin
from .configurati... | @auto_docstring(custom_intro='\n Hiera backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class HieraBackbone(HieraPreTrainedModel, BackboneMixin):
def __init__(self, config: HieraConfig):
pass
def get_input_embeddings(self):
pass
def forward(self, pixel_values: tor... | 5 | 1 | 31 | 5 | 19 | 7 | 5 | 0.38 | 2 | 10 | 4 | 0 | 3 | 4 | 3 | 16 | 96 | 16 | 58 | 23 | 48 | 22 | 38 | 17 | 34 | 11 | 2 | 2 | 14 |
2,962 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraDecoder | from .configuration_hiera import HieraConfig
from torch import nn
from typing import Optional, Union
import math
import torch
class HieraDecoder(nn.Module):
def __init__(self, config: HieraConfig):
super().__init__()
num_features = int(config.embed_dim * config.embed_dim_multiplier ** (len(config.... |
class HieraDecoder(nn.Module):
def __init__(self, config: HieraConfig):
pass
def forward(self, encoder_hidden_states: torch.Tensor, bool_masked_pos: torch.BoolTensor, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> tuple[torch.Tensor, torch.BoolTensor]:
pass | 3 | 0 | 51 | 8 | 38 | 5 | 1 | 0.13 | 1 | 7 | 2 | 0 | 2 | 9 | 2 | 12 | 103 | 17 | 76 | 27 | 67 | 10 | 34 | 21 | 31 | 1 | 1 | 0 | 2 |
2,963 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraDropPath | from typing import Optional, Union
import torch
from torch import nn
class HieraDropPath(nn.Module):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
def __init__(self, drop_prob: Optional[float]=None) -> None:
super().__init__()
self.drop_prob = d... |
class HieraDropPath(nn.Module):
'''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).'''
def __init__(self, drop_prob: Optional[float]=None) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass
def extra_repr(self) -... | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.13 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 13 | 12 | 3 | 8 | 5 | 4 | 1 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
2,964 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraEmbeddings | import torch
from .configuration_hiera import HieraConfig
import math
from typing import Optional, Union
from torch import nn
from ...utils import auto_docstring, logging, torch_int
class HieraEmbeddings(nn.Module):
"""
Construct position and patch embeddings.
"""
def __init__(self, config: HieraConfi... |
class HieraEmbeddings(nn.Module):
'''
Construct position and patch embeddings.
'''
def __init__(self, config: HieraConfig, is_mae: bool=False) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, pos_embeds: torch.Tensor, height: int, width: int) -> torch.Tensor:
... | 5 | 2 | 17 | 3 | 12 | 2 | 2 | 0.22 | 1 | 7 | 2 | 0 | 4 | 6 | 4 | 14 | 74 | 14 | 49 | 29 | 35 | 11 | 31 | 20 | 26 | 2 | 1 | 1 | 6 |
2,965 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraEncoder | from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, ModelOutput
from .configuration_hiera import HieraConfig
from torch import nn
import math
import torch
from typing import Optional, Union
class HieraEncoder(nn.Module):
def __init__(self, config: Hi... |
class HieraEncoder(nn.Module):
def __init__(self, config: HieraConfig) -> None:
pass
def reroll(self, hidden_states: torch.Tensor, stage_idx: int, bool_masked_pos: Optional[torch.BoolTensor]=None) -> torch.Tensor:
'''
Roll the given tensor back up to spatial order assuming it's from t... | 4 | 1 | 48 | 7 | 34 | 7 | 7 | 0.21 | 1 | 12 | 4 | 0 | 3 | 3 | 3 | 13 | 147 | 24 | 102 | 44 | 88 | 21 | 67 | 34 | 63 | 11 | 1 | 2 | 20 |
2,966 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraEncoderOutput | from dataclasses import dataclass
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, ModelOutput
from ...utils import auto_docstring, logging, torch_int
import torch
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro="\n Hiera ... | @dataclass
@auto_docstring(custom_intro="\n Hiera encoder's outputs, with potential hidden states and attentions.\n ")
class HieraEncoderOutput(ModelOutput):
'''
reshaped_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidde... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 30 | 5 | 5 | 5 | 4 | 20 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
2,967 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraForImageClassification | import torch
from ...utils import auto_docstring, logging, torch_int
from torch import nn
from .configuration_hiera import HieraConfig
from typing import Optional, Union
@auto_docstring(custom_intro="\n Hiera Model transformer with an image classification head on top (a linear layer on top of the final hidden state... | @auto_docstring(custom_intro="\n Hiera Model transformer with an image classification head on top (a linear layer on top of the final hidden state with\n average pooling) e.g. for ImageNet.\n\n <Tip>\n\n Note that it's possible to fine-tune Hiera on higher resolution images than the ones it has been tra... | 5 | 1 | 42 | 5 | 33 | 5 | 8 | 0.12 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 93 | 11 | 73 | 22 | 54 | 9 | 35 | 12 | 32 | 14 | 2 | 3 | 16 |
2,968 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraForImageClassificationOutput | from dataclasses import dataclass
import torch
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, ModelOutput
from ...utils import auto_docstring, logging, torch_int
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Hiera ... | @dataclass
@auto_docstring(custom_intro='\n Hiera image classification outputs.\n ')
class HieraForImageClassificationOutput(ImageClassifierOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, `optional`):
Loss value for the training task.
logits (`torch.FloatTensor` of shape `(batch_size, ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.67 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 5 | 6 | 6 | 5 | 22 | 6 | 6 | 5 | 0 | 2 | 0 | 0 |
2,969 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraForPreTraining | from ...utils import auto_docstring, logging, torch_int
import torch
from typing import Optional, Union
from torch import nn
from .configuration_hiera import HieraConfig
@auto_docstring(custom_intro='\n The Hiera Model transformer with the decoder on top for self-supervised pre-training.\n\n <Tip>\n\n Note th... | @auto_docstring(custom_intro='\n The Hiera Model transformer with the decoder on top for self-supervised pre-training.\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/transformers/tree/main/examples/pytorch/image... | 7 | 1 | 32 | 4 | 20 | 8 | 4 | 0.36 | 1 | 9 | 5 | 0 | 4 | 5 | 4 | 5 | 134 | 20 | 84 | 34 | 68 | 30 | 50 | 24 | 45 | 11 | 2 | 2 | 15 |
2,970 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraForPreTrainingOutput | from ...utils import auto_docstring, logging, torch_int
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, ModelOutput
from dataclasses import dataclass
from typing import Optional, Union
import torch
@dataclass
@auto_docstring(custom_intro="\n Class ... | @dataclass
@auto_docstring(custom_intro="\n Class for HieraForPreTraining's outputs, with potential hidden states and attentions.\n ")
class HieraForPreTrainingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`):
Pixel reconstruction loss.
logits (`torch.FloatTensor` of shape `... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 2 | 8 | 8 | 7 | 24 | 8 | 8 | 7 | 0 | 1 | 0 | 0 |
2,971 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraLayer | from torch import nn
import torch
from typing import Optional, Union
class HieraLayer(nn.Module):
def __init__(self, config, hidden_size: int, hidden_size_output: int, num_heads: int, drop_path: float=0.0, query_stride: int=1, window_size: int=0, use_mask_unit_attn: bool=False) -> None:
super().__init__()... |
class HieraLayer(nn.Module):
def __init__(self, config, hidden_size: int, hidden_size_output: int, num_heads: int, drop_path: float=0.0, query_stride: int=1, window_size: int=0, use_mask_unit_attn: bool=False) -> None:
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Floa... | 3 | 0 | 30 | 4 | 26 | 1 | 3 | 0.04 | 1 | 8 | 3 | 0 | 2 | 9 | 2 | 12 | 62 | 8 | 52 | 31 | 34 | 2 | 26 | 16 | 23 | 3 | 1 | 1 | 5 |
2,972 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraMaskUnitAttention | from typing import Optional, Union
import torch
from torch import nn
class HieraMaskUnitAttention(nn.Module):
"""
Computes either Mask Unit or Global Attention. Also is able to perform query pooling.
Note: this assumes the tokens have already been flattened and unrolled into mask units.
"""
def _... |
class HieraMaskUnitAttention(nn.Module):
'''
Computes either Mask Unit or Global Attention. Also is able to perform query pooling.
Note: this assumes the tokens have already been flattened and unrolled into mask units.
'''
def __init__(self, hidden_size: int, hidden_size_output: int, num_heads: in... | 3 | 2 | 29 | 6 | 22 | 2 | 3 | 0.16 | 1 | 4 | 0 | 0 | 2 | 9 | 2 | 12 | 66 | 14 | 45 | 31 | 29 | 7 | 32 | 18 | 29 | 5 | 1 | 1 | 6 |
2,973 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraMlp | import torch
from torch import nn
from ...activations import ACT2FN
class HieraMlp(nn.Module):
def __init__(self, config, dim: int) -> None:
super().__init__()
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(dim, int(dim * config.mlp_ratio))
self.fc2 = nn.Linear... |
class HieraMlp(nn.Module):
def __init__(self, config, dim: int) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
2,974 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraModel | from .configuration_hiera import HieraConfig
import math
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, ModelOutput
from ...utils import auto_docstring, logging, torch_int
import torch
from typing import Optional, Union
@auto_docstring
class HieraMod... | @auto_docstring
class HieraModel(HieraPreTrainedModel):
def __init__(self, config: HieraConfig, add_pooling_layer: bool=True, is_mae: bool=False):
'''
add_pooling_layer (`bool`, *optional*, defaults to `True`):
Whether or not to apply pooling layer.
is_mae (`bool`, *optional*, d... | 7 | 3 | 26 | 3 | 19 | 4 | 4 | 0.19 | 1 | 12 | 7 | 0 | 4 | 5 | 4 | 5 | 114 | 15 | 83 | 31 | 61 | 16 | 40 | 21 | 35 | 10 | 2 | 1 | 15 |
2,975 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraModelOutput | from typing import Optional, Union
import torch
from ...utils import auto_docstring, logging, torch_int
from ...modeling_outputs import BackboneOutput, BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput, ModelOutput
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro="\n Hiera ... | @dataclass
@auto_docstring(custom_intro="\n Hiera model's outputs that also contains a pooling of the last hidden states.\n ")
class HieraModelOutput(ModelOutput):
'''
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*, returned when `add_pooling_layer=True` is passed):
... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 39 | 5 | 8 | 8 | 7 | 26 | 8 | 8 | 7 | 0 | 1 | 0 | 0 |
2,976 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraMultiScaleHead | import torch
from torch import nn
from .configuration_hiera import HieraConfig
class HieraMultiScaleHead(nn.Module):
def __init__(self, config: HieraConfig):
super().__init__()
self.mask_unit_spatial_shape_final = [i // s ** config.num_query_pool for i, s in zip(config.masked_unit_size, config.que... |
class HieraMultiScaleHead(nn.Module):
def __init__(self, config: HieraConfig):
pass
def apply_fusion_head(self, head: nn.Module, hidden_states: torch.Tensor) -> torch.Tensor:
pass
def forward(self, feature_maps: list[torch.Tensor]) -> torch.Tensor:
pass | 4 | 0 | 17 | 2 | 14 | 2 | 2 | 0.12 | 1 | 6 | 1 | 0 | 3 | 3 | 3 | 13 | 55 | 7 | 43 | 14 | 39 | 5 | 28 | 14 | 24 | 2 | 1 | 1 | 6 |
2,977 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraPatchEmbeddings | from torch import nn
from typing import Optional, Union
import torch
import math
class HieraPatchEmbeddings(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... |
class HieraPatchEmbeddings(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, i... | 5 | 3 | 21 | 3 | 13 | 5 | 2 | 0.45 | 1 | 6 | 0 | 0 | 4 | 8 | 4 | 14 | 92 | 15 | 53 | 30 | 40 | 24 | 37 | 22 | 32 | 2 | 1 | 1 | 8 |
2,978 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraPooler | from torch import nn
import torch
from .configuration_hiera import HieraConfig
class HieraPooler(nn.Module):
def __init__(self, config: HieraConfig):
super().__init__()
num_features = int(config.embed_dim * config.embed_dim_multiplier ** (len(config.depths) - 1))
self.layernorm = nn.LayerN... |
class HieraPooler(nn.Module):
def __init__(self, config: HieraConfig):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
2,979 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraPreTrainedModel | from torch import nn
from ...modeling_utils import PreTrainedModel
from .configuration_hiera import HieraConfig
from ...utils import auto_docstring, logging, torch_int
@auto_docstring
class HieraPreTrainedModel(PreTrainedModel):
config: HieraConfig
base_model_prefix = 'hiera'
main_input_name = 'pixel_value... | @auto_docstring
class HieraPreTrainedModel(PreTrainedModel):
def _init_weights(self, module) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 19 | 4 | 14 | 1 | 6 | 0.26 | 1 | 2 | 2 | 4 | 1 | 0 | 1 | 1 | 30 | 6 | 19 | 7 | 17 | 5 | 16 | 7 | 14 | 6 | 1 | 2 | 6 |
2,980 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hiera/modeling_hiera.py | transformers.models.hiera.modeling_hiera.HieraStage | from ...modeling_layers import GradientCheckpointingLayer
import torch
from typing import Optional, Union
from torch import nn
class HieraStage(GradientCheckpointingLayer):
def __init__(self, config, depth: int, hidden_size: int, hidden_size_output: int, num_heads: int, drop_path: list[float], query_stride: list[... |
class HieraStage(GradientCheckpointingLayer):
def __init__(self, config, depth: int, hidden_size: int, hidden_size_output: int, num_heads: int, drop_path: list[float], query_stride: list[int], window_size: int, use_mask_unit_attn: bool, stage_num: Optional[int]=None) -> None:
pass
def forward(self, h... | 3 | 0 | 23 | 1 | 21 | 2 | 4 | 0.1 | 1 | 8 | 1 | 0 | 2 | 1 | 2 | 12 | 48 | 2 | 42 | 22 | 25 | 4 | 12 | 8 | 9 | 4 | 1 | 1 | 7 |
2,981 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/configuration_hubert.py | transformers.models.hubert.configuration_hubert.HubertConfig | import functools
import operator
from ...configuration_utils import PretrainedConfig
class HubertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`HubertModel`]. It is used to instantiate an
Hubert model according to the specified arguments, defining the model ... | null | 4 | 1 | 50 | 2 | 47 | 1 | 2 | 1.29 | 1 | 3 | 0 | 0 | 2 | 37 | 2 | 2 | 236 | 14 | 97 | 84 | 51 | 125 | 45 | 41 | 42 | 2 | 1 | 1 | 3 |
2,982 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertAttention | from .configuration_hubert import HubertConfig
from ...processing_utils import Unpack
import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Callable, Optional, Union
from ...modeling_flash_attention_utils import FlashAttentionKwargs
import torch.nn as nn
class HubertAtt... |
class HubertAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[HubertConfig]=None):
pass
def forward(self,... | 3 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 2 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
2,983 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertAttnAdapterLayer | import torch.nn as nn
import torch
class HubertAttnAdapterLayer(nn.Module):
def __init__(self, config):
"""
Implements adapter modules directly with 3D tensor weight as parameters and without using ModuleList to speed
up training throughput.
"""
super().__init__()
s... |
class HubertAttnAdapterLayer(nn.Module):
def __init__(self, config):
'''
Implements adapter modules directly with 3D tensor weight as parameters and without using ModuleList to speed
up training throughput.
'''
pass
def forward(self, hidden_states: torch.FloatTensor):
... | 3 | 1 | 11 | 2 | 7 | 2 | 1 | 0.27 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 23 | 4 | 15 | 9 | 12 | 4 | 15 | 9 | 12 | 1 | 1 | 0 | 2 |
2,984 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertEncoder | from ...integrations.deepspeed import is_deepspeed_zero3_enabled
import torch.nn as nn
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from ...integrations.fsdp import is_fsdp_managed_module
import torch
from typing import Callable, Optional, Union
from ...modeling_attn_mask_ut... |
class HubertEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.tensor, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=True):
pass
def _update_full_mask(self, attentio... | 4 | 0 | 41 | 5 | 33 | 3 | 8 | 0.07 | 1 | 8 | 3 | 0 | 2 | 7 | 2 | 12 | 83 | 11 | 67 | 26 | 57 | 5 | 45 | 19 | 42 | 15 | 1 | 3 | 16 |
2,985 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertEncoderLayer | import torch.nn as nn
from ...modeling_layers import GradientCheckpointingLayer
class HubertEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = HubertAttention(embed_dim=config.hidden_size, num_heads=config.num_attention_heads, dropout=config.a... |
class HubertEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False):
pass | 3 | 0 | 16 | 3 | 13 | 0 | 2 | 0 | 1 | 2 | 1 | 0 | 2 | 5 | 2 | 12 | 33 | 6 | 27 | 11 | 24 | 0 | 20 | 11 | 17 | 2 | 1 | 1 | 3 |
2,986 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertEncoderLayerStableLayerNorm | import torch
import torch.nn as nn
from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
class HubertEncoderLayerStableLayerNorm(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = HubertAttention(embed_dim=c... |
class HubertEncoderLayerStableLayerNorm(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False):
pass | 3 | 0 | 21 | 3 | 18 | 0 | 3 | 0 | 1 | 5 | 2 | 0 | 2 | 6 | 2 | 12 | 43 | 6 | 37 | 17 | 29 | 0 | 24 | 12 | 21 | 3 | 1 | 1 | 5 |
2,987 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertEncoderStableLayerNorm | from ...integrations.fsdp import is_fsdp_managed_module
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
import torch
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
from typing import Callable, Optional, Union
import torch.nn as nn
from ...modelin... |
class HubertEncoderStableLayerNorm(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True):
pass
def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs... | 4 | 0 | 43 | 6 | 34 | 3 | 8 | 0.09 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 87 | 12 | 69 | 27 | 59 | 6 | 45 | 19 | 42 | 15 | 1 | 3 | 16 |
2,988 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertFeatureEncoder | import torch.nn as nn
class HubertFeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
if config.feat_extract_norm == 'group':
conv_layers = [HubertGroupNormConvLayer(config, layer_id=0)] + [HubertNoLayerNorm... |
class HubertFeatureEncoder(nn.Module):
'''Construct the features from raw audio waveform'''
def __init__(self, config):
pass
def _freeze_parameters(self):
pass
def forward(self, input_values):
pass | 4 | 1 | 12 | 1 | 11 | 0 | 3 | 0.06 | 1 | 6 | 3 | 1 | 3 | 3 | 3 | 13 | 42 | 7 | 33 | 11 | 29 | 2 | 23 | 11 | 19 | 4 | 1 | 2 | 9 |
2,989 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertFeatureProjection | import torch.nn as nn
class HubertFeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.feat_proj_layer_norm = config.feat_proj_layer_norm
if self.feat_proj_layer_norm:
self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.layer_norm_eps)
... |
class HubertFeatureProjection(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 0 | 7 | 1 | 2 | 0.07 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 16 | 1 | 14 | 7 | 11 | 1 | 14 | 7 | 11 | 2 | 1 | 1 | 4 |
2,990 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertFeedForward | from ...activations import ACT2FN
import torch.nn as nn
class HubertFeedForward(nn.Module):
def __init__(self, config):
super().__init__()
self.intermediate_dropout = nn.Dropout(config.activation_dropout)
self.intermediate_dense = nn.Linear(config.hidden_size, config.intermediate_size)
... |
class HubertFeedForward(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 2 | 9 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 4 | 18 | 8 | 15 | 0 | 17 | 8 | 14 | 2 | 1 | 1 | 3 |
2,991 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertForCTC | import torch.nn as nn
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
import torch
import warnings
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from typing import Callable, Optional, Union
@auto_docstring(custom_intro='\n Hubert Model with a `l... | @auto_docstring(custom_intro='\n Hubert Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ')
class HubertForCTC(HubertPreTrainedModel):
def __init__(self, config, target_lang: Optional[str]=None):
'''
target_lang (`str`, *optional*):
L... | 9 | 6 | 23 | 3 | 14 | 6 | 3 | 0.35 | 1 | 8 | 2 | 0 | 6 | 4 | 6 | 9 | 149 | 22 | 94 | 33 | 71 | 33 | 47 | 24 | 40 | 7 | 2 | 2 | 18 |
2,992 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertForSequenceClassification | import warnings
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
import torch
from typing import Callable, Optional, Union
from torch.nn import CrossEntropyLoss
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
import torch.nn as nn
@auto_docstring(cust... | @auto_docstring(custom_intro='\n Hubert Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like\n SUPERB Keyword Spotting.\n ')
class HubertForSequenceClassification(HubertPreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_ext... | 8 | 4 | 20 | 2 | 14 | 4 | 3 | 0.24 | 1 | 7 | 2 | 0 | 5 | 4 | 5 | 8 | 115 | 14 | 82 | 31 | 59 | 20 | 46 | 22 | 40 | 8 | 2 | 1 | 15 |
2,993 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertGroupNormConvLayer | import torch.nn as nn
from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
class HubertGroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 ... |
class HubertGroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 1 | 9 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 3 | 19 | 8 | 16 | 0 | 13 | 8 | 10 | 2 | 1 | 0 | 3 |
2,994 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertLayerNormConvLayer | from ...modeling_layers import GradientCheckpointingLayer
import torch.nn as nn
from ...activations import ACT2FN
class HubertLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 ... |
class HubertLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 12 | 2 | 10 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 25 | 4 | 21 | 8 | 18 | 0 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
2,995 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertModel | from ...utils import auto_docstring, is_torch_flex_attn_available, logging
import torch
import torch.nn as nn
from .configuration_hubert import HubertConfig
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
@auto_docstring
class Huber... | @auto_docstring
class HubertModel(HubertPreTrainedModel):
def __init__(self, config: HubertConfig):
pass
def _mask_hidden_states(self, hidden_states: torch.FloatTensor, mask_time_indices: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.LongTensor]=None):
'''
Masks extr... | 6 | 2 | 44 | 8 | 26 | 9 | 5 | 0.35 | 1 | 9 | 6 | 0 | 3 | 5 | 3 | 6 | 137 | 26 | 82 | 28 | 63 | 29 | 42 | 14 | 38 | 6 | 2 | 1 | 14 |
2,996 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertNoLayerNormConvLayer | from ...activations import ACT2FN
import torch.nn as nn
from ...modeling_layers import GradientCheckpointingLayer
class HubertNoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > ... |
class HubertNoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 19 | 2 | 17 | 7 | 14 | 0 | 11 | 7 | 8 | 2 | 1 | 0 | 3 |
2,997 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertPositionalConvEmbedding | from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from ...activations import ACT2FN
import torch.nn as nn
class HubertPositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_size=config.n... |
class HubertPositionalConvEmbedding(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 23 | 3 | 21 | 0 | 4 | 0 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 48 | 6 | 42 | 11 | 38 | 0 | 33 | 11 | 29 | 5 | 1 | 3 | 7 |
2,998 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertPreTrainedModel | import torch.nn as nn
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from .configuration_hubert import HubertConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from typing import Callable... | @auto_docstring
class HubertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _get_feat_extract_output_lengths(self, input_lengths: Union[torch.LongTensor, int]):
'''
Computes the output length of the convolutional layers
... | 6 | 2 | 13 | 2 | 9 | 3 | 3 | 0.32 | 1 | 2 | 0 | 3 | 3 | 0 | 3 | 3 | 64 | 10 | 41 | 15 | 35 | 13 | 35 | 15 | 29 | 7 | 1 | 4 | 11 |
2,999 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/hubert/modeling_hubert.py | transformers.models.hubert.modeling_hubert.HubertSamePadLayer | import torch.nn as nn
class HubertSamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
super().__init__()
self.num_pad_remove = 1 if num_conv_pos_embeddings % 2 == 0 else 0
def forward(self, hidden_states):
if self.num_pad_remove > 0:
hidden_states = hidde... |
class HubertSamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 2 | 1 | 1 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.