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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,200 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py | transformers.models.segformer.modeling_segformer.SegformerMixFFN | from torch import nn
from ...activations import ACT2FN
class SegformerMixFFN(nn.Module):
def __init__(self, config, in_features, hidden_features=None, out_features=None):
super().__init__()
out_features = out_features or in_features
self.dense1 = nn.Linear(in_features, hidden_features)
... |
class SegformerMixFFN(nn.Module):
def __init__(self, config, in_features, hidden_features=None, out_features=None):
pass
def forward(self, hidden_states, height, width):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 21 | 1 | 20 | 8 | 17 | 0 | 19 | 8 | 16 | 2 | 1 | 1 | 3 |
5,201 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py | transformers.models.segformer.modeling_segformer.SegformerModel | import torch
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput, SemanticSegmenterOutput
from typing import Optional, Union
from ...utils import auto_docstring, logging
@auto_docstring
class SegformerModel(SegformerPreTrainedModel):
def __init__(self, config):
super().__init__(config)
... | @auto_docstring
class SegformerModel(SegformerPreTrainedModel):
def __init__(self, config):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} See base
class PreTrainedModel
... | 6 | 1 | 15 | 2 | 11 | 2 | 3 | 0.14 | 1 | 4 | 2 | 0 | 3 | 2 | 3 | 4 | 56 | 7 | 43 | 16 | 25 | 6 | 18 | 9 | 14 | 5 | 2 | 1 | 8 |
5,202 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py | transformers.models.segformer.modeling_segformer.SegformerOverlapPatchEmbeddings | from torch import nn
class SegformerOverlapPatchEmbeddings(nn.Module):
"""Construct the overlapping patch embeddings."""
def __init__(self, patch_size, stride, num_channels, hidden_size):
super().__init__()
self.proj = nn.Conv2d(num_channels, hidden_size, kernel_size=patch_size, stride=stride,... |
class SegformerOverlapPatchEmbeddings(nn.Module):
'''Construct the overlapping patch embeddings.'''
def __init__(self, patch_size, stride, num_channels, hidden_size):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 10 | 1 | 8 | 1 | 1 | 0.18 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 23 | 3 | 17 | 7 | 14 | 3 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
5,203 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py | transformers.models.segformer.modeling_segformer.SegformerPreTrainedModel | from torch import nn
from ...utils import auto_docstring, logging
from .configuration_segformer import SegformerConfig
from ...modeling_utils import PreTrainedModel
@auto_docstring
class SegformerPreTrainedModel(PreTrainedModel):
config: SegformerConfig
base_model_prefix = 'segformer'
main_input_name = 'pi... | @auto_docstring
class SegformerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.44 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 25 | 2 | 16 | 5 | 14 | 7 | 14 | 5 | 12 | 6 | 1 | 2 | 6 |
5,204 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py | transformers.models.segformer.modeling_segformer.SegformerSelfOutput | from torch import nn
class SegformerSelfOutput(nn.Module):
def __init__(self, config, hidden_size):
super().__init__()
self.dense = nn.Linear(hidden_size, hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, hidden_states, input_tensor):
hidden_... |
class SegformerSelfOutput(nn.Module):
def __init__(self, config, hidden_size):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 10 | 1 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
5,205 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/configuration_seggpt.py | transformers.models.seggpt.configuration_seggpt.SegGptConfig | from ...configuration_utils import PretrainedConfig
class SegGptConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SegGptModel`]. It is used to instantiate a SegGPT
model according to the specified arguments, defining the model architecture. Instantiating a conf... |
class SegGptConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SegGptModel`]. It is used to instantiate a SegGPT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar... | 2 | 1 | 48 | 1 | 47 | 0 | 3 | 1.18 | 1 | 3 | 0 | 0 | 1 | 19 | 1 | 1 | 117 | 10 | 49 | 44 | 25 | 58 | 25 | 22 | 23 | 3 | 1 | 1 | 3 |
5,206 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/image_processing_seggpt.py | transformers.models.seggpt.image_processing_seggpt.SegGptImageProcessor | from ...image_transforms import resize, to_channel_dimension_format
import numpy as np
from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images
from ..... |
class SegGptImageProcessor(BaseImageProcessor):
'''
Constructs a SegGpt image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `(size["height"],
size["width"])`. Can be overridden b... | 8 | 7 | 68 | 6 | 34 | 27 | 6 | 0.92 | 1 | 9 | 2 | 0 | 7 | 9 | 7 | 27 | 518 | 52 | 243 | 95 | 173 | 223 | 105 | 33 | 97 | 22 | 3 | 2 | 41 |
5,207 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptAttention | from torch import nn
from torch.nn import functional as F
import torch
import collections.abc
class SegGptAttention(nn.Module):
"""Multi-head Attention block with relative position embeddings."""
def __init__(self, config):
super().__init__()
image_size, patch_size = (config.image_size, config... |
class SegGptAttention(nn.Module):
'''Multi-head Attention block with relative position embeddings.'''
def __init__(self, config):
pass
def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor) -> torch.Tensor:
'''
Get relative positional embeddings according to the re... | 5 | 3 | 34 | 5 | 18 | 11 | 3 | 0.58 | 1 | 5 | 0 | 0 | 4 | 7 | 4 | 14 | 140 | 23 | 74 | 42 | 61 | 43 | 55 | 34 | 50 | 5 | 1 | 2 | 10 |
5,208 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptDecoder | import torch
from torch import nn
class SegGptDecoder(nn.Module):
def __init__(self, config):
super().__init__()
self.decoder_embed = nn.Linear(config.hidden_size * len(config.intermediate_hidden_state_indices), config.patch_size ** 2 * config.decoder_hidden_size, bias=True)
self.decoder_p... |
class SegGptDecoder(nn.Module):
def __init__(self, config):
pass
def _reshape_hidden_states(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor:
pass
def forward(self, hidden_states: torch.FloatTensor):
pass | 4 | 0 | 9 | 1 | 9 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 3 | 5 | 3 | 13 | 31 | 4 | 27 | 10 | 23 | 0 | 19 | 10 | 15 | 1 | 1 | 0 | 3 |
5,209 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptDecoderHead | import torch
from ...activations import ACT2FN
from torch import nn
class SegGptDecoderHead(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv2d(config.decoder_hidden_size, config.decoder_hidden_size, kernel_size=3, padding=1)
self.layernorm = SegGptLayerNorm(no... |
class SegGptDecoderHead(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor):
pass | 3 | 0 | 10 | 1 | 10 | 1 | 1 | 0.05 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 22 | 2 | 20 | 7 | 17 | 1 | 13 | 7 | 10 | 1 | 1 | 0 | 2 |
5,210 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptDropPath | import torch
from torch import nn
from typing import Optional, Union
class SegGptDropPath(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 = ... |
class SegGptDropPath(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 |
5,211 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptEmbeddings | from torch import nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from typing import Optional, Union
from .configuration_seggpt import SegGptConfig
import torch
from torch.nn import functional as F
class SegGptEmbeddings(nn.Module):
"""
Construct the embeddings from patch, position embe... |
class SegGptEmbeddings(nn.Module):
'''
Construct the embeddings from patch, position embeddings for input and prompt.
'''
def __init__(self, config: SegGptConfig) -> None:
pass
def interpolate_pos_encoding(self, height: int, width: int) -> torch.Tensor:
pass
def forward(self,... | 4 | 1 | 25 | 5 | 18 | 2 | 2 | 0.18 | 1 | 7 | 2 | 0 | 3 | 8 | 3 | 13 | 83 | 18 | 55 | 30 | 45 | 10 | 41 | 24 | 37 | 4 | 1 | 1 | 7 |
5,212 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptEncoder | import torch
from torch import nn
from .configuration_seggpt import SegGptConfig
from typing import Optional, Union
class SegGptEncoder(nn.Module):
def __init__(self, config: SegGptConfig) -> None:
super().__init__()
self.config = config
dpr = [x.item() for x in torch.linspace(0, config.dr... |
class SegGptEncoder(nn.Module):
def __init__(self, config: SegGptConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, feature_ensemble: bool=False, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=True) -> Union[tuple, SegGptEncoderOutput]:
pa... | 3 | 0 | 33 | 5 | 28 | 1 | 7 | 0.02 | 1 | 9 | 3 | 0 | 2 | 4 | 2 | 12 | 67 | 10 | 56 | 21 | 46 | 1 | 31 | 14 | 28 | 12 | 1 | 2 | 13 |
5,213 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptEncoderOutput | from typing import Optional, Union
from dataclasses import dataclass
import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@dataclass
@auto_docstring(custom_intro='\n Output type of [`SegGptEncoderOutput`].\n ')
class SegGptEncoderOutput(ModelOutput):
"""
last_hidden_state (`t... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`SegGptEncoderOutput`].\n ')
class SegGptEncoderOutput(ModelOutput):
'''
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, patch_height, patch_width, hidden_size)`):
Sequence of hidden-states at the output of the last layer of... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 22 | 1 | 5 | 4 | 4 | 16 | 5 | 4 | 4 | 0 | 1 | 0 | 0 |
5,214 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptForImageSegmentation | import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from .configuration_seggpt import SegGptConfig
from typing import Optional, Union
@auto_docstring(custom_intro='\n SegGpt model with a decoder on top for one-shot image segmentation.\n ')
class SegGptForImageSegmentation(SegGptPreT... | @auto_docstring(custom_intro='\n SegGpt model with a decoder on top for one-shot image segmentation.\n ')
class SegGptForImageSegmentation(SegGptPreTrainedModel):
def __init__(self, config: SegGptConfig):
pass
@auto_docstring
def forward(self, pixel_values: torch.Tensor, prompt_pixel_values: ... | 5 | 1 | 54 | 9 | 32 | 13 | 7 | 0.39 | 1 | 9 | 5 | 0 | 2 | 3 | 2 | 3 | 111 | 18 | 67 | 27 | 50 | 26 | 35 | 14 | 32 | 12 | 2 | 2 | 13 |
5,215 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptImageSegmentationOutput | from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, logging, torch_int
import torch
from typing import Optional, Union
@dataclass
@auto_docstring(custom_intro='\n Output type of [`SegGptImageSegmentationOutput`].\n ')
class SegGptImageSegmentationOutput(ModelOutput):
"""
l... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`SegGptImageSegmentationOutput`].\n ')
class SegGptImageSegmentationOutput(ModelOutput):
'''
loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided):
The loss value.
pred_masks (`torch.FloatTensor` of shape `(batch_... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 21 | 2 | 5 | 5 | 4 | 14 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
5,216 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptLayer | import torch
from typing import Optional, Union
from torch import nn
from .configuration_seggpt import SegGptConfig
from ...modeling_layers import GradientCheckpointingLayer
class SegGptLayer(GradientCheckpointingLayer):
def __init__(self, config: SegGptConfig, drop_path_rate: float) -> None:
super().__in... |
class SegGptLayer(GradientCheckpointingLayer):
def __init__(self, config: SegGptConfig, drop_path_rate: float) -> None:
pass
def forward(self, hidden_states: torch.Tensor, ensemble_cond: int, feature_ensemble: bool=False, output_attentions: bool=False) -> Union[tuple[torch.Tensor, torch.Tensor], tupl... | 3 | 0 | 22 | 3 | 19 | 2 | 3 | 0.08 | 1 | 9 | 4 | 0 | 2 | 5 | 2 | 12 | 45 | 6 | 38 | 20 | 29 | 3 | 28 | 14 | 25 | 3 | 1 | 2 | 5 |
5,217 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptLayerNorm | import torch
from torch import nn
class SegGptLayerNorm(nn.LayerNorm):
"""LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height,
width, channels) while channels_fi... |
class SegGptLayerNorm(nn.LayerNorm):
'''LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height,
width, channels) while channels_first corresponds to inputs with sha... | 3 | 2 | 11 | 0 | 11 | 0 | 3 | 0.18 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 28 | 2 | 22 | 11 | 19 | 4 | 21 | 11 | 18 | 3 | 1 | 1 | 5 |
5,218 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptLoss | import torch
from torch import nn
from torch.nn import functional as F
class SegGptLoss(nn.Module):
def __init__(self, config):
super().__init__()
self.beta = config.beta
self.patch_size = config.patch_size
def forward(self, prompt_masks: torch.FloatTensor, pred_masks: torch.FloatTens... |
class SegGptLoss(nn.Module):
def __init__(self, config):
pass
def forward(self, prompt_masks: torch.FloatTensor, pred_masks: torch.FloatTensor, labels: torch.FloatTensor, bool_masked_pos: torch.BoolTensor):
'''Computes the L1 loss between the predicted masks and the ground truth masks.
... | 3 | 1 | 19 | 4 | 9 | 7 | 1 | 0.78 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 40 | 9 | 18 | 14 | 9 | 14 | 12 | 8 | 9 | 1 | 1 | 0 | 2 |
5,219 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptMlp | from ...activations import ACT2FN
from torch import nn
import torch
class SegGptMlp(nn.Module):
def __init__(self, config):
super().__init__()
self.lin1 = nn.Linear(config.hidden_size, config.mlp_dim)
self.lin2 = nn.Linear(config.mlp_dim, config.hidden_size)
self.act = ACT2FN[confi... |
class SegGptMlp(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: 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 |
5,220 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptModel | import torch
from ...utils import ModelOutput, auto_docstring, logging, torch_int
from .configuration_seggpt import SegGptConfig
from typing import Optional, Union
@auto_docstring
class SegGptModel(SegGptPreTrainedModel):
def __init__(self, config: SegGptConfig):
super().__init__(config)
self.conf... | @auto_docstring
class SegGptModel(SegGptPreTrainedModel):
def __init__(self, config: SegGptConfig):
pass
def get_input_embeddings(self) -> SegGptPatchEmbeddings:
pass
def _prune_heads(self, heads_to_prune: dict[int, list[int]]) -> None:
'''
Prunes heads of the model. heads... | 7 | 2 | 28 | 4 | 15 | 9 | 3 | 0.55 | 1 | 10 | 5 | 0 | 4 | 3 | 4 | 5 | 116 | 20 | 62 | 26 | 43 | 34 | 32 | 13 | 27 | 8 | 2 | 1 | 12 |
5,221 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptPatchEmbeddings | from torch import nn
import collections.abc
class SegGptPatchEmbeddings(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
Transform... |
class SegGptPatchEmbeddings(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 | 13 | 1 | 12 | 0 | 3 | 0.2 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 33 | 3 | 25 | 13 | 22 | 5 | 21 | 13 | 18 | 3 | 1 | 1 | 6 |
5,222 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/seggpt/modeling_seggpt.py | transformers.models.seggpt.modeling_seggpt.SegGptPreTrainedModel | from ...modeling_utils import PreTrainedModel
import torch
from .configuration_seggpt import SegGptConfig
from torch import nn
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@auto_docstring
class SegGptPreTrainedModel(PreTrainedModel):
config: SegGptConfig
base_model_prefix = 'model'
... | @auto_docstring
class SegGptPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 39 | 3 | 33 | 3 | 6 | 0.18 | 1 | 2 | 2 | 2 | 1 | 0 | 1 | 1 | 51 | 5 | 39 | 8 | 37 | 7 | 22 | 8 | 20 | 6 | 1 | 2 | 6 |
5,223 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/configuration_sew.py | transformers.models.sew.configuration_sew.SEWConfig | from ...configuration_utils import PretrainedConfig
import functools
import operator
class SEWConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SEWModel`]. It is used to instantiate a SEW model
according to the specified arguments, defining the model architectu... |
class SEWConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SEWModel`]. It is used to instantiate a SEW model
according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configur... | 4 | 1 | 49 | 2 | 45 | 2 | 2 | 1.28 | 1 | 3 | 0 | 0 | 2 | 35 | 2 | 2 | 227 | 15 | 93 | 80 | 49 | 119 | 43 | 39 | 40 | 2 | 1 | 1 | 3 |
5,224 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWAttention | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_sew import SEWConfig
from torch import nn
import torch
class SEWAttention(nn.... |
class SEWAttention(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[SEWConfig]=None):
pass
def forward(self, hidde... | 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 |
5,225 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWEncoder | from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from ...integrations.fsdp import is_fsdp_managed_module
from torch import nn
import torch
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
class SEWEncoder(nn.Module):
def __init__(self, config):
supe... |
class SEWEncoder(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 | 3 | 0 | 54 | 7 | 43 | 4 | 9 | 0.08 | 1 | 7 | 4 | 0 | 2 | 9 | 2 | 12 | 109 | 15 | 87 | 35 | 77 | 7 | 61 | 28 | 58 | 16 | 1 | 3 | 17 |
5,226 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWEncoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class SEWEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = SEWAttention(embed_dim=config.hidden_size, num_heads=config.num_attention_heads, dropout=config.attentio... |
class SEWEncoderLayer(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 |
5,227 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWFeatureEncoder | from torch import nn
class SEWFeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
if config.feat_extract_norm == 'group':
conv_layers = [SEWGroupNormConvLayer(config, layer_id=0)] + [SEWNoLayerNormConvLayer(... |
class SEWFeatureEncoder(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 |
5,228 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWFeedForward | from torch import nn
from ...activations import ACT2FN
class SEWFeedForward(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 SEWFeedForward(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 |
5,229 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWForCTC | from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from typing import Callable, Optional, Union
from ...utils import auto_docstring, logging
import torch
import warnings
from torch import nn
@auto_docstring(custom_intro='\n SEW Model with a `language modeling` head on top for ... | @auto_docstring(custom_intro='\n SEW Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ')
class SEWForCTC(SEWPreTrainedModel):
def __init__(self, config, target_lang: Optional[str]=None):
'''
target_lang (`str`, *optional*):
Language i... | 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 |
5,230 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWForSequenceClassification | import warnings
from torch.nn import CrossEntropyLoss
from torch import nn
from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
import torch
@auto_docstring(custom_intro='\n SEW Model with ... | @auto_docstring(custom_intro='\n SEW Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like\n SUPERB Keyword Spotting.\n ')
class SEWForSequenceClassification(SEWPreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_extractor(se... | 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 |
5,231 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWGroupNormConvLayer | from torch import nn
from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
class SEWGroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 else... |
class SEWGroupNormConvLayer(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 |
5,232 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWLayerNormConvLayer | from ...activations import ACT2FN
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
class SEWLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 else... |
class SEWLayerNormConvLayer(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 |
5,233 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWModel | from torch import nn
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from ...utils import auto_docstring, logging
import torch
from typing import Callable, Optional, Union
from .configuration_sew import SEWConfig
@auto_docstring
class SEWModel(SEWPreTrainedModel):
def __i... | @auto_docstring
class SEWModel(SEWPreTrainedModel):
def __init__(self, config: SEWConfig):
pass
def _mask_hidden_states(self, hidden_states: torch.FloatTensor, mask_time_indices: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.LongTensor]=None):
'''
Masks extracted fea... | 6 | 2 | 37 | 6 | 28 | 3 | 5 | 0.12 | 1 | 7 | 4 | 0 | 3 | 8 | 3 | 6 | 122 | 19 | 92 | 31 | 67 | 11 | 47 | 17 | 43 | 7 | 2 | 1 | 15 |
5,234 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWNoLayerNormConvLayer | from ...activations import ACT2FN
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
class SEWNoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 el... |
class SEWNoLayerNormConvLayer(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 |
5,235 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWPositionalConvEmbedding | from ...activations import ACT2FN
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from torch import nn
class SEWPositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_size=config.num_c... |
class SEWPositionalConvEmbedding(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 20 | 3 | 17 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 41 | 6 | 35 | 10 | 31 | 0 | 26 | 10 | 22 | 4 | 1 | 2 | 5 |
5,236 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWPreTrainedModel | from ...utils import auto_docstring, logging
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
import math
from typing import Callable, Optional, Union
import torch
from torch import nn
from .configuration_sew import SEWConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_... | @auto_docstring
class SEWPreTrainedModel(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 | 15 | 2 | 11 | 3 | 3 | 0.27 | 1 | 3 | 1 | 3 | 3 | 0 | 3 | 3 | 71 | 10 | 48 | 15 | 42 | 13 | 37 | 15 | 31 | 8 | 1 | 4 | 12 |
5,237 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWSamePadLayer | from torch import nn
class SEWSamePadLayer(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 = hidden_st... |
class SEWSamePadLayer(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 |
5,238 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew/modeling_sew.py | transformers.models.sew.modeling_sew.SEWUpsampling | from ...activations import ACT2FN
from torch import nn
class SEWUpsampling(nn.Module):
def __init__(self, config):
super().__init__()
self.projection = nn.Linear(config.hidden_size, config.hidden_size * config.squeeze_factor)
self.activation = ACT2FN[config.feat_extract_activation]
... |
class SEWUpsampling(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 1 | 8 | 1 | 2 | 0.06 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 3 | 16 | 9 | 13 | 1 | 16 | 9 | 13 | 2 | 1 | 1 | 3 |
5,239 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/configuration_sew_d.py | transformers.models.sew_d.configuration_sew_d.SEWDConfig | from ...configuration_utils import PretrainedConfig
import functools
import operator
class SEWDConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SEWDModel`]. It is used to instantiate a SEW-D
model according to the specified arguments, defining the model archit... |
class SEWDConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SEWDModel`]. It is used to instantiate a SEW-D
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar conf... | 5 | 2 | 39 | 1 | 35 | 2 | 1 | 1.26 | 1 | 3 | 0 | 0 | 3 | 41 | 3 | 3 | 262 | 16 | 109 | 94 | 58 | 137 | 53 | 47 | 49 | 2 | 1 | 1 | 4 |
5,240 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.ContextPooler | from torch import nn
from ...activations import ACT2FN
class ContextPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.pooler_hidden_size, config.pooler_hidden_size)
self.dropout = StableDropout(config.pooler_dropout)
self.config = confi... |
class ContextPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass
@property
def output_dim(self):
pass | 5 | 0 | 5 | 0 | 4 | 1 | 1 | 0.13 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 20 | 3 | 15 | 10 | 10 | 2 | 14 | 9 | 10 | 1 | 1 | 0 | 3 |
5,241 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.ConvLayer | from ...activations import ACT2FN
from torch.nn import CrossEntropyLoss, LayerNorm
from torch import nn
class ConvLayer(nn.Module):
def __init__(self, config):
super().__init__()
kernel_size = getattr(config, 'conv_kernel_size', 3)
groups = getattr(config, 'conv_groups', 1)
self.co... |
class ConvLayer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, residual_states, input_mask):
pass | 3 | 0 | 16 | 2 | 14 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 5 | 2 | 12 | 34 | 5 | 29 | 15 | 26 | 0 | 26 | 15 | 23 | 4 | 1 | 3 | 5 |
5,242 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.DisentangledSelfAttention | import torch
from torch import nn
class DisentangledSelfAttention(nn.Module):
"""
Disentangled self-attention module
Parameters:
config (`DebertaV2Config`):
A model config class instance with the configuration to build a new model. The schema is similar to
*BertConfig*, for... |
class DisentangledSelfAttention(nn.Module):
'''
Disentangled self-attention module
Parameters:
config (`DebertaV2Config`):
A model config class instance with the configuration to build a new model. The schema is similar to
*BertConfig*, for more details, please refer [`Deber... | 5 | 2 | 50 | 6 | 38 | 7 | 7 | 0.23 | 1 | 5 | 2 | 0 | 4 | 16 | 4 | 14 | 215 | 28 | 154 | 52 | 141 | 35 | 100 | 44 | 95 | 11 | 1 | 3 | 28 |
5,243 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.DropoutContext | class DropoutContext:
def __init__(self):
self.dropout = 0
self.mask = None
self.scale = 1
self.reuse_mask = True | class DropoutContext:
def __init__(self):
pass | 2 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 4 | 1 | 1 | 6 | 0 | 6 | 6 | 4 | 0 | 6 | 6 | 4 | 1 | 0 | 0 | 1 |
5,244 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDAttention | from torch import nn
class SEWDAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = DisentangledSelfAttention(config)
self.output = SEWDSelfOutput(config)
self.config = config
def forward(self, hidden_states, attention_mask, output_attentions=False,... |
class SEWDAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask, output_attentions=False, query_states=None, relative_pos=None, rel_embeddings=None):
pass | 3 | 0 | 16 | 1 | 16 | 0 | 3 | 0 | 1 | 3 | 2 | 0 | 2 | 3 | 2 | 12 | 34 | 2 | 32 | 17 | 21 | 0 | 16 | 9 | 13 | 4 | 1 | 1 | 5 |
5,245 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDEncoder | from torch import nn
from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
class SEWDEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.pos_conv_embed = SEWDPositio... |
class SEWDEncoder(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 | 3 | 0 | 30 | 3 | 26 | 1 | 3 | 0.04 | 1 | 8 | 4 | 0 | 2 | 6 | 2 | 12 | 62 | 7 | 53 | 26 | 43 | 2 | 33 | 19 | 30 | 4 | 1 | 1 | 5 |
5,246 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDFeatureEncoder | from torch import nn
class SEWDFeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
if config.feat_extract_norm == 'group':
conv_layers = [SEWDGroupNormConvLayer(config, layer_id=0)] + [SEWDNoLayerNormConvLay... |
class SEWDFeatureEncoder(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 |
5,247 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDFeatureExtractor | import warnings
class SEWDFeatureExtractor(SEWDFeatureEncoder):
def __init__(self, config):
super().__init__(config)
warnings.warn(f'The class `{self.__class__.__name__}` has been depreciated and will be removed in Transformers v5. Use `{self.__class__.__bases__[0].__name__}` instead.', FutureWarn... |
class SEWDFeatureExtractor(SEWDFeatureEncoder):
def __init__(self, config):
pass | 2 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 14 | 9 | 0 | 9 | 2 | 7 | 0 | 4 | 2 | 2 | 1 | 2 | 0 | 1 |
5,248 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDForCTC | import warnings
import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from torch import nn
@auto_docstring(custom_intro='\n SEW-D Model with a `language modeling` head on top for Connecti... | @auto_docstring(custom_intro='\n SEW-D Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).\n ')
class SEWDForCTC(SEWDPreTrainedModel):
def __init__(self, config, target_lang: Optional[str]=None):
'''
target_lang (`str`, *optional*):
Langua... | 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 |
5,249 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDForSequenceClassification | import warnings
import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
from torch.nn import CrossEntropyLoss, LayerNorm
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from torch import nn
@auto_docstring(custom_intro='\n SEWD Model wit... | @auto_docstring(custom_intro='\n SEWD Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like SUPERB\n Keyword Spotting.\n ')
class SEWDForSequenceClassification(SEWDPreTrainedModel):
def __init__(self, config):
pass
def freeze_feature_extractor... | 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 |
5,250 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDGroupNormConvLayer | from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class SEWDGroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 els... |
class SEWDGroupNormConvLayer(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 |
5,251 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDIntermediate | from ...activations import ACT2FN
import torch
from torch import nn
class SEWDIntermediate(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 SEWDIntermediate(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 |
5,252 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDLayer | from ...modeling_layers import GradientCheckpointingLayer
class SEWDLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.attention = SEWDAttention(config)
self.intermediate = SEWDIntermediate(config)
self.output = SEWDOutput(config)
def forwar... |
class SEWDLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask, query_states=None, relative_pos=None, rel_embeddings=None, output_attentions=False):
pass | 3 | 0 | 15 | 0 | 15 | 0 | 2 | 0 | 1 | 4 | 3 | 0 | 2 | 3 | 2 | 12 | 32 | 1 | 31 | 18 | 20 | 0 | 15 | 10 | 12 | 3 | 1 | 1 | 4 |
5,253 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDLayerNormConvLayer | from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class SEWDLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 els... |
class SEWDLayerNormConvLayer(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 |
5,254 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDModel | import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
from .configuration_sew_d import SEWDConfig
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from torch import nn
@auto_docstring
class SEWDModel(SEWDPreTrainedModel):
def __init__... | @auto_docstring
class SEWDModel(SEWDPreTrainedModel):
def __init__(self, config: SEWDConfig):
pass
def _mask_hidden_states(self, hidden_states: torch.FloatTensor, mask_time_indices: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.LongTensor]=None):
'''
Masks extracted ... | 6 | 2 | 37 | 6 | 28 | 3 | 5 | 0.12 | 1 | 7 | 4 | 0 | 3 | 8 | 3 | 6 | 122 | 19 | 92 | 31 | 67 | 11 | 47 | 17 | 43 | 7 | 2 | 1 | 15 |
5,255 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDNoLayerNormConvLayer | from torch import nn
from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
class SEWDNoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 e... |
class SEWDNoLayerNormConvLayer(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 |
5,256 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDOutput | from torch.nn import CrossEntropyLoss, LayerNorm
from torch import nn
class SEWDOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = LayerNorm(config.hidden_size, config.layer_norm_eps)
... |
class SEWDOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
5,257 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDPositionalConvEmbedding | from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from torch import nn
from ...activations import ACT2FN
class SEWDPositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_size=config.num_... |
class SEWDPositionalConvEmbedding(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 20 | 3 | 17 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 41 | 6 | 35 | 10 | 31 | 0 | 26 | 10 | 22 | 4 | 1 | 2 | 5 |
5,258 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDPreTrainedModel | from ...modeling_utils import PreTrainedModel
from typing import Optional, Union
from ...utils import auto_docstring, logging
from .configuration_sew_d import SEWDConfig
from torch import nn
import torch
import math
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
@auto_docstring
class SEWDPreTrainedMo... | @auto_docstring
class SEWDPreTrainedModel(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 | 16 | 2 | 12 | 3 | 4 | 0.26 | 1 | 3 | 1 | 3 | 3 | 0 | 3 | 3 | 73 | 10 | 50 | 13 | 44 | 13 | 38 | 13 | 32 | 10 | 1 | 4 | 14 |
5,259 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDSamePadLayer | from torch import nn
class SEWDSamePadLayer(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 = hidden_s... |
class SEWDSamePadLayer(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 |
5,260 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDSelfOutput | from torch import nn
from torch.nn import CrossEntropyLoss, LayerNorm
class SEWDSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = LayerNorm(config.hidden_size, config.layer_norm_eps)
... |
class SEWDSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
5,261 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDTransformerEncoder | from torch.nn import CrossEntropyLoss, LayerNorm
from collections.abc import Sequence
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from torch import nn
class SEWDTransformerEncoder(nn.Module):
"""Modified BertEncoder with relative position bias support"""
def __ini... |
class SEWDTransformerEncoder(nn.Module):
'''Modified BertEncoder with relative position bias support'''
def __init__(self, config):
pass
def get_rel_embedding(self):
pass
def get_attention_mask(self, attention_mask):
pass
def get_rel_pos(self, hidden_states, query_states... | 6 | 1 | 25 | 4 | 21 | 0 | 6 | 0.01 | 1 | 8 | 3 | 0 | 5 | 9 | 5 | 15 | 131 | 23 | 107 | 36 | 92 | 1 | 70 | 27 | 64 | 16 | 1 | 3 | 31 |
5,262 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.SEWDUpsampling | from ...activations import ACT2FN
from torch import nn
class SEWDUpsampling(nn.Module):
def __init__(self, config):
super().__init__()
self.projection = nn.Linear(config.hidden_size, config.hidden_size * config.squeeze_factor)
self.activation = ACT2FN[config.feat_extract_activation]
... |
class SEWDUpsampling(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 1 | 8 | 1 | 2 | 0.06 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 3 | 16 | 9 | 13 | 1 | 16 | 9 | 13 | 2 | 1 | 1 | 3 |
5,263 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.StableDropout | from torch import nn
class StableDropout(nn.Module):
"""
Optimized dropout module for stabilizing the training
Args:
drop_prob (float): the dropout probabilities
"""
def __init__(self, drop_prob):
super().__init__()
self.drop_prob = drop_prob
self.count = 0
... |
class StableDropout(nn.Module):
'''
Optimized dropout module for stabilizing the training
Args:
drop_prob (float): the dropout probabilities
'''
def __init__(self, drop_prob):
pass
def forward(self, x):
'''
Call the module
Args:
x (`torch.te... | 6 | 2 | 7 | 0 | 6 | 1 | 2 | 0.33 | 1 | 3 | 2 | 0 | 5 | 3 | 5 | 15 | 47 | 7 | 30 | 11 | 24 | 10 | 29 | 11 | 23 | 3 | 1 | 2 | 10 |
5,264 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.XDropout | from typing import Optional, Union
import torch
class XDropout(torch.autograd.Function):
"""Optimized dropout function to save computation and memory by using mask operation instead of multiplication."""
@staticmethod
def forward(ctx, input, local_ctx):
mask, dropout = get_mask(input, local_ctx)
... |
class XDropout(torch.autograd.Function):
'''Optimized dropout function to save computation and memory by using mask operation instead of multiplication.'''
@staticmethod
def forward(ctx, input, local_ctx):
pass
@staticmethod
def backward(ctx, grad_output):
pass
@staticmethod
... | 7 | 1 | 10 | 0 | 7 | 2 | 2 | 0.32 | 1 | 2 | 1 | 0 | 0 | 0 | 3 | 33 | 37 | 4 | 25 | 12 | 17 | 8 | 20 | 9 | 15 | 2 | 5 | 1 | 6 |
5,265 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/sew_d/modeling_sew_d.py | transformers.models.sew_d.modeling_sew_d.XSoftmax | from ...pytorch_utils import softmax_backward_data
import torch
class XSoftmax(torch.autograd.Function):
"""
Masked Softmax which is optimized for saving memory
Args:
input (`torch.tensor`): The input tensor that will apply softmax.
mask (`torch.IntTensor`):
The mask matrix whe... |
class XSoftmax(torch.autograd.Function):
'''
Masked Softmax which is optimized for saving memory
Args:
input (`torch.tensor`): The input tensor that will apply softmax.
mask (`torch.IntTensor`):
The mask matrix where 0 indicate that element will be ignored in the softmax calcula... | 7 | 1 | 9 | 1 | 9 | 0 | 1 | 0.63 | 1 | 1 | 0 | 0 | 0 | 0 | 3 | 33 | 61 | 12 | 30 | 16 | 21 | 19 | 21 | 13 | 15 | 1 | 5 | 0 | 3 |
5,266 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/configuration_siglip.py | transformers.models.siglip.configuration_siglip.SiglipConfig | from ...configuration_utils import PretrainedConfig
class SiglipConfig(PretrainedConfig):
"""
[`SiglipConfig`] is the configuration class to store the configuration of a [`SiglipModel`]. It is used to
instantiate a Siglip model according to the specified arguments, defining the text model and vision model ... |
class SiglipConfig(PretrainedConfig):
'''
[`SiglipConfig`] is the configuration class to store the configuration of a [`SiglipModel`]. It is used to
instantiate a Siglip model according to the specified arguments, defining the text model and vision model configs.
Instantiating a configuration with the ... | 2 | 1 | 13 | 3 | 7 | 3 | 2 | 2.12 | 1 | 3 | 2 | 0 | 1 | 3 | 2 | 2 | 72 | 19 | 17 | 9 | 13 | 36 | 16 | 8 | 13 | 3 | 1 | 1 | 4 |
5,267 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/configuration_siglip.py | transformers.models.siglip.configuration_siglip.SiglipTextConfig | from ...configuration_utils import PretrainedConfig
class SiglipTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SiglipTextModel`]. It is used to instantiate a
Siglip text encoder according to the specified arguments, defining the model architecture. Insta... |
class SiglipTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SiglipTextModel`]. It is used to instantiate a
Siglip text encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will ... | 2 | 1 | 29 | 1 | 26 | 2 | 1 | 1.62 | 1 | 1 | 0 | 0 | 1 | 9 | 1 | 1 | 86 | 10 | 29 | 28 | 12 | 47 | 14 | 13 | 12 | 1 | 1 | 0 | 1 |
5,268 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/configuration_siglip.py | transformers.models.siglip.configuration_siglip.SiglipVisionConfig | from ...configuration_utils import PretrainedConfig
class SiglipVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SiglipVisionModel`]. It is used to instantiate a
Siglip vision encoder according to the specified arguments, defining the model architecture.... |
class SiglipVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SiglipVisionModel`]. It is used to instantiate a
Siglip vision encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults... | 2 | 1 | 26 | 1 | 25 | 0 | 1 | 1.39 | 1 | 1 | 0 | 0 | 1 | 10 | 1 | 1 | 77 | 10 | 28 | 27 | 13 | 39 | 15 | 14 | 13 | 1 | 1 | 0 | 1 |
5,269 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/image_processing_siglip.py | transformers.models.siglip.image_processing_siglip.SiglipImageProcessor | from ...image_transforms import convert_to_rgb, resize, to_channel_dimension_format
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images, validat... |
class SiglipImageProcessor(BaseImageProcessor):
'''
Constructs a SigLIP image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
`do_resize` in the `prepr... | 4 | 2 | 79 | 6 | 50 | 24 | 11 | 0.75 | 1 | 8 | 2 | 0 | 2 | 9 | 2 | 22 | 194 | 16 | 102 | 43 | 71 | 76 | 48 | 15 | 45 | 17 | 3 | 1 | 21 |
5,270 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/image_processing_siglip_fast.py | transformers.models.siglip.image_processing_siglip_fast.SiglipImageProcessorFast | from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, PILImageResampling
from ...image_processing_utils_fast import BaseImageProcessorFast
from ...utils import auto_docstring
@auto_docstring
class SiglipImageProcessorFast(BaseImageProcessorFast):
resample = PILImageResampling.BICUBIC
image_... | @auto_docstring
class SiglipImageProcessorFast(BaseImageProcessorFast):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 9 | 0 | 9 | 9 | 8 | 0 | 9 | 9 | 8 | 0 | 4 | 0 | 0 |
5,271 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipAttention | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
import torch
from typing import Any, Callable, Optional, Union
class SiglipAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config):
super().__init__(... |
class SiglipAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, **kwargs) -> tuple[torch.Tensor, Optional[torch.Tensor]]:
'''I... | 3 | 2 | 35 | 6 | 28 | 1 | 4 | 0.07 | 1 | 4 | 0 | 3 | 2 | 10 | 2 | 12 | 74 | 14 | 56 | 25 | 48 | 4 | 40 | 20 | 37 | 5 | 1 | 2 | 7 |
5,272 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipEncoder | from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from typing import Any, Callable, Optional, Union
from ...modeling_outputs import B... |
class SiglipEncoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`SiglipEncoderLayer`].
Args:
config: SiglipConfig
'''
def __init__(self, config: SiglipConfig):
pass
@auto_docstring
def forward(self... | 4 | 1 | 38 | 4 | 24 | 10 | 7 | 0.56 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 12 | 86 | 11 | 48 | 18 | 38 | 27 | 27 | 11 | 24 | 12 | 1 | 2 | 13 |
5,273 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipEncoderLayer | from torch import nn
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from ...processing_utils import Unpack
from ...modeling_layers import GradientCheckpointingLayer
from typing import Any, Callable, Optional, Union
from .co... |
class SiglipEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Union[SiglipVisionConfig, SiglipTextConfig]):
pass
@auto_docstring
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, **kwargs: Unpack[TransformersKwargs]) -> torch.FloatTensor:
pass | 4 | 0 | 22 | 3 | 15 | 5 | 2 | 0.37 | 1 | 5 | 2 | 0 | 2 | 5 | 2 | 12 | 47 | 6 | 30 | 16 | 22 | 11 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
5,274 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipForImageClassification | from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from typing import Any, Callable, Optional, Union
from .configuration... | @auto_docstring(custom_intro='\n SigLIP vision encoder with an image classification head on top (a linear layer on top of the pooled final hidden states of\n the patch tokens) e.g. for ImageNet.\n ')
class SiglipForImageClassification(SiglipPreTrainedModel):
def __init__(self, config: SiglipConfig) -> Non... | 6 | 1 | 58 | 9 | 32 | 17 | 8 | 0.5 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 121 | 19 | 68 | 23 | 55 | 34 | 38 | 14 | 35 | 14 | 2 | 3 | 16 |
5,275 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipMLP | from ...activations import ACT2FN
from torch import nn
import torch
class SiglipMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
... |
class SiglipMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
5,276 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipModel | from ...processing_utils import Unpack
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
from typing import Any, Callable, Optional, ... | @auto_docstring
class SiglipModel(SiglipPreTrainedModel):
def __init__(self, config: SiglipConfig):
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]=None... | 12 | 3 | 57 | 10 | 32 | 16 | 5 | 0.48 | 1 | 11 | 6 | 0 | 4 | 4 | 4 | 5 | 239 | 42 | 133 | 59 | 98 | 64 | 54 | 30 | 49 | 7 | 2 | 1 | 18 |
5,277 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipMultiheadAttentionPoolingHead | from torch import nn
import torch
from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
class SiglipMultiheadAttentionPoolingHead(nn.Module):
"""Multihead Attention Pooling."""
def __init__(self, config: SiglipVisionConfig):
super().__init__()
self.probe = nn.Par... |
class SiglipMultiheadAttentionPoolingHead(nn.Module):
'''Multihead Attention Pooling.'''
def __init__(self, config: SiglipVisionConfig):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 9 | 2 | 7 | 0 | 1 | 0.07 | 1 | 3 | 2 | 0 | 2 | 4 | 2 | 12 | 22 | 6 | 15 | 10 | 12 | 1 | 15 | 10 | 12 | 1 | 1 | 0 | 2 |
5,278 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipOutput | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
import torch
from typing import Any, Callable, Optional, Union
from dataclasses import dat... | @dataclass
@auto_docstring
class SiglipOutput(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)`):
Th... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 1.46 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 34 | 2 | 13 | 9 | 11 | 19 | 10 | 9 | 8 | 2 | 1 | 0 | 2 |
5,279 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipPreTrainedModel | from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from torch import nn
import numpy... | @auto_docstring
class SiglipPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 45 | 0 | 44 | 1 | 12 | 0.09 | 1 | 7 | 7 | 4 | 1 | 0 | 1 | 1 | 65 | 3 | 57 | 10 | 55 | 5 | 36 | 10 | 34 | 12 | 1 | 2 | 12 |
5,280 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipTextEmbeddings | from torch import nn
from typing import Any, Callable, Optional, Union
from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
import torch
class SiglipTextEmbeddings(nn.Module):
def __init__(self, config: SiglipTextConfig):
super().__init__()
embed_dim = config.hidden... |
class SiglipTextEmbeddings(nn.Module):
def __init__(self, config: SiglipTextConfig):
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 |
5,281 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipTextModel | from typing import Any, Callable, Optional, Union
from ...processing_utils import Unpack
from torch import nn
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWi... | @auto_docstring(custom_intro='\n The text model from SigLIP without any head or projection on top.\n ')
class SiglipTextModel(SiglipPreTrainedModel):
def __init__(self, config: SiglipTextConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
def set_input_embeddings(self, v... | 8 | 1 | 12 | 2 | 7 | 4 | 1 | 0.47 | 1 | 6 | 3 | 0 | 4 | 1 | 4 | 5 | 54 | 10 | 30 | 16 | 15 | 14 | 13 | 7 | 8 | 2 | 2 | 0 | 5 |
5,282 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipTextTransformer | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
from ...processing_utils import Unpack
import torch
from torch import... |
class SiglipTextTransformer(nn.Module):
def __init__(self, config: SiglipTextConfig):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, **kwargs: Unpack[Transf... | 5 | 0 | 34 | 6 | 25 | 4 | 4 | 0.13 | 1 | 8 | 4 | 0 | 2 | 6 | 2 | 12 | 71 | 12 | 52 | 24 | 39 | 7 | 29 | 15 | 26 | 7 | 1 | 1 | 8 |
5,283 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipVisionEmbeddings | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
from torch import nn
import torch
class SiglipVisionEmbeddings(nn.Module):
def __init__(self, conf... |
class SiglipVisionEmbeddings(nn.Module):
def __init__(self, config: SiglipVisionConfig):
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 to ... | 4 | 1 | 22 | 4 | 16 | 3 | 2 | 0.19 | 1 | 4 | 1 | 0 | 3 | 8 | 3 | 13 | 70 | 14 | 48 | 23 | 44 | 9 | 36 | 23 | 32 | 2 | 1 | 1 | 5 |
5,284 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipVisionModel | from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionConfig
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from ...utils.generic import check_model_inputs
from ...utils import ModelOutput, TransformersKwa... | @auto_docstring(custom_intro='\n The vision model from SigLIP without any head or projection on top.\n ')
class SiglipVisionModel(SiglipPreTrainedModel):
def __init__(self, config: SiglipVisionConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@check_model_inputs
@au... | 7 | 1 | 16 | 3 | 7 | 6 | 1 | 0.63 | 1 | 5 | 3 | 0 | 3 | 1 | 3 | 4 | 56 | 12 | 27 | 15 | 14 | 17 | 12 | 7 | 8 | 2 | 2 | 0 | 4 |
5,285 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/modeling_siglip.py | transformers.models.siglip.modeling_siglip.SiglipVisionTransformer | from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, torch_int
from typing import Any, Callable, Optional, Union
from ...processing_utils import Unpack
from .configuration_siglip import SiglipConfig, SiglipTextConfig, SiglipVisionC... |
class SiglipVisionTransformer(nn.Module):
def __init__(self, config: SiglipVisionConfig):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values, interpolate_pos_encoding: Optional[bool]=False, **kwargs: Unpack[TransformersKwargs]) -> BaseModelOutputWithPooling:
pass | 5 | 0 | 26 | 4 | 21 | 2 | 5 | 0.07 | 1 | 7 | 5 | 0 | 2 | 6 | 2 | 12 | 55 | 8 | 44 | 22 | 32 | 3 | 23 | 14 | 20 | 6 | 1 | 1 | 9 |
5,286 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/processing_siglip.py | transformers.models.siglip.processing_siglip.SiglipProcessor | from ...processing_utils import ProcessorMixin
class SiglipProcessor(ProcessorMixin):
"""
Constructs a Siglip processor which wraps a Siglip image processor and a Siglip tokenizer into a single processor.
[`SiglipProcessor`] offers all the functionalities of [`SiglipImageProcessor`] and [`SiglipTokenizer`... |
class SiglipProcessor(ProcessorMixin):
'''
Constructs a Siglip processor which wraps a Siglip image processor and a Siglip tokenizer into a single processor.
[`SiglipProcessor`] offers all the functionalities of [`SiglipImageProcessor`] and [`SiglipTokenizer`]. See the
[`~SiglipProcessor.__call__`] and... | 2 | 1 | 18 | 2 | 7 | 10 | 2 | 1.54 | 1 | 9 | 2 | 0 | 5 | 0 | 5 | 22 | 115 | 16 | 39 | 22 | 24 | 60 | 26 | 13 | 20 | 6 | 2 | 1 | 10 |
5,287 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/siglip/tokenization_siglip.py | transformers.models.siglip.tokenization_siglip.SiglipTokenizer | import warnings
from ...utils.import_utils import requires
from ...tokenization_utils import PreTrainedTokenizer
from typing import TYPE_CHECKING, Any, Optional
import string
from ...utils import logging, requires_backends
from ...convert_slow_tokenizer import import_protobuf
from ...tokenization_utils_base import Adde... | @requires(backends=('sentencepiece',))
class SiglipTokenizer(PreTrainedTokenizer):
'''
Construct a Siglip tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this... | 23 | 11 | 13 | 1 | 9 | 3 | 2 | 0.66 | 1 | 6 | 0 | 0 | 19 | 5 | 19 | 108 | 332 | 50 | 170 | 65 | 131 | 112 | 116 | 44 | 96 | 5 | 3 | 3 | 39 |
5,288 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_encoder_decoder/configuration_speech_encoder_decoder.py | transformers.models.speech_encoder_decoder.configuration_speech_encoder_decoder.SpeechEncoderDecoderConfig | from ...configuration_utils import PretrainedConfig
from ..auto.configuration_auto import AutoConfig
class SpeechEncoderDecoderConfig(PretrainedConfig):
"""
[`SpeechEncoderDecoderConfig`] is the configuration class to store the configuration of a
[`SpeechEncoderDecoderModel`]. It is used to instantiate an ... |
class SpeechEncoderDecoderConfig(PretrainedConfig):
'''
[`SpeechEncoderDecoderConfig`] is the configuration class to store the configuration of a
[`SpeechEncoderDecoderModel`]. It is used to instantiate an Encoder Decoder model according to the specified
arguments, defining the encoder and decoder conf... | 4 | 2 | 16 | 2 | 11 | 3 | 2 | 1.54 | 1 | 3 | 1 | 0 | 1 | 3 | 2 | 2 | 84 | 18 | 26 | 16 | 20 | 40 | 20 | 13 | 17 | 2 | 1 | 1 | 3 |
5,289 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py | transformers.models.speech_encoder_decoder.modeling_speech_encoder_decoder.SpeechEncoderDecoderModel | from ...cache_utils import Cache
from .configuration_speech_encoder_decoder import SpeechEncoderDecoderConfig
from torch import nn
from ...modeling_outputs import BaseModelOutput, Seq2SeqLMOutput
import torch
from ...configuration_utils import PretrainedConfig
from typing import Optional, Union
from ...generation impor... | @auto_docstring
class SpeechEncoderDecoderModel(PreTrainedModel, GenerationMixin):
'''
[`SpeechEncoderDecoderModel`] is a generic model class that will be instantiated as a transformer architecture with
one of the base model classes of the library as encoder and another one as decoder when created with the
... | 14 | 5 | 30 | 4 | 19 | 7 | 4 | 0.36 | 2 | 13 | 6 | 0 | 11 | 4 | 13 | 13 | 423 | 71 | 258 | 72 | 212 | 94 | 132 | 41 | 118 | 16 | 1 | 3 | 51 |
5,290 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/configuration_speech_to_text.py | transformers.models.speech_to_text.configuration_speech_to_text.Speech2TextConfig | from ...configuration_utils import PretrainedConfig
class Speech2TextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Speech2TextModel`]. It is used to instantiate a
Speech2Text model according to the specified arguments, defining the model architecture. Insta... |
class Speech2TextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Speech2TextModel`]. It is used to instantiate a
Speech2Text model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will ... | 2 | 1 | 75 | 2 | 73 | 1 | 2 | 1.1 | 1 | 3 | 0 | 0 | 1 | 25 | 1 | 1 | 173 | 12 | 77 | 62 | 43 | 85 | 33 | 30 | 31 | 2 | 1 | 1 | 2 |
5,291 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/feature_extraction_speech_to_text.py | transformers.models.speech_to_text.feature_extraction_speech_to_text.Speech2TextFeatureExtractor | from typing import Optional, Union
import numpy as np
from ...utils import PaddingStrategy, TensorType, is_speech_available, logging
from ...feature_extraction_utils import BatchFeature
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...audio_utils import mel_filter_bank, spectrogram, win... |
class Speech2TextFeatureExtractor(SequenceFeatureExtractor):
'''
Constructs a Speech2Text feature extractor.
This feature extractor inherits from [`Speech2TextFeatureExtractor`] which contains most of the main methods. Users
should refer to this superclass for more information regarding those methods.
... | 7 | 3 | 46 | 5 | 30 | 11 | 5 | 0.51 | 1 | 10 | 1 | 0 | 4 | 7 | 5 | 22 | 262 | 35 | 151 | 59 | 112 | 77 | 66 | 26 | 60 | 13 | 3 | 2 | 23 |
5,292 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Conv1dSubsampler | from torch import nn
class Conv1dSubsampler(nn.Module):
"""
Convolutional subsampler: a stack of 1D convolution (along temporal dimension) followed by non-linear activation
via gated linear units (https://huggingface.co/papers/1911.08460)
"""
def __init__(self, config):
super().__init__()
... |
class Conv1dSubsampler(nn.Module):
'''
Convolutional subsampler: a stack of 1D convolution (along temporal dimension) followed by non-linear activation
via gated linear units (https://huggingface.co/papers/1911.08460)
'''
def __init__(self, config):
pass
def forward(self, input_featur... | 3 | 1 | 13 | 1 | 13 | 1 | 3 | 0.23 | 1 | 2 | 0 | 0 | 2 | 7 | 2 | 12 | 33 | 3 | 26 | 12 | 23 | 6 | 17 | 12 | 14 | 3 | 1 | 1 | 5 |
5,293 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextAttention | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from typing import Callable, Optional, Union
from torch import nn
from .configuration_speech_to_text import Speech2TextConfig
from ...utils.deprecation import deprecate_... |
class Speech2TextAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: Optional[float]=0.0, is_decoder: Optional[bool]=False, bias: Optional[bool]=True, is_causal: Optional[bool]=False, config: Optional[Speech2Text... | 4 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 0 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
5,294 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextDecoder | import math
from typing import Callable, Optional, Union
import torch
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask, _prepare_4d_causal_attention_mask_for_sdpa
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache... |
class Speech2TextDecoder(Speech2TextPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`Speech2TextDecoderLayer`]
Args:
config: Speech2TextConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, config: Speec... | 5 | 2 | 59 | 9 | 35 | 16 | 10 | 0.49 | 1 | 10 | 4 | 0 | 4 | 10 | 4 | 7 | 248 | 39 | 140 | 43 | 121 | 69 | 74 | 29 | 69 | 36 | 2 | 3 | 40 |
5,295 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextDecoderLayer | from torch import nn
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...activations import ACT2FN
from .configuration_speech_to_text import Speech2TextConfig
from ...modeling_layers import GradientCheckpointingLayer
from ...utils.deprecation import deprecate_kwarg
from typing impor... |
class Speech2TextDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Speech2TextConfig, layer_idx=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]=None, ... | 4 | 1 | 58 | 6 | 40 | 13 | 4 | 0.31 | 1 | 4 | 1 | 0 | 2 | 11 | 2 | 12 | 118 | 12 | 81 | 32 | 67 | 25 | 44 | 21 | 41 | 6 | 1 | 1 | 7 |
5,296 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextEncoder | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask, _prepare_4d_causal_attention_mask_for_sdpa
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from .con... |
class Speech2TextEncoder(Speech2TextPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`Speech2TextEncoderLayer`].
Args:
config: Speech2TextConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__... | 4 | 2 | 71 | 11 | 44 | 18 | 11 | 0.48 | 1 | 9 | 5 | 0 | 2 | 10 | 2 | 5 | 153 | 24 | 88 | 32 | 77 | 42 | 56 | 24 | 53 | 20 | 2 | 3 | 22 |
5,297 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextEncoderLayer | import torch
from .configuration_speech_to_text import Speech2TextConfig
from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class Speech2TextEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Speech2TextConfig):
super().__init... |
class Speech2TextEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Speech2TextConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor:
'''
Args:
... | 3 | 1 | 33 | 3 | 25 | 6 | 2 | 0.22 | 1 | 4 | 1 | 0 | 2 | 9 | 2 | 12 | 68 | 7 | 50 | 22 | 41 | 11 | 32 | 16 | 29 | 3 | 1 | 1 | 4 |
5,298 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextForConditionalGeneration | from torch import nn
from .configuration_speech_to_text import Speech2TextConfig
from typing import Callable, Optional, Union
import torch
from torch.nn import CrossEntropyLoss
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...generation import GenerationMixin
from ...modeling_outputs import B... | @auto_docstring(custom_intro='\n The Speech2Text Model with a language modeling head. Can be used for summarization.\n ')
class Speech2TextForConditionalGeneration(Speech2TextPreTrainedModel, GenerationMixin):
def __init__(self, config: Speech2TextConfig):
pass
def get_encoder(self):
pas... | 7 | 1 | 17 | 2 | 11 | 3 | 2 | 0.28 | 2 | 7 | 3 | 0 | 6 | 2 | 7 | 10 | 131 | 22 | 85 | 38 | 57 | 24 | 36 | 19 | 28 | 7 | 2 | 2 | 14 |
5,299 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from typing import Callable, Optional, Union
from .configuration_speech_to_text import Speech2TextConfig
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...cach... | @auto_docstring
class Speech2TextModel(Speech2TextPreTrainedModel):
def __init__(self, config: Speech2TextConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def get_encoder(self):
pass
@auto_docstring
def forward(sel... | 8 | 1 | 20 | 2 | 14 | 4 | 3 | 0.27 | 1 | 9 | 6 | 0 | 6 | 2 | 6 | 9 | 125 | 16 | 86 | 28 | 61 | 23 | 29 | 11 | 22 | 11 | 2 | 1 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.