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,100
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineAttention
from typing import Optional, Union from torch import nn from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer import torch class CanineAttention(nn.Module): """ Additional arguments related to local attention: - **local** (`bool`, *optional*, defa...
class CanineAttention(nn.Module): ''' Additional arguments related to local attention: - **local** (`bool`, *optional*, defaults to `False`) -- Whether to apply local attention. - **always_attend_to_first_position** (`bool`, *optional*, defaults to `False`) -- Should all blocks be able to ...
4
1
41
4
34
4
5
0.25
1
10
2
0
3
10
3
13
141
15
102
50
82
26
72
34
68
11
1
3
16
1,101
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineEmbeddings
import torch from typing import Optional, Union from torch import nn class CanineEmbeddings(nn.Module): """Construct the character, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.config = config shard_embedding_size = config.hidden_size // co...
class CanineEmbeddings(nn.Module): '''Construct the character, position and token_type embeddings.''' def __init__(self, config): pass def _hash_bucket_tensors(self, input_ids, num_hashes: int, num_buckets: int): ''' Converts ids to hash bucket ids via multiple hashing. Ar...
5
3
23
4
16
4
4
0.24
1
5
0
0
4
6
4
14
99
21
63
34
52
15
52
28
47
6
1
1
14
1,102
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineEncoder
from ...modeling_outputs import BaseModelOutput, ModelOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from typing import Optional, Union from torch import nn import torch class CanineEncoder(nn.Module): def __init__(self, config, local=False, always...
class CanineEncoder(nn.Module): def __init__(self, config, local=False, always_attend_to_first_position=False, first_position_attends_to_all=False, attend_from_chunk_width=128, attend_from_chunk_stride=128, attend_to_chunk_width=128, attend_to_chunk_stride=128): pass def forward(self, hidden_states: ...
3
0
36
3
33
0
6
0
1
7
2
0
2
3
2
12
74
7
67
30
46
0
24
11
21
10
1
2
11
1,103
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineForMultipleChoice
import torch from ...utils import auto_docstring, logging from ...modeling_outputs import BaseModelOutput, ModelOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from torch import nn from typing import Optional, Union from torch.nn import BCEWithLogitsLoss,...
@auto_docstring class CanineForMultipleChoice(CaninePreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optio...
5
1
37
5
29
4
6
0.11
1
4
2
0
2
3
2
3
82
10
65
27
44
7
28
14
25
11
2
1
12
1,104
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineForQuestionAnswering
from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import auto_docstring, logging from ...modeling_outputs import BaseModelOutput, ModelOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOut...
@auto_docstring class CanineForQuestionAnswering(CaninePreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Op...
5
0
41
5
30
7
4
0.19
1
4
2
0
2
3
2
3
92
10
69
30
45
13
32
16
29
7
2
2
8
1,105
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineForSequenceClassification
from ...utils import auto_docstring, logging import torch from typing import Optional, Union from ...modeling_outputs import BaseModelOutput, ModelOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from torch import nn from torch.nn import BCEWithLogitsLoss,...
@auto_docstring(custom_intro='\n CANINE Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled\n output) e.g. for GLUE tasks.\n ') class CanineForSequenceClassification(CaninePreTrainedModel): def __init__(self, config): pass @auto_docstrin...
5
1
40
4
33
4
7
0.1
1
5
2
0
2
4
2
3
88
9
72
26
51
7
34
13
31
12
2
3
13
1,106
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineForTokenClassification
import torch from torch import nn from ...utils import auto_docstring, logging from typing import Optional, Union from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...modeling_outputs import BaseModelOutput, ModelOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOut...
@auto_docstring class CanineForTokenClassification(CaninePreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: ...
5
1
47
9
24
14
3
0.55
1
4
2
0
2
4
2
3
97
18
51
26
34
28
22
13
19
5
2
1
6
1,107
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineIntermediate
import torch from torch import nn from ...activations import ACT2FN class CanineIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.intermediate_...
class CanineIntermediate(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: pass
3
0
6
0
6
0
2
0
1
2
0
0
2
2
2
12
13
1
12
5
9
0
11
5
8
2
1
1
3
1,108
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineLMPredictionHead
from torch import nn import torch class CanineLMPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.transform = CaninePredictionHeadTransform(config) self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.bias = nn.Parameter(torc...
class CanineLMPredictionHead(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: tuple[torch.FloatTensor]) -> torch.FloatTensor: pass
3
0
8
2
5
2
1
0.27
1
2
1
0
2
3
2
12
18
4
11
6
8
3
11
6
8
1
1
0
2
1,109
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineLayer
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from typing import Optional, Union import torch from ...modeling_layers import GradientCheckpointingLayer class CanineLayer(GradientCheckpointingLayer): def __init__(self, config, local, always_attend_to_f...
class CanineLayer(GradientCheckpointingLayer): def __init__(self, config, local, always_attend_to_first_position, first_position_attends_to_all, attend_from_chunk_width, attend_from_chunk_stride, attend_to_chunk_width, attend_to_chunk_stride): pass def forward(self, hidden_states: tuple[torch.FloatTe...
4
0
18
1
17
0
1
0.02
1
5
3
0
3
5
3
13
56
5
51
31
31
1
19
15
15
1
1
0
3
1,110
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineModel
import copy import torch from typing import Optional, Union from ...utils import auto_docstring, logging @auto_docstring class CanineModel(CaninePreTrainedModel): def __init__(self, config, add_pooling_layer=True): """ add_pooling_layer (bool, *optional*, defaults to `True`): Whether t...
@auto_docstring class CanineModel(CaninePreTrainedModel): def __init__(self, config, add_pooling_layer=True): ''' add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer ''' pass def _prune_heads(self, heads_to_prune): ''' ...
9
5
43
6
26
11
4
0.41
1
12
6
0
6
8
6
7
271
40
164
66
140
67
84
54
77
19
2
1
26
1,111
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineModelOutputWithPooling
from ...modeling_outputs import BaseModelOutput, ModelOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput from ...utils import auto_docstring, logging import torch from dataclasses import dataclass from typing import Optional, Union @dataclass @auto_docstrin...
@dataclass @auto_docstring(custom_intro='\n Output type of [`CanineModel`]. Based on [`~modeling_outputs.BaseModelOutputWithPooling`], but with slightly\n different `hidden_states` and `attentions`, as these also include the hidden states and attentions of the shallow\n Transformer encoders.\n ') class Cani...
3
1
0
0
0
0
0
5
1
0
0
0
0
0
0
0
32
2
5
5
4
25
5
5
4
0
1
0
0
1,112
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineOnlyMLMHead
from torch import nn import torch class CanineOnlyMLMHead(nn.Module): def __init__(self, config): super().__init__() self.predictions = CanineLMPredictionHead(config) def forward(self, sequence_output: tuple[torch.Tensor]) -> tuple[torch.Tensor]: prediction_scores = self.predictions(s...
class CanineOnlyMLMHead(nn.Module): def __init__(self, config): pass def forward(self, sequence_output: tuple[torch.Tensor]) -> tuple[torch.Tensor]: pass
3
0
5
0
5
0
1
0
1
3
1
0
2
1
2
12
11
1
10
8
4
0
7
5
4
1
1
0
2
1,113
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineOutput
import torch from torch import nn class CanineOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropou...
class CanineOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: tuple[torch.FloatTensor], input_tensor: torch.FloatTensor) -> torch.FloatTensor: pass
3
0
5
0
5
0
1
0
1
1
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
1,114
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CaninePooler
from torch import nn import torch class CaninePooler(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: tuple[torch.FloatTensor]) -> torch.FloatTensor: ...
class CaninePooler(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: tuple[torch.FloatTensor]) -> torch.FloatTensor: pass
3
0
6
0
5
1
1
0.2
1
1
0
0
2
2
2
12
13
1
10
7
7
2
10
7
7
1
1
0
2
1,115
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CaninePreTrainedModel
from ...utils import auto_docstring, logging from torch import nn from ...modeling_utils import PreTrainedModel from .configuration_canine import CanineConfig @auto_docstring class CaninePreTrainedModel(PreTrainedModel): config: CanineConfig base_model_prefix = 'canine' supports_gradient_checkpointing = Tr...
@auto_docstring class CaninePreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.41
1
0
0
5
1
0
1
1
26
2
17
6
15
7
15
6
13
6
1
2
6
1,116
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CaninePredictionHeadTransform
import torch from torch import nn from ...activations import ACT2FN class CaninePredictionHeadTransform(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) if isinstance(config.hidden_act, str): self.transfor...
class CaninePredictionHeadTransform(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: tuple[torch.FloatTensor]) -> torch.FloatTensor: pass
3
0
7
0
7
0
2
0
1
2
0
0
2
3
2
12
15
1
14
6
11
0
13
6
10
2
1
1
3
1,117
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineSelfAttention
from typing import Optional, Union from torch import nn import math import torch class CanineSelfAttention(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')): raise ValueError(f'...
class CanineSelfAttention(nn.Module): def __init__(self, config): pass def forward(self, from_tensor: torch.Tensor, to_tensor: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False) -> tuple[torch.Tensor, O...
3
0
32
6
22
5
4
0.21
1
5
0
0
3
10
3
13
98
19
66
39
55
14
55
32
51
8
1
2
12
1,118
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CanineSelfOutput
import torch from torch import nn class CanineSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropout(...
class CanineSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: tuple[torch.FloatTensor], input_tensor: torch.FloatTensor) -> tuple[torch.FloatTensor, torch.FloatTensor]: pass
3
0
6
0
6
0
1
0
1
1
0
0
2
3
2
12
14
1
13
8
8
0
11
6
8
1
1
0
2
1,119
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.CharactersToMolecules
import torch from ...activations import ACT2FN from torch import nn class CharactersToMolecules(nn.Module): """Convert character sequence to initial molecule sequence (i.e. downsample) using strided convolutions.""" def __init__(self, config): super().__init__() self.conv = nn.Conv1d(in_channe...
class CharactersToMolecules(nn.Module): '''Convert character sequence to initial molecule sequence (i.e. downsample) using strided convolutions.''' def __init__(self, config): pass def forward(self, char_encoding: torch.Tensor) -> torch.Tensor: pass
3
1
20
4
10
7
1
0.67
1
2
0
0
2
3
2
12
44
9
21
10
18
14
16
10
13
1
1
0
2
1,120
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/modeling_canine.py
transformers.models.canine.modeling_canine.ConvProjection
from torch import nn from typing import Optional, Union import torch from ...activations import ACT2FN class ConvProjection(nn.Module): """ Project representations from hidden_size*2 back to hidden_size across a window of w = config.upsampling_kernel_size characters. """ def __init__(self, config)...
class ConvProjection(nn.Module): ''' Project representations from hidden_size*2 back to hidden_size across a window of w = config.upsampling_kernel_size characters. ''' def __init__(self, config): pass def forward(self, inputs: torch.Tensor, final_seq_char_positions: Optional[torch.Te...
3
1
25
2
17
6
2
0.47
1
3
0
0
2
5
2
12
56
6
34
19
27
16
24
15
21
2
1
1
3
1,121
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/tokenization_canine.py
transformers.models.canine.tokenization_canine.CanineTokenizer
from typing import Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer class CanineTokenizer(PreTrainedTokenizer): """ Construct a CANINE tokenizer (i.e. a character splitter). It turns text into a sequence of characters, and then converts each character into its Unicode code point. ...
class CanineTokenizer(PreTrainedTokenizer): ''' Construct a CANINE tokenizer (i.e. a character splitter). It turns text into a sequence of characters, and then converts each character into its Unicode code point. [`CanineTokenizer`] inherits from [`PreTrainedTokenizer`]. Refer to superclass [`PreTr...
12
6
14
2
8
5
2
0.66
1
8
0
0
11
4
11
100
184
31
92
43
62
61
60
25
48
8
3
2
25
1,122
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/configuration_chameleon.py
transformers.models.chameleon.configuration_chameleon.ChameleonConfig
from ...configuration_utils import PretrainedConfig class ChameleonConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ChameleonModel`]. It is used to instantiate a chameleon model according to the specified arguments, defining the model architecture. Instantiati...
class ChameleonConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ChameleonModel`]. It is used to instantiate a chameleon model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield ...
3
2
42
3
38
2
4
1.05
1
5
1
0
2
20
2
2
179
17
79
55
49
83
41
28
38
5
1
1
7
1,123
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/configuration_chameleon.py
transformers.models.chameleon.configuration_chameleon.ChameleonVQVAEConfig
from ...configuration_utils import PretrainedConfig from typing import Optional class ChameleonVQVAEConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ChameleonVQModel`]. It is used to instantiate a `ChameleonVQModel` according to the specified arguments, defini...
class ChameleonVQVAEConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ChameleonVQModel`]. It is used to instantiate a `ChameleonVQModel` according to the specified arguments, defining the model architecture. Configuration objects inherit from [`PretrainedCo...
2
1
31
0
31
0
1
1.03
1
5
0
0
1
13
1
1
72
3
34
33
16
35
18
17
16
1
1
0
1
1,124
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/image_processing_chameleon.py
transformers.models.chameleon.image_processing_chameleon.ChameleonImageProcessor
from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging import numpy as np from ...image_transforms import get_resize_output_image_size, resize, to_channel_dimension_format from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from typing import Opt...
class ChameleonImageProcessor(BaseImageProcessor): ''' Constructs a Chameleon image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by `do_resize` in the ...
6
4
62
5
38
19
8
0.74
1
8
2
0
4
11
4
24
295
27
154
64
109
114
77
24
72
21
3
2
33
1,125
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonAttention
from typing import Callable, Optional, Union import torch from .configuration_chameleon import ChameleonConfig, ChameleonVQVAEConfig from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel import torch.nn.functional as F from torch import nn from ...cache_utils import Cache, DynamicCache from ...utils.de...
class ChameleonAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: ChameleonConfig, layer_idx: Optional[int]=None): pass def _init_rope(self): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='...
5
1
41
6
35
1
4
0.06
1
11
6
2
3
19
3
13
131
20
106
44
92
6
69
34
65
5
1
2
12
1,126
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonDecoderLayer
import torch.nn.functional as F from ...utils.deprecation import deprecate_kwarg from ...modeling_layers import GradientCheckpointingLayer from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache from .configuration_chameleon import ChameleonConfig, ChameleonVQVAEConfig import torch ...
class ChameleonDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: ChameleonConfig, 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, posi...
4
1
36
5
21
11
2
0.5
1
8
4
0
2
5
2
12
73
10
42
21
29
21
23
11
20
3
1
1
4
1,127
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonDynamicNTKScalingRotaryEmbedding
import torch import torch.nn.functional as F class ChameleonDynamicNTKScalingRotaryEmbedding(ChameleonRotaryEmbedding): """ChameleonRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla""" def forward(self, x, position_ids): seq_len = torch.max(positi...
class ChameleonDynamicNTKScalingRotaryEmbedding(ChameleonRotaryEmbedding): '''ChameleonRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla''' def forward(self, x, position_ids): pass
2
1
14
1
12
2
2
0.23
1
1
0
0
1
1
1
13
17
2
13
7
11
3
9
6
7
2
2
1
2
1,128
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonForConditionalGeneration
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...processing_utils import Unpack from ...cache_utils import Cache, DynamicCache from torch import nn from ...generation import GenerationMixin import torch.nn.functional as F import torch from ...modeling_outputs import BaseModelOu...
@auto_docstring(custom_intro='\n Chameleon Model with a head on top used for outputting logits for next token prediction.\n ') class ChameleonForConditionalGeneration(ChameleonPreTrainedModel, GenerationMixin): def __init__(self, config): pass def get_image_tokens(self, pixel_values): pa...
9
1
20
2
13
5
3
0.37
2
6
3
0
9
3
9
10
194
28
125
50
88
46
63
24
53
10
2
3
24
1,129
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonImageVocabularyMapping
import torch.nn.functional as F from functools import cached_property import torch class ChameleonImageVocabularyMapping: """ A class for mapping discrete image tokens from VQGAN to BPE tokens. """ def __init__(self, vocab_map): self.vocab_map = vocab_map self.image_token_id = vocab_ma...
class ChameleonImageVocabularyMapping: ''' A class for mapping discrete image tokens from VQGAN to BPE tokens. ''' def __init__(self, vocab_map): pass @cached_property def val2name(self): pass @cached_property def image_tokens(self): pass @cached_propert...
16
1
3
0
3
0
1
0.09
0
4
0
0
8
2
8
8
45
10
32
24
16
3
26
17
16
2
0
1
10
1,130
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonLayerNorm
from torch import nn import torch.nn.functional as F class ChameleonLayerNorm(nn.LayerNorm): """ LayerNorm but computes stats only over the last dim because Chameleon applies gamma and beta from each shard separately to each head, instead of reducing. We can apply each head's own gamma/beta by repeat-i...
class ChameleonLayerNorm(nn.LayerNorm): ''' LayerNorm but computes stats only over the last dim because Chameleon applies gamma and beta from each shard separately to each head, instead of reducing. We can apply each head's own gamma/beta by repeat-interleaving weights from each shard, but the stats ha...
3
1
4
0
4
0
1
0.75
1
1
0
0
2
1
2
2
16
2
8
4
5
6
8
4
5
1
1
0
2
1,131
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonLinearScalingRotaryEmbedding
class ChameleonLinearScalingRotaryEmbedding(ChameleonRotaryEmbedding): """ChameleonRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev""" def forward(self, x, position_ids): position_ids = position_ids.float() / self.scaling_factor cos, sin = super().forward(x...
class ChameleonLinearScalingRotaryEmbedding(ChameleonRotaryEmbedding): '''ChameleonRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev''' def forward(self, x, position_ids): pass
2
1
5
0
4
1
1
0.4
1
1
0
0
1
0
1
13
8
1
5
3
3
2
5
3
3
1
2
0
1
1,132
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonMLP
from torch import nn from ...activations import ACT2FN class ChameleonMLP(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....
class ChameleonMLP(nn.Module): def __init__(self, config): pass def forward(self, x): pass
3
0
6
0
6
0
1
0.08
1
1
0
0
2
7
2
12
15
1
13
11
10
1
13
11
10
1
1
0
2
1,133
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonModel
from .configuration_chameleon import ChameleonConfig, ChameleonVQVAEConfig from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from ...cache_utils import Cache, DynamicCache from ...processing_utils import Unpack import torch import torch.nn.functional as F from typing import Callable, Optio...
@auto_docstring class ChameleonModel(ChameleonPreTrainedModel): def __init__(self, config: ChameleonConfig): pass def get_image_tokens(self, pixel_values: torch.FloatTensor): ''' Tokenizes images into discrete tokens with VQGAN module. Converts obtained image tokens into BPE to...
8
3
40
5
30
6
6
0.24
1
18
11
0
6
8
7
8
306
40
216
75
171
51
114
44
106
26
2
2
44
1,134
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonPreTrainedModel
from .configuration_chameleon import ChameleonConfig, ChameleonVQVAEConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel @auto_docstring class ChameleonPreTrainedModel(PreTrainedModel): config: ChameleonConf...
@auto_docstring class ChameleonPreTrainedModel(PreTrainedModel): pass
2
0
12
0
12
0
6
0
1
1
1
4
1
0
1
1
25
1
24
14
22
0
22
14
20
6
1
2
6
1,135
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonRMSNorm
import torch.nn.functional as F from torch import nn import torch class ChameleonRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ ChameleonRMSNorm is equivalent to T5LayerNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) ...
class ChameleonRMSNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' ChameleonRMSNorm 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,136
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonRotaryEmbedding
from torch import nn import torch import torch.nn.functional as F class ChameleonRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0): super().__init__() self.scaling_factor = scaling_factor ...
class ChameleonRotaryEmbedding(nn.Module): def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0): pass @torch.no_grad() def forward(self, x, position_ids): pass
4
0
12
0
10
2
2
0.18
1
3
0
2
2
5
2
12
27
1
22
17
18
4
21
16
18
2
1
1
3
1,137
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonSwinDecoderLayer
from .configuration_chameleon import ChameleonConfig, ChameleonVQVAEConfig from ...modeling_layers import GradientCheckpointingLayer from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache import torch.nn.functional as F import torch from ...utils.deprecation import deprecate_kwarg ...
class ChameleonSwinDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: ChameleonConfig, 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, ...
4
1
35
4
21
11
2
0.5
1
8
4
0
2
5
2
12
71
8
42
21
29
21
23
11
20
3
1
1
4
1,138
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonVQVAE
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging import torch.nn.functional as F from .configuration_chameleon import ChameleonConfig, ChameleonVQVAEConfig import torch @auto_docstring(custom_intro='\n The VQ-VAE model used in Chameleon for encoding/decoding images into discrete to...
@auto_docstring(custom_intro='\n The VQ-VAE model used in Chameleon for encoding/decoding images into discrete tokens.\n This model follows the "Make-a-scene: Scene-based text-to-image generation with human priors" paper from\n [ Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv\n ...
4
0
8
0
8
0
2
0.04
1
4
3
0
3
4
3
4
30
4
26
13
22
1
24
13
20
5
2
2
7
1,139
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonVQVAEEncoder
from torch import nn import torch.nn.functional as F import torch class ChameleonVQVAEEncoder(nn.Module): def __init__(self, config): super().__init__() self.num_resolutions = len(config.channel_multiplier) self.num_res_blocks = config.num_res_blocks base_channels = config.base_cha...
class ChameleonVQVAEEncoder(nn.Module): def __init__(self, config): pass def forward(self, pixel_values: torch.LongTensor): pass
3
0
47
4
41
2
6
0.04
1
6
3
0
2
8
2
12
95
9
83
31
80
3
57
31
54
7
1
3
12
1,140
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonVQVAEEncoderAttnBlock
from torch import nn import torch import torch.nn.functional as F class ChameleonVQVAEEncoderAttnBlock(nn.Module): def __init__(self, in_channels): super().__init__() self.in_channels = in_channels self.norm = torch.nn.GroupNorm(num_groups=32, num_channels=in_channels, eps=1e-06, affine=Tr...
class ChameleonVQVAEEncoderAttnBlock(nn.Module): def __init__(self, in_channels): pass def forward(self, hidden_states): pass
3
0
16
2
13
1
1
0.08
1
2
0
0
2
6
2
12
33
5
26
16
23
2
26
16
23
1
1
0
2
1,141
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonVQVAEEncoderConvDownsample
from torch import nn import torch.nn.functional as F class ChameleonVQVAEEncoderConvDownsample(nn.Module): def __init__(self, in_channels): super().__init__() self.conv = nn.Conv2d(in_channels, in_channels, kernel_size=3, stride=2, padding=0) def forward(self, hidden_states): hidden_s...
class ChameleonVQVAEEncoderConvDownsample(nn.Module): def __init__(self, in_channels): pass def forward(self, hidden_states): pass
3
0
4
0
4
1
1
0.13
1
1
0
1
2
1
2
12
10
1
8
4
5
1
8
4
5
1
1
0
2
1,142
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonVQVAEEncoderResnetBlock
import torch from torch import nn import torch.nn.functional as F class ChameleonVQVAEEncoderResnetBlock(nn.Module): def __init__(self, config, in_channels, out_channels=None, conv_shortcut=False): super().__init__() self.in_channels = in_channels self.out_channels = in_channels if out_cha...
class ChameleonVQVAEEncoderResnetBlock(nn.Module): def __init__(self, config, in_channels, out_channels=None, conv_shortcut=False): pass def forward(self, hidden_states): pass
3
0
20
2
18
0
4
0
1
1
0
0
2
10
2
12
42
5
37
20
28
0
29
14
26
4
1
2
7
1,143
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/modeling_chameleon.py
transformers.models.chameleon.modeling_chameleon.ChameleonVQVAEVectorQuantizer
import torch from torch import nn import torch.nn.functional as F class ChameleonVQVAEVectorQuantizer(nn.Module): """ A module for vector quantization using learned embedding vectors. This module implements the quantization process similar to te one described in the VQ-VAE (Vector Quantized Variationa...
class ChameleonVQVAEVectorQuantizer(nn.Module): ''' A module for vector quantization using learned embedding vectors. This module implements the quantization process similar to te one described in the VQ-VAE (Vector Quantized Variational AutoEncoder) paper. It quantizes continuous input vectors int...
3
1
17
4
12
2
1
0.5
1
2
0
0
2
5
2
12
46
10
24
13
21
12
18
13
15
1
1
0
2
1,144
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/processing_chameleon.py
transformers.models.chameleon.processing_chameleon.ChameleonProcessor
import numpy as np from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack from typing import Optional, Union from ...tokenization_utils_base import PreTokenizedInput, TextInput from ...feature_extraction_utils import BatchFeature from ...image_utils import ImageInput class...
class ChameleonProcessor(ProcessorMixin): ''' Constructs a Chameleon processor which wraps a Chameleon image processor and a Chameleon tokenizer into a single processor. [`ChameleonProcessor`] offers all the functionalities of [`ChameleonImageProcessor`] and [`LlamaTokenizerFast`]. See the [`~Chame...
4
3
19
2
10
8
3
1.07
1
9
2
0
5
4
5
22
128
18
54
30
40
58
39
22
33
7
2
2
14
1,145
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/processing_chameleon.py
transformers.models.chameleon.processing_chameleon.ChameleonProcessorKwargs
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack class ChameleonProcessorKwargs(ProcessingKwargs, total=False): text_kwargs: ChameleonTextKwargs _defaults = {'text_kwargs': {'padding': False, 'return_for_text_completion': False, 'return_mm_token_type_ids': Fa...
class ChameleonProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
11
0
11
2
10
0
3
2
2
0
3
0
0
1,146
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chameleon/processing_chameleon.py
transformers.models.chameleon.processing_chameleon.ChameleonTextKwargs
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack class ChameleonTextKwargs(TextKwargs, total=False): return_for_text_completion: bool
class ChameleonTextKwargs(TextKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
2
0
0
1,147
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/configuration_chinese_clip.py
transformers.models.chinese_clip.configuration_chinese_clip.ChineseCLIPConfig
from ...configuration_utils import PretrainedConfig class ChineseCLIPConfig(PretrainedConfig): """ [`ChineseCLIPConfig`] is the configuration class to store the configuration of a [`ChineseCLIPModel`]. It is used to instantiate Chinese-CLIP model according to the specified arguments, defining the text mode...
class ChineseCLIPConfig(PretrainedConfig): ''' [`ChineseCLIPConfig`] is the configuration class to store the configuration of a [`ChineseCLIPModel`]. It is used to instantiate Chinese-CLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating a conf...
2
1
49
7
31
11
8
0.86
1
4
2
0
1
6
2
2
150
27
66
22
58
57
45
17
42
14
1
4
15
1,148
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/configuration_chinese_clip.py
transformers.models.chinese_clip.configuration_chinese_clip.ChineseCLIPOnnxConfig
from ...onnx import OnnxConfig from collections import OrderedDict from collections.abc import Mapping from typing import TYPE_CHECKING, Any class ChineseCLIPOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return OrderedDict([('input_ids', {0: 'batch', 1: 'sequen...
class ChineseCLIPOnnxConfig(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, ...
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,149
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/configuration_chinese_clip.py
transformers.models.chinese_clip.configuration_chinese_clip.ChineseCLIPTextConfig
from ...configuration_utils import PretrainedConfig class ChineseCLIPTextConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ChineseCLIPModel`]. It is used to instantiate a Chinese CLIP model according to the specified arguments, defining the model architecture. ...
class ChineseCLIPTextConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ChineseCLIPModel`]. It is used to instantiate a Chinese CLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults ...
2
1
37
1
36
0
1
1.54
1
1
0
0
1
15
1
1
110
11
39
38
18
60
20
19
18
1
1
0
1
1,150
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/configuration_chinese_clip.py
transformers.models.chinese_clip.configuration_chinese_clip.ChineseCLIPVisionConfig
from ...configuration_utils import PretrainedConfig class ChineseCLIPVisionConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ChineseCLIPModel`]. It is used to instantiate an ChineseCLIP model according to the specified arguments, defining the model architecture...
class ChineseCLIPVisionConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ChineseCLIPModel`]. It is used to instantiate an ChineseCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the default...
2
1
32
1
31
0
1
1.35
1
1
0
0
1
13
1
1
89
9
34
33
16
46
18
17
16
1
1
0
1
1,151
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/feature_extraction_chinese_clip.py
transformers.models.chinese_clip.feature_extraction_chinese_clip.ChineseCLIPFeatureExtractor
import warnings from .image_processing_chinese_clip import ChineseCLIPImageProcessor from ...utils.import_utils import requires @requires(backends=('vision',)) class ChineseCLIPFeatureExtractor(ChineseCLIPImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class ChineseCLIPFea...
@requires(backends=('vision',)) class ChineseCLIPFeatureExtractor(ChineseCLIPImageProcessor): 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,152
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/image_processing_chinese_clip.py
transformers.models.chinese_clip.image_processing_chinese_clip.ChineseCLIPImageProcessor
from ...utils.import_utils import requires from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images, validate_preprocess_arguments import numpy as np from ...uti...
@requires(backends=('vision',)) class ChineseCLIPImageProcessor(BaseImageProcessor): ''' Constructs a Chinese-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 overridde...
6
3
71
5
43
23
9
0.78
1
8
2
1
3
11
3
23
257
20
133
59
89
104
62
19
58
21
3
2
27
1,153
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPModel
from .configuration_chinese_clip import ChineseCLIPConfig, ChineseCLIPTextConfig, ChineseCLIPVisionConfig import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from typing import Any, Callable, Optional, Union from ...utils import ModelOut...
@auto_docstring class ChineseCLIPModel(ChineseCLIPPreTrainedModel): def __init__(self, config: ChineseCLIPConfig): pass @filter_out_non_signature_kwargs() @auto_docstring def get_text_features(self, input_ids: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[t...
12
3
56
10
34
14
5
0.39
1
11
6
0
4
8
4
5
235
42
140
63
103
54
60
32
55
8
2
2
19
1,154
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPOutput
from dataclasses import dataclass 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, BaseModelOutputWithPoolingAndCrossAttentions from typing import Any, Callabl...
@dataclass @auto_docstring class ChineseCLIPOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`): Contrastive loss for image-text similarity. logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batch_size)`): ...
4
1
5
0
5
0
2
1.62
1
2
0
0
1
0
1
1
36
2
13
9
11
21
10
9
8
2
1
0
2
1,155
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPPreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from .configuration_chinese_clip import ChineseCLIPConfig, ChineseCLIPTextConfig, ChineseCLIPVisionConfig @...
@auto_docstring class ChineseCLIPPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
46
1
44
1
11
0.1
1
5
5
3
1
0
1
1
56
3
48
10
46
5
38
10
36
11
1
3
11
1,156
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextAttention
from typing import Any, Callable, Optional, Union from torch import nn import torch from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer class ChineseCLIPTextAttention(nn.Module): def __init__(self, config): super().__init__() self.self = Chi...
class ChineseCLIPTextAttention(nn.Module): def __init__(self, config): pass def prune_heads(self, heads): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=F...
4
0
15
1
14
1
1
0.07
1
5
1
0
3
3
3
13
49
4
43
20
30
3
22
11
18
2
1
1
4
1,157
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextEmbeddings
import torch from typing import Any, Callable, Optional, Union from torch import nn class ChineseCLIPTextEmbeddings(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(confi...
class ChineseCLIPTextEmbeddings(nn.Module): '''Construct the embeddings from word, position and token_type embeddings.''' def __init__(self, config): pass def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.Lo...
3
1
29
3
23
3
4
0.15
1
3
0
0
2
6
2
12
62
8
47
23
37
7
34
16
31
7
1
2
8
1,158
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextEncoder
from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from typing import Any, Callable, Optional, ...
class ChineseCLIPTextEncoder(nn.Module): def __init__(self, config): pass @can_return_tuple def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, output_hidden_states: O...
4
0
45
4
41
0
9
0
1
8
2
0
2
3
2
12
91
8
83
26
68
0
35
14
32
17
1
3
18
1,159
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextIntermediate
from torch import nn from ...activations import ACT2FN import torch class ChineseCLIPTextIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.inte...
class ChineseCLIPTextIntermediate(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,160
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextLayer
from ...modeling_layers import GradientCheckpointingLayer from typing import Any, Callable, Optional, Union from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer import torch class ChineseCLIPTextLayer(GradientCheckpointingLayer): def __init__(self, config): ...
class ChineseCLIPTextLayer(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.Tens...
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,161
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions 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 .configura...
@auto_docstring(custom_intro='\n The text model from CHINESE_CLIP without any head or projection on top.\n ') class ChineseCLIPTextModel(ChineseCLIPPreTrainedModel): ''' The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of cross-attention is adde...
9
3
30
3
20
7
5
0.38
1
8
4
0
5
4
5
6
177
25
110
43
83
42
57
27
51
18
2
2
24
1,162
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextOutput
import torch from torch import nn class ChineseCLIPTextOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = ...
class ChineseCLIPTextOutput(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,163
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextPooler
import torch from torch import nn class ChineseCLIPTextPooler(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) -> torch.Tensor: f...
class ChineseCLIPTextPooler(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,164
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextSelfAttention
from torch import nn from typing import Any, Callable, Optional, Union from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel import torch class ChineseCLIPTextSelfAttention(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_head...
class ChineseCLIPTextSelfAttention(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]: ...
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,165
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPTextSelfOutput
from torch import nn import torch class ChineseCLIPTextSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn...
class ChineseCLIPTextSelfOutput(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,166
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPVisionAttention
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel import torch from torch import nn from typing import Any, Callable, Optional, Union class ChineseCLIPVisionAttention(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super(...
class ChineseCLIPVisionAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, output_attentions: Optional[bool]=False, **kwargs) -> tuple[torch.Tensor, Optional[torch.Tensor], Option...
3
2
26
5
19
2
2
0.12
1
5
0
0
3
10
3
13
82
17
58
28
50
7
44
24
40
4
1
1
7
1,167
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPVisionEmbeddings
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from .configuration_chinese_clip import ChineseCLIPConfig, ChineseCLIPTextConfig, ChineseCLIPVisionConfig import torch from torch import nn class ChineseCLIPVisionEmbeddings(nn.Module): def __in...
class ChineseCLIPVisionEmbeddings(nn.Module): def __init__(self, config: ChineseCLIPVisionConfig): 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 b...
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,168
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPVisionEncoder
from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from .configuration_chinese_clip import ChineseCLIPConfig, ChineseCLIPTextConfig, ChineseCLIPVisionConfig from typing import Any, Callable, Optional, Union from torch import nn from ...modeling_output...
class ChineseCLIPVisionEncoder(nn.Module): ''' Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a [`ChineseCLIPVisionEncoderLayer`]. Args: config: ChineseCLIPConfig ''' def __init__(self, config: ChineseCLIPConfig): pass @can...
4
2
33
3
22
8
7
0.47
1
8
3
0
2
3
2
12
75
9
45
17
36
21
27
11
24
12
1
2
13
1,169
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPVisionLayer
from typing import Any, Callable, Optional, Union from torch import nn from .configuration_chinese_clip import ChineseCLIPConfig, ChineseCLIPTextConfig, ChineseCLIPVisionConfig from ...modeling_layers import GradientCheckpointingLayer import torch class ChineseCLIPVisionLayer(GradientCheckpointingLayer): def __in...
class ChineseCLIPVisionLayer(GradientCheckpointingLayer): def __init__(self, config: ChineseCLIPConfig): pass def forward(self, hidden_states: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]: ''' Args: hidden_states (`torch.FloatTensor`):...
3
1
20
3
14
4
2
0.25
1
6
3
0
2
5
2
12
41
6
28
15
21
7
21
11
18
2
1
1
3
1,170
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPVisionMLP
from ...activations import ACT2FN import torch from torch import nn class ChineseCLIPVisionMLP(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...
class ChineseCLIPVisionMLP(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,171
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPVisionModel
import torch 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 ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from .configura...
@auto_docstring(custom_intro='\n The vision model from CHINESE_CLIP without any head or projection on top.\n ') class ChineseCLIPVisionModel(ChineseCLIPPreTrainedModel): def __init__(self, config: ChineseCLIPVisionConfig): pass def get_input_embeddings(self) -> nn.Module: pass @auto_...
6
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,172
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/modeling_chinese_clip.py
transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPVisionTransformer
from torch import nn import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from .configuration_chinese_clip import Chin...
class ChineseCLIPVisionTransformer(nn.Module): def __init__(self, config: ChineseCLIPVisionConfig): pass @can_return_tuple @auto_docstring def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, interp...
5
0
26
4
21
2
4
0.07
1
7
4
0
2
5
2
12
56
8
45
21
33
3
24
13
21
6
1
1
7
1,173
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/chinese_clip/processing_chinese_clip.py
transformers.models.chinese_clip.processing_chinese_clip.ChineseCLIPProcessor
from ...processing_utils import ProcessorMixin import warnings class ChineseCLIPProcessor(ProcessorMixin): """ Constructs a Chinese-CLIP processor which wraps a Chinese-CLIP image processor and a Chinese-CLIP tokenizer into a single processor. [`ChineseCLIPProcessor`] offers all the functionalities of...
class ChineseCLIPProcessor(ProcessorMixin): ''' Constructs a Chinese-CLIP processor which wraps a Chinese-CLIP image processor and a Chinese-CLIP tokenizer into a single processor. [`ChineseCLIPProcessor`] offers all the functionalities of [`ChineseCLIPImageProcessor`] and [`BertTokenizerFast`]. Se...
4
1
17
2
10
6
3
0.75
1
7
2
0
6
1
6
23
130
18
64
27
48
48
42
18
35
7
2
1
16
1,174
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/configuration_clap.py
transformers.models.clap.configuration_clap.ClapAudioConfig
from ...configuration_utils import PretrainedConfig class ClapAudioConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ClapAudioModel`]. It is used to instantiate a CLAP audio encoder according to the specified arguments, defining the model architecture. Instanti...
class ClapAudioConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ClapAudioModel`]. It is used to instantiate a CLAP audio encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yie...
2
1
60
0
60
0
1
1.25
1
1
0
0
1
27
1
1
151
9
63
61
31
79
33
31
31
1
1
0
1
1,175
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/configuration_clap.py
transformers.models.clap.configuration_clap.ClapConfig
from ...configuration_utils import PretrainedConfig class ClapConfig(PretrainedConfig): """ [`ClapConfig`] is the configuration class to store the configuration of a [`ClapModel`]. It is used to instantiate a CLAP model according to the specified arguments, defining the text model and audio model configs. ...
class ClapConfig(PretrainedConfig): ''' [`ClapConfig`] is the configuration class to store the configuration of a [`ClapModel`]. It is used to instantiate a CLAP model according to the specified arguments, defining the text model and audio model configs. Instantiating a configuration with the defaults ...
2
1
23
4
16
3
2
1.26
1
3
2
0
1
8
2
2
100
21
35
23
22
44
25
13
22
3
1
1
4
1,176
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/configuration_clap.py
transformers.models.clap.configuration_clap.ClapTextConfig
from ...configuration_utils import PretrainedConfig class ClapTextConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`ClapTextModel`]. It is used to instantiate a CLAP model according to the specified arguments, defining the model architecture. Instantiating a co...
class ClapTextConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`ClapTextModel`]. It is used to instantiate a CLAP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simil...
2
1
41
1
40
0
1
1.37
1
1
0
0
1
16
1
1
113
11
43
42
19
59
21
20
19
1
1
0
1
1,177
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/feature_extraction_clap.py
transformers.models.clap.feature_extraction_clap.ClapFeatureExtractor
from ...feature_extraction_utils import BatchFeature import numpy as np from typing import Any, Optional, Union from ...utils import TensorType, logging import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...utils.import_utils import requires from ...feature_extraction_sequence_ut...
@requires(backends=('torch',)) class ClapFeatureExtractor(SequenceFeatureExtractor): ''' Constructs a CLAP feature extractor. This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains most of the main methods. Users should refer to this superclas...
8
5
46
4
31
12
5
0.62
1
11
1
0
6
13
6
23
331
31
186
72
155
116
110
48
103
15
3
3
32
1,178
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioAFFBlock
from torch import nn from .configuration_clap import ClapAudioConfig, ClapConfig, ClapTextConfig class ClapAudioAFFBlock(nn.Module): """ ATTENTIONAL FEATURE FUSION Block from CLAP, since in CLAP we are always in 2D mode, it is not needed to implement the 1D version. """ def __init__(self, config: ...
class ClapAudioAFFBlock(nn.Module): ''' ATTENTIONAL FEATURE FUSION Block from CLAP, since in CLAP we are always in 2D mode, it is not needed to implement the 1D version. ''' def __init__(self, config: ClapAudioConfig): pass def forward(self, hidden_states, residual): pass
3
1
16
2
14
0
1
0.14
1
3
1
0
2
3
2
12
38
6
28
12
25
4
15
12
12
1
1
0
2
1,179
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioAttention
from typing import Any, Callable, Optional, Union from torch import nn import torch.nn.functional as F import torch from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, meshgrid, prune_linear_layer class ClapAudioAttention(nn.Module): def __init__(self, config, dim, num_heads,...
class ClapAudioAttention(nn.Module): def __init__(self, config, dim, num_heads, window_size): pass def prune_heads(self, heads): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_atten...
4
0
11
1
10
1
1
0.1
1
6
2
0
3
3
3
13
36
4
30
17
20
3
22
11
18
2
1
1
4
1,180
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioEncoder
import torch.nn.functional as F import torch from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions from typing import Any, Callable, Optional, Union from torch import nn class ClapAudioEncoder(nn.Module): def __init__(self, config): super...
class ClapAudioEncoder(nn.Module): def __init__(self, config): pass def reshape_mel2img(self, normalized_input_features): ''' The input is 4 normalized log mel spectrograms. It is reshape to the common shape of images. Each channel should represent 1 of the 4 crops of the spec...
4
1
66
12
50
4
6
0.07
1
12
5
0
3
15
3
13
200
37
152
58
138
11
93
48
89
13
1
2
19
1,181
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioIntermediate
from ...activations import ACT2FN import torch import torch.nn.functional as F from torch import nn class ClapAudioIntermediate(nn.Module): def __init__(self, config, dim): super().__init__() self.dense = nn.Linear(dim, int(config.mlp_ratio * dim)) if isinstance(config.hidden_act, str): ...
class ClapAudioIntermediate(nn.Module): def __init__(self, config, dim): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
2
0
1
4
0
0
2
2
2
12
13
1
12
5
9
0
11
5
8
2
1
1
3
1,182
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioLayer
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 from typing import Any, Callable, Optional, Union class ClapAudioLayer(nn.Module): def __init__(self, config, dim, input_resolut...
class ClapAudioLayer(nn.Module): def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0): pass def set_shift_and_window_size(self, input_resolution): pass def get_attn_mask(self, height, width, dtype, device): pass def maybe_pad(self, h...
6
0
24
3
19
1
3
0.06
1
10
4
0
5
10
5
15
123
19
98
49
85
6
73
42
67
6
1
3
16
1,183
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioModel
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...
class ClapAudioModel(ClapPreTrainedModel): def __init__(self, config: ClapAudioConfig): pass def get_input_embeddings(self) -> nn.Module: pass @auto_docstring def forward(self, input_features: Optional[torch.FloatTensor]=None, is_longer: Optional[torch.BoolTensor]=None, output_attenti...
5
1
16
2
9
5
2
0.48
1
5
3
0
3
1
3
4
56
10
31
15
18
15
14
7
10
4
2
0
6
1,184
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioModelOutput
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 typing import Any, Callable, Optional, Union from dataclasses import dataclass @dataclass @auto_docstring(custom_intro='\n ClapAudio model output ...
@dataclass @auto_docstring(custom_intro='\n ClapAudio model output to mimic the output of the original implementation.\n ') class ClapAudioModelOutput(ModelOutput): ''' audio_embeds (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): The Audio embeddings obtained by applying the projection...
3
1
0
0
0
0
0
3.4
1
0
0
0
0
0
0
0
26
4
5
5
4
17
5
5
4
0
1
0
0
1,185
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioModelWithProjection
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 from .configuration_clap import ClapAudioConfig, ClapConfig, ClapTextConfig @auto_d...
@auto_docstring class ClapAudioModelWithProjection(ClapPreTrainedModel): def __init__(self, config: ClapAudioConfig): pass def get_input_embeddings(self) -> nn.Module: pass @can_return_tuple @auto_docstring def forward(self, input_features: Optional[torch.FloatTensor]=None, is_long...
7
1
21
3
13
5
3
0.35
1
7
4
0
3
2
3
4
71
13
43
20
30
15
21
12
17
6
2
1
8
1,186
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioOutput
import torch import torch.nn.functional as F from torch import nn class ClapAudioOutput(nn.Module): def __init__(self, config, dim): super().__init__() self.dense = nn.Linear(int(config.mlp_ratio * dim), dim) self.dropout = nn.Dropout(config.hidden_dropout_prob) def forward(self, hidd...
class ClapAudioOutput(nn.Module): def __init__(self, config, dim): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
4
0
4
0
1
0
1
3
0
0
2
2
2
12
10
1
9
5
6
0
9
5
6
1
1
0
2
1,187
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioPatchEmbed
import torch import torch.nn.functional as F from torch import nn from .configuration_clap import ClapAudioConfig, ClapConfig, ClapTextConfig class ClapAudioPatchEmbed(nn.Module): """ This module converts the hidden states reshaped as an image to patch embeddings ready to be passed to the Transformer block...
class ClapAudioPatchEmbed(nn.Module): ''' This module converts the hidden states reshaped as an image to patch embeddings ready to be passed to the Transformer block. ''' def __init__(self, config: ClapAudioConfig): pass def forward(self, hidden_states, is_longer_idx=None): pa...
3
1
45
8
36
2
7
0.1
1
5
2
0
2
10
2
12
96
17
72
24
69
7
47
24
44
7
1
2
13
1,188
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioPatchMerging
import torch import torch.nn.functional as F from torch import nn class ClapAudioPatchMerging(nn.Module): """ Patch Merging Layer. Args: input_resolution (`tuple[int]`): Resolution of input feature. dim (`int`): Number of input channels. norm_layer (`nn.Modu...
class ClapAudioPatchMerging(nn.Module): ''' Patch Merging Layer. Args: input_resolution (`tuple[int]`): Resolution of input feature. dim (`int`): Number of input channels. norm_layer (`nn.Module`, *optional*, defaults to `nn.LayerNorm`): Normaliza...
4
1
12
1
9
3
1
0.67
1
3
0
0
3
4
3
13
52
8
27
16
23
18
27
16
23
2
1
1
4
1,189
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioSelfAttention
import torch.nn.functional as F import math import torch import collections from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, meshgrid, prune_linear_layer from typing import Any, Callable, Optional, Union from torch import nn class ClapAudioSelfAttention(nn.Module): def __i...
class ClapAudioSelfAttention(nn.Module): def __init__(self, config, dim, num_heads, window_size): 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) -> tuple[torch....
3
0
32
6
24
2
3
0.1
1
5
0
0
3
9
3
13
98
19
72
38
62
7
56
32
52
4
1
1
8
1,190
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioSelfOutput
from torch import nn import torch import torch.nn.functional as F class ClapAudioSelfOutput(nn.Module): def __init__(self, config, dim): super().__init__() self.dense = nn.Linear(dim, dim) self.dropout = nn.Dropout(config.attention_probs_dropout_prob) def forward(self, hidden_states: ...
class ClapAudioSelfOutput(nn.Module): def __init__(self, config, dim): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
1
4
0
1
0
1
2
0
0
2
2
2
12
11
2
9
5
6
0
9
5
6
1
1
0
2
1,191
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapAudioStage
from typing import Any, Callable, Optional, Union from torch import nn import torch.nn.functional as F import torch from ...modeling_layers import GradientCheckpointingLayer class ClapAudioStage(GradientCheckpointingLayer): def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, downsample)...
class ClapAudioStage(GradientCheckpointingLayer): def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, downsample): pass def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int], head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional...
3
0
28
4
24
1
4
0.02
1
7
1
0
2
5
2
12
58
8
49
23
39
1
26
16
23
5
1
1
8
1,192
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapDropPath
import torch import torch.nn.functional as F from torch import nn class ClapDropPath(nn.Module): """ Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is a slightly refactored version of the `SwinDropPath` implementation. """ def __init__(self, drop_prob...
class ClapDropPath(nn.Module): ''' Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is a slightly refactored version of the `SwinDropPath` implementation. ''' def __init__(self, drop_prob=None): pass def forward(self, hidden_states): ...
3
1
8
1
6
1
2
0.46
1
1
0
0
2
1
2
12
22
4
13
8
10
6
13
8
10
2
1
1
3
1,193
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapModel
import torch.nn.functional as F import math 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_c...
@auto_docstring class ClapModel(ClapPreTrainedModel): def __init__(self, config: ClapConfig): 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
54
10
33
12
6
0.35
1
12
7
0
4
7
4
5
225
42
136
63
100
47
61
33
56
9
2
1
22
1,194
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapOutput
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 typing import Any, Callable,...
@dataclass @auto_docstring class ClapOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`): Contrastive loss for audio-text similarity. logits_per_audio (`torch.FloatTensor` of shape `(audio_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,195
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapPreTrainedModel
import math from ...utils import ModelOutput, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int from .configuration_clap import ClapAudioConfig, ClapConfig, ClapTextConfig from torch import nn from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel @auto_docstring cla...
@auto_docstring class ClapPreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module): '''Initialize the weights''' pass
3
1
21
2
18
1
7
0.23
1
2
2
5
1
0
1
1
31
4
22
7
20
5
18
7
16
7
1
2
7
1,196
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapProjectionLayer
from torch import nn from .configuration_clap import ClapAudioConfig, ClapConfig, ClapTextConfig from ...activations import ACT2FN from typing import Any, Callable, Optional, Union class ClapProjectionLayer(nn.Module): def __init__(self, config: Union[ClapAudioConfig, ClapTextConfig]): super().__init__() ...
class ClapProjectionLayer(nn.Module): def __init__(self, config: Union[ClapAudioConfig, ClapTextConfig]): pass def forward(self, hidden_states): pass
3
0
7
1
7
0
1
0
1
3
2
0
2
4
2
12
16
2
14
9
11
0
14
9
11
1
1
0
2
1,197
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapTextAttention
import torch from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, meshgrid, prune_linear_layer from typing import Any, Callable, Optional, Union from torch import nn import torch.nn.functional as F class ClapTextAttention(nn.Module): def __init__(self, config): super()...
class ClapTextAttention(nn.Module): def __init__(self, config): pass def prune_heads(self, heads): 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, *...
4
0
15
1
14
1
1
0.07
1
5
1
0
3
3
3
13
49
4
43
20
30
3
22
11
18
2
1
1
4
1,198
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapTextEmbeddings
from typing import Any, Callable, Optional, Union import torch import torch.nn.functional as F from torch import nn class ClapTextEmbeddings(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.word_embedd...
class ClapTextEmbeddings(nn.Module): '''Construct the embeddings from word, position and token_type embeddings.''' def __init__(self, config): pass def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTenso...
7
3
26
3
18
5
3
0.32
1
1
0
0
3
7
3
13
87
13
56
23
50
18
43
21
39
8
1
2
10
1,199
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/clap/modeling_clap.py
transformers.models.clap.modeling_clap.ClapTextEncoder
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 typing import Any, Callable,...
class ClapTextEncoder(nn.Module): def __init__(self, config): pass @can_return_tuple def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, output_hidden_states: Optional...
4
0
45
4
41
0
9
0
1
8
2
0
2
3
2
12
91
8
83
26
68
0
35
14
32
17
1
3
18