id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,200 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextIntermediate | from ...activations import ACT2FN
import torch
import torch.nn.functional as F
from torch import nn
class ClapTextIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, st... |
class ClapTextIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
1,201 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextLayer | import torch.nn.functional as F
import torch
from ...modeling_layers import GradientCheckpointingLayer
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
from typing import Any, Callable, Optional, Union
class ClapTextLayer(GradientCheckpointingLayer)... |
class ClapTextLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, **kwargs) -> tuple[torch.Tensor]:
... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.1 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 84 | 9 | 70 | 32 | 57 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
1,202 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextModel | import torch.nn.functional as F
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions
from .configuration_clap import C... | null | 8 | 1 | 36 | 4 | 25 | 7 | 6 | 0.39 | 1 | 8 | 4 | 0 | 4 | 4 | 4 | 5 | 165 | 26 | 100 | 39 | 80 | 39 | 53 | 24 | 48 | 18 | 2 | 2 | 22 |
1,203 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextModelWithProjection | from .configuration_clap import ClapAudioConfig, ClapConfig, ClapTextConfig
from typing import Any, Callable, Optional, Union
from torch import nn
import torch.nn.functional as F
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
import torch
@auto_d... | @auto_docstring
class ClapTextModelWithProjection(ClapPreTrainedModel):
def __init__(self, config: ClapTextConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
def set_input_embeddings(self, value):
pass
@can_return_tuple
@auto_docstring
def forward(self, in... | 8 | 1 | 15 | 3 | 10 | 3 | 2 | 0.29 | 1 | 8 | 4 | 0 | 4 | 2 | 4 | 5 | 68 | 14 | 42 | 21 | 27 | 12 | 20 | 12 | 15 | 4 | 2 | 1 | 7 |
1,204 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextOutput | import torch
import torch.nn.functional as F
from torch import nn
class ClapTextOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps... |
class ClapTextOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
1,205 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextPooler | from torch import nn
import torch
import torch.nn.functional as F
class ClapTextPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -... |
class ClapTextPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
1,206 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextSelfAttention | import torch.nn.functional as F
import torch
from typing import Any, Callable, Optional, Union
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
class ClapTextSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % ... |
class ClapTextSelfAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, **kwargs) -> tuple[torch.Tensor]:
pas... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 0 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
1,207 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py | transformers.models.clap.modeling_clap.ClapTextSelfOutput | import torch
import torch.nn.functional as F
from torch import nn
class ClapTextSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
... |
class ClapTextSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
1,208 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/processing_clap.py | transformers.models.clap.processing_clap.ClapProcessor | from typing import Optional, Union
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
from ...utils.deprecation import deprecate_kwarg
from ...audio_utils import AudioInput
from ...tokenization_utils_base import PreTokenizedInput, TextInput
class ClapProcessor(ProcessorMixin):
"""
Constru... |
class ClapProcessor(ProcessorMixin):
'''
Constructs a CLAP processor which wraps a CLAP feature extractor and a RoBerta tokenizer into a single processor.
[`ClapProcessor`] offers all the functionalities of [`ClapFeatureExtractor`] and [`RobertaTokenizerFast`]. See the
[`~ClapProcessor.__call__`] and [... | 4 | 2 | 15 | 2 | 5 | 7 | 2 | 1.52 | 1 | 5 | 1 | 0 | 5 | 0 | 5 | 22 | 95 | 17 | 31 | 14 | 24 | 47 | 26 | 13 | 20 | 6 | 2 | 1 | 10 |
1,209 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/configuration_clip.py | transformers.models.clip.configuration_clip.CLIPConfig | from ...configuration_utils import PretrainedConfig
class CLIPConfig(PretrainedConfig):
"""
[`CLIPConfig`] is the configuration class to store the configuration of a [`CLIPModel`]. It is used to instantiate
a CLIP model according to the specified arguments, defining the text model and vision model configs.... |
class CLIPConfig(PretrainedConfig):
'''
[`CLIPConfig`] is the configuration class to store the configuration of a [`CLIPModel`]. It is used to instantiate
a CLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating
a configuration with the defaults... | 2 | 1 | 49 | 8 | 30 | 12 | 8 | 0.9 | 1 | 4 | 2 | 0 | 1 | 5 | 2 | 2 | 148 | 28 | 63 | 19 | 57 | 57 | 44 | 16 | 41 | 14 | 1 | 4 | 15 |
1,210 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/configuration_clip.py | transformers.models.clip.configuration_clip.CLIPOnnxConfig | from collections.abc import Mapping
from ...onnx import OnnxConfig
from typing import TYPE_CHECKING, Any
from collections import OrderedDict
class CLIPOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict([('input_ids', {0: 'batch', 1: 'sequence'}), ... |
class CLIPOnnxConfig(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, process... | 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 |
1,211 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/configuration_clip.py | transformers.models.clip.configuration_clip.CLIPTextConfig | from ...configuration_utils import PretrainedConfig
class CLIPTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CLIPTextModel`]. It is used to instantiate a CLIP
text encoder according to the specified arguments, defining the model architecture. Instantiati... |
class CLIPTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CLIPTextModel`]. It is used to instantiate a CLIP
text encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield ... | 2 | 1 | 35 | 1 | 32 | 2 | 1 | 1.54 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 99 | 10 | 35 | 34 | 15 | 54 | 17 | 16 | 15 | 1 | 1 | 0 | 1 |
1,212 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/configuration_clip.py | transformers.models.clip.configuration_clip.CLIPVisionConfig | from ...configuration_utils import PretrainedConfig
class CLIPVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CLIPVisionModel`]. It is used to instantiate a
CLIP vision encoder according to the specified arguments, defining the model architecture. Insta... |
class CLIPVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CLIPVisionModel`]. It is used to instantiate a
CLIP vision encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will ... | 2 | 1 | 32 | 1 | 31 | 0 | 1 | 1.35 | 1 | 1 | 0 | 0 | 1 | 13 | 1 | 1 | 90 | 10 | 34 | 33 | 16 | 46 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
1,213 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/feature_extraction_clip.py | transformers.models.clip.feature_extraction_clip.CLIPFeatureExtractor | from ...utils.import_utils import requires
import warnings
from .image_processing_clip import CLIPImageProcessor
@requires(backends=('vision',))
class CLIPFeatureExtractor(CLIPImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class CLIPFeatureExtractor is deprecated and will... | @requires(backends=('vision',))
class CLIPFeatureExtractor(CLIPImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
1,214 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/image_processing_clip.py | transformers.models.clip.image_processing_clip.CLIPImageProcessor | from ...utils.import_utils import requires
from ...image_transforms import convert_to_rgb, get_resize_output_image_size, resize, to_channel_dimension_format
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimensio... | @requires(backends=('vision',))
class CLIPImageProcessor(BaseImageProcessor):
'''
Constructs a CLIP 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
... | 5 | 3 | 84 | 6 | 54 | 24 | 10 | 0.65 | 1 | 8 | 2 | 1 | 3 | 12 | 3 | 23 | 294 | 23 | 164 | 61 | 120 | 107 | 72 | 21 | 68 | 21 | 3 | 2 | 30 |
1,215 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/image_processing_clip_fast.py | transformers.models.clip.image_processing_clip_fast.CLIPImageProcessorFast | from ...image_processing_utils_fast import BaseImageProcessorFast
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, PILImageResampling
from ...utils import auto_docstring
@auto_docstring
class CLIPImageProcessorFast(BaseImageProcessorFast):
resample = PILImageResampling.BICUBIC
image_mean = OPENAI_... | @auto_docstring
class CLIPImageProcessorFast(BaseImageProcessorFast):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 14 | 0 | 12 | 12 | 11 | 2 | 12 | 12 | 11 | 0 | 4 | 0 | 0 |
1,216 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPAttention | import torch
from torch import nn
from typing import Any, Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
class CLIPAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All Yo... |
class CLIPAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Union[CLIPVisionConfig, CLIPTextConfig]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, causal_attention_mask: Optional... | 3 | 2 | 32 | 5 | 25 | 2 | 4 | 0.11 | 1 | 5 | 0 | 2 | 3 | 10 | 3 | 13 | 102 | 19 | 75 | 30 | 65 | 8 | 54 | 24 | 50 | 8 | 1 | 2 | 11 |
1,217 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPEncoder | from typing import Any, Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
import torch
from torch import nn
class CLIPEncoder(nn.Module):
"""
Transformer encod... |
class CLIPEncoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`CLIPEncoderLayer`].
Args:
config: CLIPConfig
'''
def __init__(self, config: CLIPConfig):
pass
def forward(self, inputs_embeds, attention_... | 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 |
1,218 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPEncoderLayer | from typing import Any, Callable, Optional, Union
from torch import nn
import torch
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
class CLIPEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Union[CLIPVision... |
class CLIPEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Union[CLIPVisionConfig, CLIPTextConfig]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.Float... | 3 | 1 | 23 | 3 | 16 | 5 | 2 | 0.31 | 1 | 5 | 2 | 0 | 2 | 5 | 2 | 12 | 48 | 6 | 32 | 17 | 23 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
1,219 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPForImageClassification | from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
from typing import Any, Callable, Optional, Union
import torch
from ...utils import ModelOutput, auto_docstring, can_return... | @auto_docstring(custom_intro='\n CLIP 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 CLIPForImageClassification(CLIPPreTrainedModel):
def __init__(self, config: CLIPConfig) -> None:
... | 6 | 1 | 42 | 5 | 31 | 6 | 8 | 0.15 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 94 | 12 | 71 | 22 | 54 | 11 | 38 | 14 | 35 | 14 | 2 | 3 | 16 |
1,220 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPMLP | from torch import nn
from ...activations import ACT2FN
import torch
class CLIPMLP(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 CLIPMLP(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 | 1 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
1,221 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPModel | import torch
from torch import nn
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, ... | @auto_docstring
class CLIPModel(CLIPPreTrainedModel):
def __init__(self, config: CLIPConfig):
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) -> t... | 12 | 3 | 56 | 10 | 33 | 13 | 5 | 0.38 | 1 | 11 | 6 | 0 | 4 | 8 | 4 | 5 | 233 | 43 | 138 | 63 | 103 | 53 | 60 | 34 | 55 | 7 | 2 | 1 | 18 |
1,222 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPOutput | import torch
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from dataclasses import dataclass
from typing import Any, Callable, Optional, Union
@da... | @dataclass
@auto_docstring
class CLIPOutput(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)`):
The ... | 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 |
1,223 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPPreTrainedModel | from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
from torch import nn
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class CLIPPreT... | @auto_docstring
class CLIPPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 55 | 1 | 53 | 1 | 11 | 0.08 | 1 | 8 | 8 | 6 | 1 | 0 | 1 | 1 | 67 | 3 | 59 | 11 | 57 | 5 | 37 | 11 | 35 | 11 | 1 | 1 | 11 |
1,224 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPTextEmbeddings | from torch import nn
from typing import Any, Callable, Optional, Union
import torch
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
class CLIPTextEmbeddings(nn.Module):
def __init__(self, config: CLIPTextConfig):
super().__init__()
embed_dim = config.hidden_size
... |
class CLIPTextEmbeddings(nn.Module):
def __init__(self, config: CLIPTextConfig):
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 |
1,225 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPTextModel | import torch
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from typing import Any, Callable, Optional, Union
from torch import nn
from .configurati... | @auto_docstring(custom_intro='\n The text model from CLIP without any head or projection on top.\n ')
class CLIPTextModel(CLIPPreTrainedModel):
def __init__(self, config: CLIPTextConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
def set_input_embeddings(self, value):
... | 8 | 1 | 11 | 2 | 7 | 3 | 1 | 0.42 | 1 | 6 | 3 | 0 | 4 | 1 | 4 | 5 | 55 | 11 | 31 | 17 | 16 | 13 | 14 | 8 | 9 | 2 | 2 | 0 | 5 |
1,226 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPTextModelWithProjection | from typing import Any, Callable, Optional, Union
import torch
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from .configurati... | @auto_docstring
class CLIPTextModelWithProjection(CLIPPreTrainedModel):
def __init__(self, config: CLIPTextConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
def set_input_embeddings(self, value):
pass
@can_return_tuple
@auto_docstring
def forward(self, in... | 8 | 1 | 16 | 3 | 10 | 3 | 2 | 0.27 | 1 | 7 | 3 | 0 | 4 | 2 | 4 | 5 | 74 | 18 | 44 | 23 | 29 | 12 | 22 | 14 | 17 | 3 | 2 | 1 | 6 |
1,227 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPTextTransformer | from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from typing import Any, Callable, Optional, Union
from torch import nn
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
from ...modeling_outputs import BaseModelOutput, Bas... |
class CLIPTextTransformer(nn.Module):
def __init__(self, config: CLIPTextConfig):
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, output_hi... | 4 | 0 | 47 | 7 | 32 | 9 | 5 | 0.27 | 1 | 9 | 4 | 0 | 2 | 6 | 2 | 12 | 98 | 14 | 66 | 25 | 53 | 18 | 31 | 16 | 28 | 8 | 1 | 1 | 9 |
1,228 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPVisionEmbeddings | from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
import torch
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
class CLIPVisionEmbeddings(nn.Module):
def __init__(self, config: CLIPVisionConfig)... |
class CLIPVisionEmbeddings(nn.Module):
def __init__(self, config: CLIPVisionConfig):
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 use ... | 4 | 1 | 26 | 5 | 19 | 3 | 2 | 0.16 | 1 | 5 | 1 | 0 | 3 | 9 | 3 | 13 | 81 | 16 | 57 | 27 | 53 | 9 | 43 | 27 | 39 | 3 | 1 | 1 | 6 |
1,229 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPVisionModel | from typing import Any, Callable, Optional, Union
from torch import nn
import torch
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from .configurati... | @auto_docstring(custom_intro='\n The vision model from CLIP without any head or projection on top.\n ')
class CLIPVisionModel(CLIPPreTrainedModel):
def __init__(self, config: CLIPVisionConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@can_return_tuple
@auto_docstri... | 7 | 1 | 15 | 2 | 7 | 6 | 1 | 0.61 | 1 | 5 | 3 | 0 | 3 | 1 | 3 | 4 | 55 | 10 | 28 | 16 | 15 | 17 | 13 | 8 | 9 | 2 | 2 | 0 | 4 |
1,230 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPVisionModelWithProjection | from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
from typing import Any, Callable, Optional, Union
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
from ...utils import ModelOutput, auto_docstring, can_return... | @auto_docstring
class CLIPVisionModelWithProjection(CLIPPreTrainedModel):
def __init__(self, config: CLIPVisionConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_... | 7 | 1 | 22 | 5 | 12 | 6 | 2 | 0.42 | 1 | 6 | 3 | 0 | 3 | 2 | 3 | 4 | 73 | 17 | 40 | 21 | 27 | 17 | 20 | 13 | 16 | 3 | 2 | 1 | 5 |
1,231 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/modeling_clip.py | transformers.models.clip.modeling_clip.CLIPVisionTransformer | from torch import nn
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
import torch
from .configuration_clip import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassif... |
class CLIPVisionTransformer(nn.Module):
def __init__(self, config: CLIPVisionConfig):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, interpolate_pos_encoding: Optional[bool]=F... | 4 | 0 | 27 | 4 | 21 | 2 | 4 | 0.07 | 1 | 7 | 4 | 0 | 2 | 5 | 2 | 12 | 57 | 9 | 45 | 21 | 33 | 3 | 24 | 13 | 21 | 6 | 1 | 1 | 7 |
1,232 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/processing_clip.py | transformers.models.clip.processing_clip.CLIPProcessor | from ...processing_utils import ProcessorMixin
import warnings
class CLIPProcessor(ProcessorMixin):
"""
Constructs a CLIP processor which wraps a CLIP image processor and a CLIP tokenizer into a single processor.
[`CLIPProcessor`] offers all the functionalities of [`CLIPImageProcessor`] and [`CLIPTokenize... |
class CLIPProcessor(ProcessorMixin):
'''
Constructs a CLIP processor which wraps a CLIP image processor and a CLIP tokenizer into a single processor.
[`CLIPProcessor`] offers all the functionalities of [`CLIPImageProcessor`] and [`CLIPTokenizerFast`]. See the
[`~CLIPProcessor.__call__`] and [`~CLIPProc... | 6 | 1 | 15 | 2 | 8 | 5 | 2 | 0.74 | 1 | 6 | 1 | 0 | 7 | 0 | 7 | 24 | 129 | 21 | 62 | 20 | 51 | 46 | 45 | 17 | 37 | 7 | 2 | 1 | 17 |
1,233 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/tokenization_clip.py | transformers.models.clip.tokenization_clip.BasicTokenizer | from ...tokenization_utils import AddedToken, PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import unicodedata
class BasicTokenizer:
"""
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optio... |
class BasicTokenizer:
'''
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
never_split (`Iterable`, *opti... | 8 | 7 | 19 | 1 | 14 | 5 | 4 | 0.55 | 0 | 2 | 0 | 0 | 7 | 5 | 7 | 7 | 159 | 14 | 98 | 39 | 83 | 54 | 78 | 32 | 70 | 8 | 0 | 4 | 27 |
1,234 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/tokenization_clip.py | transformers.models.clip.tokenization_clip.CLIPTokenizer | from ...tokenization_utils import AddedToken, PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from typing import Optional
import regex as re
import json
import os
class CLIPTokenizer(PreTrainedTokenizer):
"""
Construct a CLIP tokenizer. Based on byte-level Byte-Pair-Encoding.
This tokeni... |
class CLIPTokenizer(PreTrainedTokenizer):
'''
Construct a CLIP tokenizer. Based on byte-level Byte-Pair-Encoding.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
... | 14 | 8 | 19 | 2 | 13 | 4 | 3 | 0.41 | 1 | 13 | 1 | 0 | 12 | 10 | 12 | 101 | 263 | 38 | 162 | 67 | 131 | 67 | 121 | 46 | 107 | 9 | 3 | 3 | 35 |
1,235 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clip/tokenization_clip_fast.py | transformers.models.clip.tokenization_clip_fast.CLIPTokenizerFast | from tokenizers import pre_tokenizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
from .tokenization_clip import CLIPTokenizer
class CLIPTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" CLIP tokenizer (backed by HuggingFace's *tokenizers* library). B... |
class CLIPTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" CLIP tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level
Byte-Pair-Encoding.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to thi... | 7 | 3 | 17 | 2 | 10 | 5 | 2 | 0.81 | 1 | 5 | 0 | 0 | 5 | 0 | 5 | 93 | 131 | 20 | 62 | 32 | 41 | 50 | 32 | 18 | 25 | 2 | 3 | 1 | 9 |
1,236 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/configuration_clipseg.py | transformers.models.clipseg.configuration_clipseg.CLIPSegConfig | from ...configuration_utils import PretrainedConfig
class CLIPSegConfig(PretrainedConfig):
"""
[`CLIPSegConfig`] is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to
instantiate a CLIPSeg model according to the specified arguments, defining the text model and vision mo... |
class CLIPSegConfig(PretrainedConfig):
'''
[`CLIPSegConfig`] is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to
instantiate a CLIPSeg model according to the specified arguments, defining the text model and vision model configs.
Instantiating a configuration with ... | 2 | 1 | 59 | 8 | 40 | 12 | 8 | 0.89 | 1 | 4 | 2 | 0 | 1 | 13 | 2 | 2 | 187 | 28 | 84 | 40 | 65 | 75 | 52 | 24 | 49 | 14 | 1 | 4 | 15 |
1,237 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/configuration_clipseg.py | transformers.models.clipseg.configuration_clipseg.CLIPSegTextConfig | from ...configuration_utils import PretrainedConfig
class CLIPSegTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to instantiate an
CLIPSeg model according to the specified arguments, defining the model architecture. Instantiatin... |
class CLIPSegTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to instantiate an
CLIPSeg model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a... | 2 | 1 | 31 | 1 | 30 | 0 | 1 | 1.52 | 1 | 1 | 0 | 0 | 1 | 11 | 1 | 1 | 93 | 10 | 33 | 32 | 14 | 50 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
1,238 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/configuration_clipseg.py | transformers.models.clipseg.configuration_clipseg.CLIPSegVisionConfig | from ...configuration_utils import PretrainedConfig
class CLIPSegVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to instantiate an
CLIPSeg model according to the specified arguments, defining the model architecture. Instantiat... |
class CLIPSegVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to instantiate an
CLIPSeg model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield... | 2 | 1 | 30 | 1 | 29 | 0 | 1 | 1.38 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 86 | 10 | 32 | 31 | 15 | 44 | 17 | 16 | 15 | 1 | 1 | 0 | 1 |
1,239 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegAttention | from typing import Any, Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from torch import nn
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
class CLIPSegAttention(nn.Module):
"""Multi-headed attention from 'Atte... |
class CLIPSegAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Union[CLIPSegVisionConfig, CLIPSegTextConfig]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, causal_attention_mask:... | 3 | 2 | 32 | 5 | 25 | 2 | 4 | 0.11 | 1 | 5 | 0 | 0 | 3 | 10 | 3 | 13 | 102 | 19 | 75 | 30 | 65 | 8 | 54 | 24 | 50 | 8 | 1 | 2 | 11 |
1,240 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegDecoder | import copy
from typing import Any, Callable, Optional, Union
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
import math
from torch import nn
import torch
class CLIPSegDecoder(CLIPSegPreTrainedModel):
def __init__(self, config: CLIPSegConfig):
super().__init__(con... |
class CLIPSegDecoder(CLIPSegPreTrainedModel):
def __init__(self, config: CLIPSegConfig):
pass
def forward(self, hidden_states: tuple[torch.Tensor], conditional_embeddings: torch.Tensor, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=True... | 3 | 0 | 48 | 10 | 39 | 1 | 6 | 0.01 | 1 | 11 | 3 | 0 | 2 | 6 | 2 | 3 | 98 | 20 | 78 | 29 | 68 | 1 | 44 | 21 | 41 | 9 | 2 | 2 | 11 |
1,241 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegDecoderLayer | from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
from torch import nn
import torch
from typing import Any, Callable, Optional, Union
class CLIPSegDecoderLayer(nn.Module):
"""
CLIPSeg decoder layer, which is identical to `CLIPSegEncoderLayer`, except that normalization is... |
class CLIPSegDecoderLayer(nn.Module):
'''
CLIPSeg decoder layer, which is identical to `CLIPSegEncoderLayer`, except that normalization is applied after
self-attention/MLP, rather than before.
'''
def __init__(self, config: CLIPSegConfig):
pass
def forward(self, hidden_states: torch.T... | 3 | 2 | 24 | 3 | 16 | 5 | 2 | 0.47 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 55 | 8 | 32 | 17 | 23 | 15 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
1,242 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegDecoderOutput | from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
import torch
from typing import Any, Callable, Optional, Union
@dataclass
@auto_docstring
class CLIPSegDecoderOutput(ModelOutput):
"""
logits (`torch.FloatTe... | @dataclass
@auto_docstring
class CLIPSegDecoderOutput(ModelOutput):
'''
logits (`torch.FloatTensor` of shape `(batch_size, height, width)`):
Classification scores for each pixel.
'''
pass | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 1 | 4 | 4 | 3 | 12 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
1,243 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegEncoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import nn
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
import torch
from typing import Any, Callable, Optional, Union
from .configuration_clipseg import CLIPS... |
class CLIPSegEncoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`CLIPSegEncoderLayer`].
Args:
config: CLIPSegConfig
'''
def __init__(self, config: CLIPSegConfig):
pass
@can_return_tuple
def forwar... | 4 | 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 |
1,244 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegEncoderLayer | from typing import Any, Callable, Optional, Union
from torch import nn
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
import torch
from ...modeling_layers import GradientCheckpointingLayer
class CLIPSegEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: C... |
class CLIPSegEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: CLIPSegConfig):
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 |
1,245 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegForImageSegmentation | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import nn
from typing import Any, Callable, Optional, Union
import torch
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from .configuration_clipseg import CLIPS... | @auto_docstring(custom_intro='\n CLIPSeg model with a Transformer-based decoder on top for zero-shot and one-shot image segmentation.\n ')
class CLIPSegForImageSegmentation(CLIPSegPreTrainedModel):
def __init__(self, config: CLIPSegConfig):
pass
def get_conditional_embeddings(self, batch_size: O... | 6 | 1 | 54 | 7 | 37 | 11 | 6 | 0.28 | 1 | 11 | 6 | 0 | 3 | 4 | 3 | 4 | 169 | 23 | 115 | 40 | 89 | 32 | 48 | 19 | 44 | 13 | 2 | 2 | 19 |
1,246 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegImageSegmentationOutput | from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from dataclasses import dataclass
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
import torch
from typing import Any, Callable, Optional, Union
@dataclass
@auto_docstring... | @dataclass
@auto_docstring
class CLIPSegImageSegmentationOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Binary cross entropy loss for segmentation.
logits (`torch.FloatTensor` of shape `(batch_size, height, width)`):
Class... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 0.67 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 22 | 2 | 12 | 8 | 10 | 8 | 9 | 8 | 7 | 2 | 1 | 0 | 2 |
1,247 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegMLP | from ...activations import ACT2FN
from torch import nn
import torch
class CLIPSegMLP(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 CLIPSegMLP(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 |
1,248 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegModel | from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Callable, Optional, Union
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
from ...utils import ModelOutput, auto_docstring, can_return_tuple, fil... | @auto_docstring
class CLIPSegModel(CLIPSegPreTrainedModel):
def __init__(self, config: CLIPSegConfig):
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]=N... | 11 | 3 | 54 | 10 | 32 | 13 | 5 | 0.4 | 1 | 11 | 6 | 0 | 4 | 8 | 4 | 5 | 227 | 42 | 133 | 60 | 98 | 53 | 57 | 31 | 52 | 7 | 2 | 1 | 18 |
1,249 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegOutput | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
import torch
from dataclasses import dataclass
@dataclass
@auto_docstring... | @dataclass
@auto_docstring
class CLIPSegOutput(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)`):
T... | 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 |
1,250 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegPreTrainedModel | from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
@auto_docstring
cl... | @auto_docstring
class CLIPSegPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 40 | 1 | 38 | 1 | 8 | 0.12 | 1 | 5 | 5 | 5 | 1 | 0 | 1 | 1 | 50 | 3 | 42 | 9 | 40 | 5 | 32 | 9 | 30 | 8 | 1 | 1 | 8 |
1,251 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegTextEmbeddings | from typing import Any, Callable, Optional, Union
import torch
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
from torch import nn
class CLIPSegTextEmbeddings(nn.Module):
def __init__(self, config: CLIPSegTextConfig):
super().__init__()
embed_dim = config.... |
class CLIPSegTextEmbeddings(nn.Module):
def __init__(self, config: CLIPSegTextConfig):
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 |
1,252 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegTextModel | from torch import nn
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
f... |
class CLIPSegTextModel(CLIPSegPreTrainedModel):
def __init__(self, config: CLIPSegTextConfig):
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, atte... | 6 | 1 | 11 | 1 | 6 | 3 | 1 | 0.43 | 1 | 6 | 3 | 0 | 4 | 1 | 4 | 5 | 53 | 10 | 30 | 17 | 15 | 13 | 13 | 8 | 8 | 1 | 2 | 0 | 4 |
1,253 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegTextTransformer | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logg... |
class CLIPSegTextTransformer(nn.Module):
def __init__(self, config: CLIPSegTextConfig):
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, out... | 4 | 0 | 45 | 6 | 31 | 9 | 5 | 0.28 | 1 | 9 | 4 | 0 | 2 | 5 | 2 | 12 | 95 | 12 | 65 | 24 | 52 | 18 | 30 | 15 | 27 | 8 | 1 | 1 | 9 |
1,254 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegVisionEmbeddings | from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
import torch
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
class CLIPSegVisionEmbeddings(nn.Module):
def __init__(self, config: CL... |
class CLIPSegVisionEmbeddings(nn.Module):
def __init__(self, config: CLIPSegVisionConfig):
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 t... | 4 | 1 | 26 | 5 | 18 | 3 | 2 | 0.18 | 1 | 5 | 1 | 0 | 3 | 9 | 3 | 13 | 81 | 16 | 56 | 26 | 52 | 10 | 42 | 26 | 38 | 3 | 1 | 1 | 6 |
1,255 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegVisionModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import nn
import torch
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
f... |
class CLIPSegVisionModel(CLIPSegPreTrainedModel):
def __init__(self, config: CLIPSegVisionConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hi... | 5 | 1 | 15 | 2 | 7 | 6 | 1 | 0.65 | 1 | 5 | 3 | 0 | 3 | 1 | 3 | 4 | 52 | 9 | 26 | 15 | 13 | 17 | 11 | 7 | 7 | 1 | 2 | 0 | 3 |
1,256 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/modeling_clipseg.py | transformers.models.clipseg.modeling_clipseg.CLIPSegVisionTransformer | from typing import Any, Callable, Optional, Union
import torch
from .configuration_clipseg import CLIPSegConfig, CLIPSegTextConfig, CLIPSegVisionConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature... |
class CLIPSegVisionTransformer(nn.Module):
def __init__(self, config: CLIPSegVisionConfig):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor], output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None, interpo... | 4 | 0 | 25 | 4 | 20 | 2 | 3 | 0.09 | 1 | 6 | 4 | 0 | 2 | 5 | 2 | 12 | 55 | 8 | 43 | 21 | 31 | 4 | 22 | 13 | 19 | 5 | 1 | 1 | 6 |
1,257 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clipseg/processing_clipseg.py | transformers.models.clipseg.processing_clipseg.CLIPSegProcessor | import warnings
from ...tokenization_utils_base import BatchEncoding
from ...processing_utils import ProcessorMixin
class CLIPSegProcessor(ProcessorMixin):
"""
Constructs a CLIPSeg processor which wraps a CLIPSeg image processor and a CLIP tokenizer into a single processor.
[`CLIPSegProcessor`] offers all... |
class CLIPSegProcessor(ProcessorMixin):
'''
Constructs a CLIPSeg processor which wraps a CLIPSeg image processor and a CLIP tokenizer into a single processor.
[`CLIPSegProcessor`] offers all the functionalities of [`ViTImageProcessor`] and [`CLIPTokenizerFast`]. See the
[`~CLIPSegProcessor.__call__`] a... | 7 | 2 | 19 | 2 | 10 | 7 | 3 | 0.76 | 1 | 5 | 1 | 0 | 6 | 0 | 6 | 23 | 137 | 21 | 66 | 16 | 57 | 50 | 45 | 14 | 38 | 10 | 2 | 1 | 19 |
1,258 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/configuration_clvp.py | transformers.models.clvp.configuration_clvp.ClvpConfig | from ...configuration_utils import PretrainedConfig
class ClvpConfig(PretrainedConfig):
"""
[`ClvpConfig`] is the configuration class to store the configuration of a [`ClvpModelForConditionalGeneration`]. It
is used to instantiate a CLVP model according to the specified arguments, defining the text model, ... |
class ClvpConfig(PretrainedConfig):
'''
[`ClvpConfig`] is the configuration class to store the configuration of a [`ClvpModelForConditionalGeneration`]. It
is used to instantiate a CLVP model according to the specified arguments, defining the text model, speech model and
decoder model configs. Instanti... | 4 | 2 | 30 | 4 | 20 | 7 | 3 | 1.13 | 1 | 3 | 2 | 0 | 1 | 6 | 2 | 2 | 121 | 21 | 47 | 27 | 28 | 53 | 22 | 11 | 19 | 4 | 1 | 1 | 5 |
1,259 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/configuration_clvp.py | transformers.models.clvp.configuration_clvp.ClvpDecoderConfig | from ...configuration_utils import PretrainedConfig
class ClvpDecoderConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ClvpDecoder`]. It is used to instantiate a CLVP
Decoder Model according to the specified arguments, defining the model architecture. Instantia... |
class ClvpDecoderConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ClvpDecoder`]. It is used to instantiate a CLVP
Decoder Model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yiel... | 2 | 1 | 59 | 2 | 57 | 0 | 1 | 1.35 | 1 | 1 | 0 | 0 | 1 | 26 | 1 | 1 | 155 | 14 | 60 | 59 | 29 | 81 | 31 | 30 | 29 | 1 | 1 | 0 | 1 |
1,260 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/configuration_clvp.py | transformers.models.clvp.configuration_clvp.ClvpEncoderConfig | from typing import Union
import os
from ...configuration_utils import PretrainedConfig
class ClvpEncoderConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ClvpEncoder`]. It is used to instantiate a CLVP
text or CLVP speech encoder according to the specified argu... |
class ClvpEncoderConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ClvpEncoder`]. It is used to instantiate a CLVP
text or CLVP speech encoder according to the specified arguments. Instantiating a configuration with the defaults
will yield a similar configu... | 4 | 1 | 32 | 3 | 27 | 2 | 3 | 0.97 | 1 | 4 | 0 | 0 | 1 | 16 | 2 | 2 | 130 | 16 | 58 | 44 | 33 | 56 | 31 | 22 | 28 | 4 | 1 | 1 | 5 |
1,261 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/feature_extraction_clvp.py | transformers.models.clvp.feature_extraction_clvp.ClvpFeatureExtractor | from ...utils import TensorType, logging
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from typing import Optional, Union
import numpy as np
from ...audio_utils import mel_filter_bank, spectrogram, window_function
from ...feature_extraction_utils import BatchFeature
class ClvpFeatureExtract... |
class ClvpFeatureExtractor(SequenceFeatureExtractor):
'''
Constructs a CLVP feature extractor.
This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains
most of the main methods. Users should refer to this superclass for more information regardi... | 4 | 3 | 55 | 6 | 36 | 13 | 4 | 0.64 | 1 | 9 | 1 | 0 | 3 | 9 | 3 | 20 | 206 | 27 | 110 | 43 | 83 | 70 | 43 | 20 | 39 | 10 | 3 | 2 | 13 |
1,262 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpConditioningEncoder | from torch import nn
from typing import Callable, Optional, Union
from .configuration_clvp import ClvpConfig, ClvpDecoderConfig, ClvpEncoderConfig
import torch
class ClvpConditioningEncoder(nn.Module):
"""
This class processes the log-mel spectrograms(extracted by the Feature Extractor) and text tokens(produce... |
class ClvpConditioningEncoder(nn.Module):
'''
This class processes the log-mel spectrograms(extracted by the Feature Extractor) and text tokens(produced by the
tokenizer) as inputs for the decoder model.
First each log-mel spectrogram is processed into a single vector which captures valuable characteri... | 4 | 2 | 40 | 7 | 29 | 5 | 6 | 0.28 | 1 | 7 | 2 | 0 | 3 | 8 | 3 | 13 | 136 | 25 | 87 | 27 | 77 | 24 | 54 | 20 | 50 | 11 | 1 | 2 | 17 |
1,263 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpDecoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, CausalLMOutputWithCrossAttentions
from typing import Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_attn_mask_utils import _prepare_4d_attention_m... |
class ClvpDecoder(ClvpPreTrainedModel):
'''
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`ClvpDecoderLayer`]
'''
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
... | 7 | 2 | 33 | 5 | 26 | 2 | 7 | 0.09 | 1 | 10 | 2 | 0 | 5 | 7 | 5 | 6 | 177 | 31 | 134 | 41 | 114 | 12 | 82 | 27 | 76 | 30 | 2 | 3 | 35 |
1,264 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpDecoderLayer | from typing import Callable, Optional, Union
from torch import nn
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache
import torch
class ClvpDecoderLayer(nn.Module):
def __init__(self, config, layer_idx=None):
super().__init__()
hidden_size = config.hidd... |
class ClvpDecoderLayer(nn.Module):
def __init__(self, config, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]], past_key_values: Optional[Cache]=None, attention_mask: Optional[to... | 4 | 0 | 24 | 3 | 21 | 1 | 2 | 0.05 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 12 | 50 | 6 | 42 | 23 | 30 | 2 | 24 | 14 | 21 | 2 | 1 | 1 | 4 |
1,265 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpDecoderMLP | from typing import Callable, Optional, Union
from ...activations import ACT2FN, get_activation
from ...pytorch_utils import Conv1D, isin_mps_friendly
from torch import nn
import torch
class ClvpDecoderMLP(nn.Module):
def __init__(self, intermediate_size, config):
super().__init__()
embed_dim = con... |
class ClvpDecoderMLP(nn.Module):
def __init__(self, intermediate_size, config):
pass
def forward(self, hidden_states: Optional[tuple[torch.FloatTensor]]) -> torch.FloatTensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 15 | 1 | 14 | 8 | 11 | 0 | 14 | 8 | 11 | 1 | 1 | 0 | 2 |
1,266 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpEncoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, CausalLMOutputWithCrossAttentions
from typing import Callable, Optional, Union
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask
from torch import n... |
class ClvpEncoder(ClvpPreTrainedModel):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`ClvpEncoderLayer`].
Args:
config: ClvpConfig
'''
def __init__(self, config: ClvpConfig):
pass
def get_input_embeddings(self):
... | 5 | 2 | 36 | 6 | 23 | 7 | 6 | 0.38 | 1 | 11 | 5 | 0 | 4 | 8 | 4 | 5 | 154 | 28 | 91 | 33 | 77 | 35 | 56 | 24 | 51 | 19 | 2 | 2 | 23 |
1,267 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpEncoderLayer | from .configuration_clvp import ClvpConfig, ClvpDecoderConfig, ClvpEncoderConfig
import torch
from torch import nn
from typing import Callable, Optional, Union
class ClvpEncoderLayer(nn.Module):
def __init__(self, config: ClvpConfig):
super().__init__()
self.config = config
self.embed_dim ... |
class ClvpEncoderLayer(nn.Module):
def __init__(self, config: ClvpConfig):
pass
def forward(self, hidden_states: torch.FloatTensor, rotary_pos_emb: torch.FloatTensor, attention_mask: torch.LongTensor, position_ids: torch.LongTensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]... | 3 | 1 | 29 | 5 | 18 | 7 | 2 | 0.39 | 1 | 6 | 4 | 0 | 2 | 6 | 2 | 12 | 60 | 10 | 36 | 19 | 26 | 14 | 23 | 12 | 20 | 2 | 1 | 1 | 3 |
1,268 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpEncoderMLP | import torch
from torch import nn
class ClvpEncoderMLP(nn.Module):
"""
This MLP is used in CLVP speech or text encoder models.
"""
def __init__(self, config):
super().__init__()
self.config = config
self.fc1 = ClvpGatedLinearUnit(config)
self.fc2 = nn.Linear(config.inte... |
class ClvpEncoderMLP(nn.Module):
'''
This MLP is used in CLVP speech or text encoder models.
'''
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor:
pass | 3 | 1 | 6 | 1 | 6 | 0 | 1 | 0.25 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 18 | 3 | 12 | 7 | 9 | 3 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
1,269 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpForCausalLM | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, CausalLMOutputWithCrossAttentions
from typing import Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from torch.nn import CrossEntropyLoss
from torch import nn
from... | @auto_docstring(custom_intro='\n The CLVP decoder model with a language modelling head on top.\n ')
class ClvpForCausalLM(ClvpPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def get_input_embeddings(self):
pass
d... | 10 | 2 | 31 | 4 | 23 | 4 | 4 | 0.16 | 2 | 10 | 2 | 0 | 6 | 4 | 7 | 8 | 225 | 33 | 165 | 57 | 132 | 27 | 84 | 32 | 76 | 8 | 2 | 2 | 26 |
1,270 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpGatedLinearUnit | from torch import nn
from ...activations import ACT2FN, get_activation
import torch
class ClvpGatedLinearUnit(nn.Module):
"""
`ClvpGatedLinearUnit` uses the second half of the `hidden_states` to act as a gate for the first half of the
`hidden_states` which controls the flow of data from the first of the te... |
class ClvpGatedLinearUnit(nn.Module):
'''
`ClvpGatedLinearUnit` uses the second half of the `hidden_states` to act as a gate for the first half of the
`hidden_states` which controls the flow of data from the first of the tensor.
'''
def __init__(self, config):
pass
def forward(self, h... | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.5 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 14 | 2 | 8 | 6 | 5 | 4 | 8 | 6 | 5 | 1 | 1 | 0 | 2 |
1,271 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, CausalLMOutputWithCrossAttentions
from ...utils import ModelOutput, auto_docstring, logging
from typing import Callable, Optional, Union
from .configuration_clvp import ClvpConfig, ClvpDecoderConfig, ... | @auto_docstring
class ClvpModel(ClvpPreTrainedModel):
def __init__(self, config: ClvpDecoderConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attentio... | 7 | 0 | 12 | 1 | 11 | 0 | 2 | 0.04 | 1 | 6 | 3 | 0 | 5 | 2 | 5 | 6 | 65 | 8 | 55 | 23 | 35 | 2 | 21 | 9 | 15 | 6 | 2 | 1 | 10 |
1,272 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpModelForConditionalGeneration | import torch
from .configuration_clvp import ClvpConfig, ClvpDecoderConfig, ClvpEncoderConfig
from typing import Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from torch import nn
from ...generation import GenerationConfig, GenerationMixin
import copy
@auto_docstring(custom_intro=... | @auto_docstring(custom_intro='\n The composite CLVP model with a text encoder, speech encoder and speech decoder model.\n ')
class ClvpModelForConditionalGeneration(ClvpPreTrainedModel, GenerationMixin):
def __init__(self, config: ClvpConfig):
pass
def fix_speech_decoder_output(self, speech_ids:... | 10 | 5 | 83 | 13 | 43 | 26 | 5 | 0.6 | 2 | 16 | 8 | 0 | 6 | 5 | 6 | 7 | 510 | 86 | 265 | 82 | 221 | 160 | 105 | 46 | 98 | 8 | 2 | 2 | 28 |
1,273 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpOutput | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, CausalLMOutputWithCrossAttentions
from ...utils import ModelOutput, auto_docstring, logging
from typing import Callable, Optional, Union
from dataclasses import dataclass
import torch
@dataclass
@aut... | @dataclass
@auto_docstring
class ClvpOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for speech-text similarity.
speech_ids (`torch.LongTensor`, *optional*):
speech_ids (or speech candidates) generated b... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.42 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 42 | 1 | 12 | 12 | 11 | 29 | 12 | 12 | 11 | 0 | 1 | 0 | 0 |
1,274 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpPreTrainedModel | from ...utils import ModelOutput, auto_docstring, logging
from ...pytorch_utils import Conv1D, isin_mps_friendly
import math
from torch import nn
from ...modeling_utils import PreTrainedModel
from .configuration_clvp import ClvpConfig, ClvpDecoderConfig, ClvpEncoderConfig
@auto_docstring
class ClvpPreTrainedModel(PreT... | @auto_docstring
class ClvpPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 31 | 0 | 30 | 1 | 12 | 0.14 | 1 | 5 | 5 | 5 | 1 | 0 | 1 | 1 | 42 | 2 | 35 | 11 | 33 | 5 | 28 | 11 | 26 | 12 | 1 | 3 | 12 |
1,275 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpRMSNorm | from torch import nn
import torch
class ClvpRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
ClvpRMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps
def f... |
class ClvpRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
ClvpRMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 4 | 1 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 18 | 2 | 13 | 8 | 9 | 3 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
1,276 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpRotaryPositionalEmbedding | import torch
from torch import nn
class ClvpRotaryPositionalEmbedding(nn.Module):
"""
Rotary Position Embedding Class for CLVP. It was proposed in the paper 'ROFORMER: ENHANCED TRANSFORMER WITH ROTARY
POSITION EMBEDDING', Please see https://huggingface.co/papers/2104.09864v1.pdf .
"""
def __init__... |
class ClvpRotaryPositionalEmbedding(nn.Module):
'''
Rotary Position Embedding Class for CLVP. It was proposed in the paper 'ROFORMER: ENHANCED TRANSFORMER WITH ROTARY
POSITION EMBEDDING', Please see https://huggingface.co/papers/2104.09864v1.pdf .
'''
def __init__(self, config):
pass
... | 3 | 1 | 11 | 2 | 9 | 0 | 2 | 0.22 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 28 | 6 | 18 | 11 | 15 | 4 | 18 | 11 | 15 | 2 | 1 | 1 | 3 |
1,277 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/modeling_clvp.py | transformers.models.clvp.modeling_clvp.ClvpSelfAttention | from typing import Callable, Optional, Union
from ...utils.deprecation import deprecate_kwarg
from torch import nn
import torch
from ...cache_utils import Cache, DynamicCache
class ClvpSelfAttention(nn.Module):
"""
Multi-headed attention to combine Absolute and Rotary Positional Embeddings into a single Attent... |
class ClvpSelfAttention(nn.Module):
'''
Multi-headed attention to combine Absolute and Rotary Positional Embeddings into a single Attention module.
'''
def __init__(self, config, layer_idx=None):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
pass
@deprec... | 5 | 1 | 40 | 7 | 31 | 2 | 5 | 0.11 | 1 | 5 | 0 | 0 | 3 | 10 | 3 | 13 | 127 | 23 | 94 | 42 | 80 | 10 | 66 | 32 | 62 | 10 | 1 | 2 | 14 |
1,278 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/number_normalizer.py | transformers.models.clvp.number_normalizer.EnglishNormalizer | class EnglishNormalizer:
def __init__(self):
self._abbreviations = [(re.compile('\\b%s\\.' % x[0], re.IGNORECASE), x[1]) for x in [('mrs', 'misess'), ('mr', 'mister'), ('dr', 'doctor'), ('st', 'saint'), ('co', 'company'), ('jr', 'junior'), ('maj', 'major'), ('gen', 'general'), ('drs', 'doctors'), ('rev', '... | class EnglishNormalizer:
def __init__(self):
pass
def number_to_words(self, num: int) -> str:
'''
Converts numbers(`int`) to words(`str`).
Please note that it only supports upto - "'nine hundred ninety-nine quadrillion, nine hundred ninety-nine
trillion, nine hundred ni... | 13 | 11 | 17 | 1 | 13 | 4 | 4 | 0.27 | 0 | 2 | 0 | 0 | 12 | 4 | 12 | 12 | 217 | 18 | 158 | 27 | 145 | 42 | 80 | 27 | 67 | 19 | 0 | 2 | 46 |
1,279 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/processing_clvp.py | transformers.models.clvp.processing_clvp.ClvpProcessor | from ...processing_utils import ProcessorMixin
class ClvpProcessor(ProcessorMixin):
"""
Constructs a CLVP processor which wraps a CLVP Feature Extractor and a CLVP Tokenizer into a single processor.
[`ClvpProcessor`] offers all the functionalities of [`ClvpFeatureExtractor`] and [`ClvpTokenizer`]. See the... |
class ClvpProcessor(ProcessorMixin):
'''
Constructs a CLVP processor which wraps a CLVP Feature Extractor and a CLVP Tokenizer into a single processor.
[`ClvpProcessor`] offers all the functionalities of [`ClvpFeatureExtractor`] and [`ClvpTokenizer`]. See the
[`~ClvpProcessor.__call__`], [`~ClvpProcess... | 3 | 2 | 10 | 1 | 6 | 3 | 2 | 0.78 | 1 | 2 | 0 | 0 | 4 | 0 | 4 | 21 | 68 | 11 | 32 | 13 | 27 | 25 | 26 | 13 | 21 | 6 | 2 | 1 | 9 |
1,280 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/clvp/tokenization_clvp.py | transformers.models.clvp.tokenization_clvp.ClvpTokenizer | from .number_normalizer import EnglishNormalizer
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import json
from typing import Optional
import os
class ClvpTokenizer(PreTrainedTokenizer):
"""
Construct a CLVP tokenizer. Based on byte-level Byte-Pair-Encoding.
This tok... |
class ClvpTokenizer(PreTrainedTokenizer):
'''
Construct a CLVP tokenizer. Based on byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be encoded differently whether it is at the beginning of the sentence (wit... | 16 | 6 | 16 | 2 | 13 | 2 | 3 | 0.42 | 1 | 13 | 1 | 0 | 13 | 12 | 13 | 102 | 287 | 45 | 172 | 68 | 141 | 73 | 124 | 47 | 110 | 9 | 3 | 3 | 41 |
1,281 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/code_llama/tokenization_code_llama.py | transformers.models.code_llama.tokenization_code_llama.CodeLlamaTokenizer | from typing import Any, Optional
from ...convert_slow_tokenizer import import_protobuf
import sentencepiece as spm
from ...utils import logging, requires_backends
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import os
from shutil import copyfile
from ...utils.import_utils import requires
@requires... | @requires(backends=('sentencepiece',))
class CodeLlamaTokenizer(PreTrainedTokenizer):
'''
Construct a CodeLlama tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as
there is no padding token in the original model.
The default configuration match that of
[codellama... | 36 | 10 | 12 | 1 | 9 | 3 | 3 | 0.56 | 1 | 8 | 0 | 0 | 24 | 13 | 24 | 113 | 401 | 62 | 219 | 101 | 161 | 122 | 151 | 66 | 126 | 8 | 3 | 2 | 60 |
1,282 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/code_llama/tokenization_code_llama_fast.py | transformers.models.code_llama.tokenization_code_llama_fast.CodeLlamaTokenizerFast | from tokenizers import normalizers, processors
import os
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
from shutil import copyfile
class CodeLlamaTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding.
Th... |
class CodeLlamaTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding.
This uses notably ByteFallback and no normalization.
```python
>>> from transformers import CodeLlamaTokenizerFast
>>> tokenizer = CodeLlamaTokenizerFast.from_pretrain... | 31 | 4 | 12 | 1 | 9 | 2 | 2 | 0.45 | 1 | 5 | 0 | 0 | 19 | 9 | 19 | 107 | 327 | 47 | 193 | 78 | 140 | 87 | 116 | 45 | 96 | 9 | 3 | 1 | 47 |
1,283 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/configuration_codegen.py | transformers.models.codegen.configuration_codegen.CodeGenConfig | from ...configuration_utils import PretrainedConfig
class CodeGenConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CodeGenModel`]. It is used to instantiate a
CodeGen model according to the specified arguments, defining the model architecture. Instantiating a c... |
class CodeGenConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CodeGenModel`]. It is used to instantiate a
CodeGen model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a simi... | 2 | 1 | 44 | 2 | 42 | 0 | 1 | 1.14 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 117 | 10 | 50 | 42 | 27 | 57 | 22 | 21 | 20 | 1 | 1 | 0 | 1 |
1,284 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/configuration_codegen.py | transformers.models.codegen.configuration_codegen.CodeGenOnnxConfig | from ...onnx import OnnxConfigWithPast, PatchingSpec
from collections.abc import Mapping
from collections import OrderedDict
from ...configuration_utils import PretrainedConfig
from typing import Any, Optional
from ... import PreTrainedTokenizer, is_torch_available
class CodeGenOnnxConfig(OnnxConfigWithPast):
def... |
class CodeGenOnnxConfig(OnnxConfigWithPast):
def __init__(self, config: PretrainedConfig, task: str='default', patching_specs: Optional[list[PatchingSpec]]=None, use_past: bool=False):
pass
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def num_layers... | 11 | 0 | 12 | 1 | 10 | 1 | 2 | 0.06 | 1 | 8 | 0 | 0 | 6 | 0 | 6 | 6 | 79 | 11 | 64 | 33 | 39 | 4 | 34 | 15 | 26 | 4 | 1 | 2 | 11 |
1,285 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/modeling_codegen.py | transformers.models.codegen.modeling_codegen.CodeGenAttention | from ...cache_utils import Cache, DynamicCache
import torch
from torch import nn
from typing import Optional, Union
class CodeGenAttention(nn.Module):
def __init__(self, config, layer_idx=None):
super().__init__()
max_positions = config.max_position_embeddings
self.attn_dropout = nn.Dropou... |
class CodeGenAttention(nn.Module):
def __init__(self, config, layer_idx=None):
pass
def _split_heads(self, x, n_head, dim_head, mp_num):
pass
def _merge_heads(self, tensor, num_attention_heads, attn_head_size):
'''
Merges attn_head_size dim and num_attn_heads dim into n_c... | 6 | 1 | 30 | 5 | 24 | 2 | 3 | 0.08 | 1 | 5 | 1 | 0 | 5 | 11 | 5 | 15 | 157 | 27 | 121 | 59 | 95 | 10 | 86 | 39 | 80 | 5 | 1 | 1 | 15 |
1,286 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/modeling_codegen.py | transformers.models.codegen.modeling_codegen.CodeGenBlock | from typing import Optional, Union
from torch import nn
import torch
from ...cache_utils import Cache, DynamicCache
from ...modeling_layers import GradientCheckpointingLayer
class CodeGenBlock(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
super().__init__()
inner_dim = c... |
class CodeGenBlock(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: Optional[torch.FloatTensor], layer_past: Optional[Cache]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: ... | 3 | 0 | 21 | 2 | 19 | 1 | 2 | 0.08 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 12 | 44 | 4 | 39 | 22 | 26 | 3 | 19 | 12 | 16 | 2 | 1 | 1 | 4 |
1,287 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/modeling_codegen.py | transformers.models.codegen.modeling_codegen.CodeGenForCausalLM | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from torch import nn
from typing import Optional, Union
import torch
from ...cache_utils import Cache, DynamicCache
from ...generation import GenerationMixin
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
@auto_... | @auto_docstring(custom_intro='\n The CodeGen Model transformer with a language modeling head on top.\n ')
class CodeGenForCausalLM(CodeGenPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_... | 5 | 1 | 19 | 1 | 14 | 3 | 2 | 0.22 | 2 | 7 | 3 | 0 | 4 | 2 | 5 | 7 | 108 | 12 | 79 | 34 | 48 | 17 | 27 | 14 | 21 | 5 | 2 | 1 | 9 |
1,288 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/modeling_codegen.py | transformers.models.codegen.modeling_codegen.CodeGenMLP | from typing import Optional, Union
from ...activations import ACT2FN
from torch import nn
import torch
class CodeGenMLP(nn.Module):
def __init__(self, intermediate_size, config):
super().__init__()
embed_dim = config.n_embd
self.fc_in = nn.Linear(embed_dim, intermediate_size)
self.... |
class CodeGenMLP(nn.Module):
def __init__(self, intermediate_size, config):
pass
def forward(self, hidden_states: Optional[torch.FloatTensor]) -> torch.FloatTensor:
pass | 3 | 0 | 8 | 1 | 7 | 1 | 1 | 0.07 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 17 | 3 | 14 | 8 | 11 | 1 | 14 | 8 | 11 | 1 | 1 | 0 | 2 |
1,289 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/modeling_codegen.py | transformers.models.codegen.modeling_codegen.CodeGenModel | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...cache_utils import Cache, DynamicCache
from ...modeling_attn_mask_utils import AttentionMaskConverter
from torch import nn
import torch
from ...utils import auto_docstring, is_torch_flex_attn_avail... | @auto_docstring
class CodeGenModel(CodeGenPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_val... | 10 | 2 | 46 | 5 | 35 | 7 | 7 | 0.2 | 1 | 14 | 6 | 0 | 5 | 8 | 6 | 8 | 289 | 35 | 215 | 72 | 170 | 42 | 111 | 39 | 104 | 27 | 2 | 2 | 43 |
1,290 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/modeling_codegen.py | transformers.models.codegen.modeling_codegen.CodeGenPreTrainedModel | from torch import nn
from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from .configuration_codegen import CodeGenConfig
@auto_docstring
class CodeGenPreTrainedModel(PreTrainedModel):
config: CodeGenConfig
base_model_prefix = 'transformer'
... | @auto_docstring
class CodeGenPreTrainedModel(PreTrainedModel):
def __init__(self, *inputs, **kwargs):
pass
def _init_weights(self, module):
'''Initialize the weights.'''
pass | 4 | 1 | 9 | 0 | 7 | 2 | 4 | 0.3 | 1 | 1 | 0 | 2 | 2 | 0 | 2 | 2 | 33 | 3 | 23 | 11 | 20 | 7 | 21 | 11 | 18 | 6 | 1 | 2 | 7 |
1,291 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/tokenization_codegen.py | transformers.models.codegen.tokenization_codegen.CodeGenTokenizer | import os
from ...utils import logging, to_py_obj
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from typing import TYPE_CHECKING, Optional, Union
import regex as re
import json
class CodeGenTokenizer(PreTrainedTokenizer):
"""
Construct a CodeGen tokenizer. Based on byte-level Byte-Pair-Enco... |
class CodeGenTokenizer(PreTrainedTokenizer):
'''
Construct a CodeGen tokenizer. Based on byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be encoded differently whether it is at the beginning of the sentenc... | 16 | 6 | 18 | 2 | 13 | 3 | 3 | 0.46 | 1 | 12 | 0 | 0 | 14 | 11 | 14 | 103 | 333 | 55 | 192 | 83 | 153 | 89 | 139 | 56 | 123 | 9 | 3 | 3 | 45 |
1,292 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/codegen/tokenization_codegen_fast.py | transformers.models.codegen.tokenization_codegen_fast.CodeGenTokenizerFast | import re
from .tokenization_codegen import CodeGenTokenizer
from typing import TYPE_CHECKING, Optional, Union
from ...tokenization_utils_base import BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
class CodeGenTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" CodeGen ... |
class CodeGenTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" CodeGen tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level
Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be... | 8 | 2 | 20 | 3 | 13 | 5 | 2 | 0.78 | 1 | 8 | 1 | 0 | 7 | 1 | 7 | 95 | 221 | 41 | 101 | 46 | 72 | 79 | 50 | 26 | 41 | 4 | 3 | 1 | 18 |
1,293 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/configuration_cohere.py | transformers.models.cohere.configuration_cohere.CohereConfig | from ...configuration_utils import PretrainedConfig
from ...modeling_rope_utils import rope_config_validation
class CohereConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CohereModel`]. It is used to instantiate an Cohere
model according to the specified argum... |
class CohereConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CohereModel`]. It is used to instantiate an Cohere
model according to the specified arguments, defining the model architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be ... | 2 | 1 | 58 | 4 | 52 | 2 | 2 | 1.61 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 180 | 13 | 64 | 46 | 38 | 103 | 26 | 22 | 24 | 2 | 1 | 1 | 2 |
1,294 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CohereAttention | from ...cache_utils import Cache, DynamicCache
import torch
from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from .configuration_cohere import CohereConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrai... |
class CohereAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: CohereConfig, 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 | 44 | 5 | 38 | 2 | 4 | 0.05 | 1 | 7 | 4 | 1 | 2 | 14 | 2 | 12 | 91 | 11 | 77 | 34 | 66 | 4 | 44 | 26 | 41 | 6 | 1 | 2 | 8 |
1,295 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CohereDecoderLayer | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...cache_utils import Cache, DynamicCache
from ...utils.deprecation import deprecate_kwarg
from .configuration_cohere import CohereConfig
from ...modeling_layers import GradientCheckpointingLayer
from ...processing_utils import Unpack
from typing i... |
class CohereDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: CohereConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_i... | 4 | 1 | 33 | 3 | 19 | 12 | 2 | 0.61 | 1 | 10 | 6 | 1 | 2 | 4 | 2 | 12 | 67 | 7 | 38 | 22 | 24 | 23 | 17 | 11 | 14 | 2 | 1 | 1 | 3 |
1,296 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CohereForCausalLM | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...cache_utils import Cache, DynamicCache
from typing import Callable, Optional, Union
from torch import nn
from ...generation import GenerationMixin
from ...pro... | @auto_docstring
class CohereForCausalLM(CoherePreTrainedModel, 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 | 9 | 4 | 1 | 8 | 5 | 8 | 9 | 126 | 21 | 77 | 38 | 50 | 29 | 39 | 22 | 30 | 8 | 2 | 1 | 15 |
1,297 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CohereLayerNorm | from torch import nn
import torch
class CohereLayerNorm(nn.Module):
def __init__(self, hidden_size=None, eps=1e-05, bias=False):
"""The hidden size can be a tuple or an int. The tuple is used for QKNorm to normalize across head_dim"""
super().__init__()
self.weight = nn.Parameter(torch.one... |
class CohereLayerNorm(nn.Module):
def __init__(self, hidden_size=None, eps=1e-05, bias=False):
'''The hidden size can be a tuple or an int. The tuple is used for QKNorm to normalize across head_dim'''
pass
def forward(self, hidden_states):
pass | 3 | 1 | 7 | 0 | 6 | 1 | 1 | 0.08 | 1 | 1 | 0 | 1 | 2 | 2 | 2 | 12 | 15 | 1 | 13 | 8 | 10 | 1 | 13 | 8 | 10 | 1 | 1 | 0 | 2 |
1,298 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CohereMLP | from torch import nn
from ...activations import ACT2FN
class CohereMLP(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.hid... |
class CohereMLP(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 |
1,299 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CohereModel | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...cache_utils import Cache, DynamicCache
from typing import Callable, Optional, Union
from ...utils.generic import check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from .configuration_cohere... | @auto_docstring
class CohereModel(CoherePreTrainedModel):
def __init__(self, config: CohereConfig):
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.