id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
5,400
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py
transformers.models.stablelm.modeling_stablelm.StableLmModel
from ...cache_utils import Cache, DynamicCache from typing import Optional, Union from ...modeling_attn_mask_utils import AttentionMaskConverter from torch import nn import torch from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging from .configuration_stablelm import StableLmConf...
@auto_docstring class StableLmModel(StableLmPreTrainedModel): ''' Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`StableLmDecoderLayer`] Args: config: StableLmConfig ''' def __init__(self, config: StableLmConfig): pass @can_return_tuple ...
9
2
44
5
33
6
7
0.22
1
15
8
0
5
8
6
7
279
36
201
67
164
44
103
37
96
26
2
2
42
5,401
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py
transformers.models.stablelm.modeling_stablelm.StableLmPreTrainedModel
from .configuration_stablelm import StableLmConfig from torch import nn from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging from ...modeling_utils import PreTrainedModel @auto_docstring class StableLmPreTrainedModel(PreTrainedModel): config: StableLmConfig base_model_pr...
@auto_docstring class StableLmPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
10
0
10
0
5
0
1
0
0
4
1
0
1
1
22
1
21
13
19
0
20
13
18
5
1
2
5
5,402
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py
transformers.models.stablelm.modeling_stablelm.StableLmRotaryEmbedding
from .configuration_stablelm import StableLmConfig from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update from torch import nn import torch class StableLmRotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: StableLmConfig, device=None): super().__init__() ...
class StableLmRotaryEmbedding(nn.Module): def __init__(self, config: StableLmConfig, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
18
2
13
5
3
0.35
1
4
1
0
3
7
3
13
59
8
40
21
35
14
38
20
34
3
1
1
8
5,403
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py
transformers.models.stablelm.modeling_stablelm.StableLmSdpaAttention
from ...cache_utils import Cache, DynamicCache from typing import Optional, Union import torch from ...utils.deprecation import deprecate_kwarg class StableLmSdpaAttention(StableLmAttention): @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch....
class StableLmSdpaAttention(StableLmAttention): @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_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, outpu...
3
0
105
16
78
13
8
0.16
1
4
1
0
1
0
1
13
106
16
79
23
67
13
39
13
37
8
2
1
8
5,404
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/configuration_starcoder2.py
transformers.models.starcoder2.configuration_starcoder2.Starcoder2Config
from ...modeling_rope_utils import rope_config_validation from ...configuration_utils import PretrainedConfig class Starcoder2Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`Starcoder2Model`]. It is used to instantiate a Starcoder2 model according to the spec...
class Starcoder2Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`Starcoder2Model`]. It is used to instantiate a Starcoder2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yie...
2
1
53
1
50
2
2
1.67
1
1
0
0
1
18
1
1
175
12
61
46
36
102
27
23
25
2
1
1
2
5,405
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2Attention
import torch from ...modeling_flash_attention_utils import FlashAttentionKwargs from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from torch import nn from .configuration_starcoder2 import Starcoder2Config from ...cache_utils import Cache, DynamicCache from ...utils.deprecation import deprecate_kwa...
class Starcoder2Attention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, config: Starcoder2Config, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_st...
4
1
34
4
30
2
3
0.07
1
6
3
0
2
12
2
12
71
9
60
32
49
4
36
24
33
5
1
2
6
5,406
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2DecoderLayer
from torch import nn import torch from ...utils.deprecation import deprecate_kwarg from ...cache_utils import Cache, DynamicCache from typing import Callable, Optional, Union from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer from ...utils import T...
class Starcoder2DecoderLayer(GradientCheckpointingLayer): def __init__(self, config: Starcoder2Config, 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, po...
4
0
24
3
21
2
2
0.07
1
9
5
0
2
5
2
12
50
6
42
22
28
3
21
11
18
2
1
1
3
5,407
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2ForCausalLM
from typing import Callable, Optional, Union import torch from ...processing_utils import Unpack from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...cache_utils import Cache, DynamicCache from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast from ...generation imp...
@auto_docstring class Starcoder2ForCausalLM(Starcoder2PreTrainedModel, 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.Lon...
6
1
14
2
9
4
2
0.38
2
9
4
0
8
3
8
9
123
21
74
36
47
28
36
20
27
8
2
1
15
5,408
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2ForSequenceClassification
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class Starcoder2ForSequenceClassification(GenericForSequenceClassification, Starcoder2PreTrainedModel): pass
class Starcoder2ForSequenceClassification(GenericForSequenceClassification, Starcoder2PreTrainedModel): pass
1
0
21
2
17
2
3
0.11
1
7
3
0
4
3
4
5
90
11
71
31
53
8
36
18
31
9
2
1
12
5,409
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2ForTokenClassification
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer class Starcoder2ForTokenClassification(GenericForTokenClassification, Starcoder2PreTrainedModel): pass
class Starcoder2ForTokenClassification(GenericForTokenClassification, Starcoder2PreTrainedModel): pass
1
0
17
1
14
2
3
0.11
1
5
2
0
4
4
4
5
79
8
64
28
41
7
29
15
24
5
2
1
10
5,410
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2MLP
import torch from torch import nn from typing import Callable, Optional, Union from .configuration_starcoder2 import Starcoder2Config from ...activations import ACT2FN class Starcoder2MLP(nn.Module): def __init__(self, config: Starcoder2Config): super().__init__() embed_dim = config.hidden_size ...
class Starcoder2MLP(nn.Module): def __init__(self, config: Starcoder2Config): 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
5,411
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2Model
from typing import Callable, Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast import torch from torch import nn from ...cache_utils import Cache, DynamicCache from .configuration_starcoder2 import St...
@auto_docstring class Starcoder2Model(Starcoder2PreTrainedModel): def __init__(self, config: Starcoder2Config): pass @check_model_inputs def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key...
5
0
44
4
33
7
7
0.24
1
16
10
0
5
9
6
7
277
33
199
72
160
47
99
39
92
20
2
3
40
5,412
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2PreTrainedModel
from .configuration_starcoder2 import Starcoder2Config from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel @auto_docstring class Starcoder2PreTrainedModel(PreTrainedModel): config: Starcoder2Config base_model_prefix = ...
@auto_docstring class Starcoder2PreTrainedModel(PreTrainedModel): pass
2
0
10
0
10
0
5
0
1
0
0
4
1
0
1
1
24
1
23
15
21
0
22
15
20
5
1
2
5
5,413
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modeling_starcoder2.py
transformers.models.starcoder2.modeling_starcoder2.Starcoder2RotaryEmbedding
import torch from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update from .configuration_starcoder2 import Starcoder2Config from torch import nn class Starcoder2RotaryEmbedding(nn.Module): inv_freq: torch.Tensor def __init__(self, config: Starcoder2Config, device=None): super().__i...
class Starcoder2RotaryEmbedding(nn.Module): def __init__(self, config: Starcoder2Config, device=None): pass @torch.no_grad() @dynamic_rope_update def forward(self, x, position_ids): pass
5
0
18
2
13
5
3
0.35
1
4
1
0
3
7
3
13
59
8
40
21
35
14
38
20
34
3
1
1
8
5,414
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modular_starcoder2.py
transformers.models.starcoder2.modular_starcoder2.Starcoder2Attention
from ...utils.deprecation import deprecate_kwarg from torch import nn from ...modeling_flash_attention_utils import FlashAttentionKwargs from typing import Callable, Optional, Union from ...cache_utils import Cache, DynamicCache from ...processing_utils import Unpack from ..mistral.modeling_mistral import MistralAttent...
class Starcoder2Attention(MistralAttention): def __init__(self, config: Starcoder2Config, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torc...
4
0
30
4
26
2
3
0.06
1
6
3
0
2
8
2
14
62
8
53
27
42
3
29
17
26
5
2
2
6
5,415
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modular_starcoder2.py
transformers.models.starcoder2.modular_starcoder2.Starcoder2DecoderLayer
from ..mistral.modeling_mistral import MistralAttention, MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward from .configuration_starcoder2 import Starcoder2Config from torch import ...
class Starcoder2DecoderLayer(MistralDecoderLayer): def __init__(self, config: Starcoder2Config, layer_idx: int): pass
2
0
6
0
6
0
1
0
1
5
3
0
1
4
1
13
7
0
7
6
5
0
7
6
5
1
2
0
1
5,416
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modular_starcoder2.py
transformers.models.starcoder2.modular_starcoder2.Starcoder2ForCausalLM
from ..mistral.modeling_mistral import MistralAttention, MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward class Starcoder2ForCausalLM(MistralForCausalLM): pass
class Starcoder2ForCausalLM(MistralForCausalLM): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
9
2
0
2
1
1
0
2
1
1
0
3
0
0
5,417
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modular_starcoder2.py
transformers.models.starcoder2.modular_starcoder2.Starcoder2ForSequenceClassification
from ..mistral.modeling_mistral import MistralAttention, MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward class Starcoder2ForSequenceClassification(MistralForSequenceClassificati...
class Starcoder2ForSequenceClassification(MistralForSequenceClassification): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
5,418
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modular_starcoder2.py
transformers.models.starcoder2.modular_starcoder2.Starcoder2ForTokenClassification
from ..mistral.modeling_mistral import MistralAttention, MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralModel, MistralRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward class Starcoder2ForTokenClassification(MistralForTokenClassification): ...
class Starcoder2ForTokenClassification(MistralForTokenClassification): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
5
2
0
2
1
1
0
2
1
1
0
3
0
0
5,419
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modular_starcoder2.py
transformers.models.starcoder2.modular_starcoder2.Starcoder2MLP
from .configuration_starcoder2 import Starcoder2Config from ...activations import ACT2FN from torch import nn from typing import Callable, Optional, Union import torch class Starcoder2MLP(nn.Module): def __init__(self, config: Starcoder2Config): super().__init__() embed_dim = config.hidden_size ...
class Starcoder2MLP(nn.Module): def __init__(self, config: Starcoder2Config): 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
5,420
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/starcoder2/modular_starcoder2.py
transformers.models.starcoder2.modular_starcoder2.Starcoder2Model
from ...processing_utils import Unpack import torch from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutputWithPast from ...utils import TransformersKwargs, logging from ...cache_utils import Cache, DynamicCache from ...masking_utils import create_causal_mask, create_sliding_window_...
class Starcoder2Model(MistralModel): def __init__(self, config: Starcoder2Config): pass @check_model_inputs def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Union[Cach...
4
0
51
9
41
2
11
0.05
1
11
6
0
2
3
2
9
105
18
84
29
67
4
43
15
40
20
3
2
21
5,421
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/configuration_superglue.py
transformers.models.superglue.configuration_superglue.SuperGlueConfig
from ...configuration_utils import PretrainedConfig from ..auto import CONFIG_MAPPING from typing import TYPE_CHECKING, Optional class SuperGlueConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`SuperGlueModel`]. It is used to instantiate a SuperGlue model accor...
class SuperGlueConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`SuperGlueModel`]. It is used to instantiate a SuperGlue model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield ...
4
1
46
5
40
1
8
0.86
1
6
0
0
1
10
1
1
91
13
42
24
29
36
25
13
23
8
1
1
8
5,422
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/image_processing_superglue.py
transformers.models.superglue.image_processing_superglue.SuperGlueImageProcessor
from ...image_transforms import resize, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, ImageType, PILImageResampling, get_image_type, infer_channel_dimension_format, is_pil_image, is_scaled_image, is_torch_available, is_valid_image, is_vision_available, to_numpy_array, valid_images...
@requires(backends=('torch',)) class SuperGlueImageProcessor(BaseImageProcessor): ''' Constructs a SuperGlue image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Controls whether to resize the image's (height, width) dimensions to the specified `size`. Can be overri...
8
6
61
7
33
21
6
0.77
1
11
2
0
4
6
4
24
271
32
135
63
96
104
72
29
67
14
3
2
23
5,423
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.KeypointMatchingOutput
from dataclasses import dataclass from typing import Optional, Union import torch from ...utils import ModelOutput, auto_docstring, logging @dataclass @auto_docstring(custom_intro='\n Base class for outputs of keypoint matching models. Due to the nature of keypoint detection and matching, the number\n of keypoin...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of keypoint matching models. Due to the nature of keypoint detection and matching, the number\n of keypoints is not fixed and can vary from image to image, which makes batching non-trivial. In the batch of\n images, the maximum number of matche...
3
1
0
0
0
0
0
3.13
1
0
0
0
0
0
0
0
35
2
8
8
7
25
8
8
7
0
1
0
0
5,424
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueAttention
from torch import nn from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer from typing import Optional, Union import torch class SuperGlueAttention(nn.Module): def __init__(self, config, position_embedding_type=None): super().__init__() self.self = SUPERGLUE_SELF_ATTENT...
class SuperGlueAttention(nn.Module): def __init__(self, config, position_embedding_type=None): 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, encoder_hid...
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
5,425
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueAttentionalGNN
from transformers.models.superglue.configuration_superglue import SuperGlueConfig from torch import nn from typing import Optional, Union import torch class SuperGlueAttentionalGNN(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: super().__init__() self.hidden_size = config.hidden_...
class SuperGlueAttentionalGNN(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: pass def forward(self, descriptors: torch.Tensor, mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: Optional[bool]=False) -> tuple[torch.Tensor, Optional[tuple], Option...
3
0
26
3
23
0
5
0
1
7
2
0
2
3
2
12
53
6
47
20
38
0
26
14
23
9
1
2
10
5,426
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueAttentionalPropagation
import torch from torch import nn from transformers.models.superglue.configuration_superglue import SuperGlueConfig from typing import Optional, Union class SuperGlueAttentionalPropagation(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: super().__init__() hidden_size = config.hidd...
class SuperGlueAttentionalPropagation(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: pass def forward(self, descriptors: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, encoder_hidden_states: Optional[torch.Tensor]=None, encoder_attention_mask: Optional[torch.Tensor]=None...
3
0
20
2
18
0
3
0
1
7
3
0
2
2
2
12
41
4
37
22
26
0
20
14
17
4
1
2
5
5,427
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueFinalProjection
import torch from transformers.models.superglue.configuration_superglue import SuperGlueConfig from torch import nn class SuperGlueFinalProjection(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: super().__init__() hidden_size = config.hidden_size self.final_proj = nn.Linea...
class SuperGlueFinalProjection(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: pass def forward(self, descriptors: torch.Tensor) -> torch.Tensor: pass
3
0
3
0
3
0
1
0
1
3
1
0
2
1
2
12
8
1
7
5
4
0
7
5
4
1
1
0
2
5,428
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueForKeypointMatching
from typing import Optional, Union from transformers.models.superglue.configuration_superglue import SuperGlueConfig from ...utils import ModelOutput, auto_docstring, logging from ..auto import AutoModelForKeypointDetection import torch @auto_docstring(custom_intro='\n SuperGlue model taking images as inputs and ou...
@auto_docstring(custom_intro='\n SuperGlue model taking images as inputs and outputting the matching of them.\n ') class SuperGlueForKeypointMatching(SuperGluePreTrainedModel): '''SuperGlue feature matching middle-end Given two sets of keypoints and locations, we determine the correspondences by: ...
6
3
80
12
49
20
6
0.48
1
12
6
0
3
5
3
131
262
41
150
63
128
72
91
44
87
9
3
1
17
5,429
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueKeypointEncoder
from torch import nn from transformers.models.superglue.configuration_superglue import SuperGlueConfig import torch from typing import Optional, Union class SuperGlueKeypointEncoder(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: super().__init__() layer_sizes = config.keypoint_en...
class SuperGlueKeypointEncoder(nn.Module): def __init__(self, config: SuperGlueConfig) -> None: pass def forward(self, keypoints: torch.Tensor, scores: torch.Tensor, output_hidden_states: Optional[bool]=False) -> tuple[torch.Tensor, Optional[tuple[torch.Tensor]]]: pass
3
0
14
1
13
1
3
0.04
1
6
2
0
2
1
2
12
29
2
26
16
18
1
18
11
15
4
1
2
5
5,430
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueMultiLayerPerceptron
from transformers.models.superglue.configuration_superglue import SuperGlueConfig from torch import nn import torch class SuperGlueMultiLayerPerceptron(nn.Module): def __init__(self, config: SuperGlueConfig, in_channels: int, out_channels: int) -> None: super().__init__() self.linear = nn.Linear(i...
class SuperGlueMultiLayerPerceptron(nn.Module): def __init__(self, config: SuperGlueConfig, in_channels: int, out_channels: int) -> None: pass def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
1
0
1
4
1
0
2
3
2
12
14
1
13
6
10
0
13
6
10
1
1
0
2
5,431
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGluePreTrainedModel
from torch import nn from transformers.models.superglue.configuration_superglue import SuperGlueConfig from ...utils import ModelOutput, auto_docstring, logging from transformers import PreTrainedModel @auto_docstring class SuperGluePreTrainedModel(PreTrainedModel): config: SuperGlueConfig base_model_prefix = ...
@auto_docstring class SuperGluePreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module) -> None: '''Initialize the weights''' pass
3
1
13
0
10
3
5
0.5
1
1
1
1
1
0
1
128
23
2
14
5
12
7
12
5
10
5
2
2
5
5,432
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueSelfAttention
import torch from torch import nn from typing import Optional, Union import math class SuperGlueSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size'))...
class SuperGlueSelfAttention(nn.Module): def __init__(self, config, position_embedding_type=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None...
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
5,433
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superglue/modeling_superglue.py
transformers.models.superglue.modeling_superglue.SuperGlueSelfOutput
from transformers.models.superglue.configuration_superglue import SuperGlueConfig import torch from torch import nn class SuperGlueSelfOutput(nn.Module): def __init__(self, config: SuperGlueConfig): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) def forward(...
class SuperGlueSelfOutput(nn.Module): def __init__(self, config: SuperGlueConfig): pass def forward(self, hidden_states: torch.Tensor, *args) -> torch.Tensor: pass
3
0
3
0
3
0
1
0
1
3
1
0
2
1
2
12
8
1
7
4
4
0
7
4
4
1
1
0
2
5,434
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/configuration_superpoint.py
transformers.models.superpoint.configuration_superpoint.SuperPointConfig
from ...configuration_utils import PretrainedConfig class SuperPointConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`SuperPointForKeypointDetection`]. It is used to instantiate a SuperPoint model according to the specified arguments, defining the model archite...
class SuperPointConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`SuperPointForKeypointDetection`]. It is used to instantiate a SuperPoint model according to the specified arguments, defining the model architecture. Instantiating a configuration with the de...
2
1
24
1
23
0
1
1.32
1
3
0
0
1
9
1
1
65
7
25
24
11
33
13
12
11
1
1
0
1
5,435
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/image_processing_superpoint.py
transformers.models.superpoint.image_processing_superpoint.SuperPointImageProcessor
import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...utils import TensorType, logging, requires_backends from typing import TYPE_CHECKING, Optional, Union from ...image_utils import ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_form...
class SuperPointImageProcessor(BaseImageProcessor): ''' Constructs a SuperPoint image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Controls whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by `do_resi...
5
4
54
7
28
19
6
0.83
1
9
2
0
4
5
4
24
241
32
114
46
80
95
63
17
58
15
3
2
23
5,436
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/modeling_superpoint.py
transformers.models.superpoint.modeling_superpoint.SuperPointConvBlock
from transformers.models.superpoint.configuration_superpoint import SuperPointConfig from torch import nn import torch class SuperPointConvBlock(nn.Module): def __init__(self, config: SuperPointConfig, in_channels: int, out_channels: int, add_pooling: bool=False) -> None: super().__init__() self.c...
class SuperPointConvBlock(nn.Module): def __init__(self, config: SuperPointConfig, in_channels: int, out_channels: int, add_pooling: bool=False) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
13
0
13
0
2
0
1
5
0
0
2
4
2
12
28
1
27
9
22
0
13
7
10
2
1
1
4
5,437
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/modeling_superpoint.py
transformers.models.superpoint.modeling_superpoint.SuperPointDescriptorDecoder
from transformers.models.superpoint.configuration_superpoint import SuperPointConfig import torch from torch import nn class SuperPointDescriptorDecoder(nn.Module): """ The SuperPointDescriptorDecoder uses the outputs of both the SuperPointEncoder and the SuperPointInterestPointDecoder to compute the descr...
class SuperPointDescriptorDecoder(nn.Module): ''' The SuperPointDescriptorDecoder uses the outputs of both the SuperPointEncoder and the SuperPointInterestPointDecoder to compute the descriptors at the keypoints locations. The descriptors are first computed by a convolutional layer, then normalized to ...
5
3
15
1
12
2
1
0.31
1
4
0
0
2
4
3
13
58
8
39
13
34
12
26
12
22
1
1
0
3
5,438
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/modeling_superpoint.py
transformers.models.superpoint.modeling_superpoint.SuperPointEncoder
from transformers.models.superpoint.configuration_superpoint import SuperPointConfig from torch import nn from typing import Optional, Union from transformers.modeling_outputs import BaseModelOutputWithNoAttention class SuperPointEncoder(nn.Module): """ SuperPoint encoder module. It is made of 4 convolutional ...
class SuperPointEncoder(nn.Module): ''' SuperPoint encoder module. It is made of 4 convolutional layers with ReLU activation and max pooling, reducing the dimensionality of the image. ''' def __init__(self, config: SuperPointConfig) -> None: pass def forward(self, input, output_hidde...
3
1
21
2
19
1
4
0.13
1
7
1
0
2
2
2
12
48
5
38
15
30
5
20
10
17
5
1
2
7
5,439
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/modeling_superpoint.py
transformers.models.superpoint.modeling_superpoint.SuperPointForKeypointDetection
from transformers.models.superpoint.configuration_superpoint import SuperPointConfig import torch from typing import Optional, Union from ...utils import ModelOutput, auto_docstring, logging @auto_docstring(custom_intro='\n SuperPoint model outputting keypoints and descriptors.\n ') class SuperPointForKeypointDe...
@auto_docstring(custom_intro='\n SuperPoint model outputting keypoints and descriptors.\n ') class SuperPointForKeypointDetection(SuperPointPreTrainedModel): ''' SuperPoint model. It consists of a SuperPointEncoder, a SuperPointInterestPointDecoder and a SuperPointDescriptorDecoder. SuperPoint was pro...
5
2
50
11
32
8
4
0.35
1
12
4
0
2
4
2
131
111
23
65
28
55
23
37
21
34
7
3
1
8
5,440
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/modeling_superpoint.py
transformers.models.superpoint.modeling_superpoint.SuperPointInterestPointDecoder
from torch import nn import torch from transformers.models.superpoint.configuration_superpoint import SuperPointConfig class SuperPointInterestPointDecoder(nn.Module): """ The SuperPointInterestPointDecoder uses the output of the SuperPointEncoder to compute the keypoint with scores. The scores are first c...
class SuperPointInterestPointDecoder(nn.Module): ''' The SuperPointInterestPointDecoder uses the output of the SuperPointEncoder to compute the keypoint with scores. The scores are first computed by a convolutional layer, then a softmax is applied to get a probability distribution over the 65 possible ...
5
3
15
2
11
2
1
0.37
1
4
0
0
4
8
4
14
70
11
43
19
38
16
33
19
28
2
1
1
5
5,441
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/modeling_superpoint.py
transformers.models.superpoint.modeling_superpoint.SuperPointKeypointDescriptionOutput
from dataclasses import dataclass from typing import Optional, Union import torch from ...utils import ModelOutput, auto_docstring, logging @dataclass @auto_docstring(custom_intro='\n Base class for outputs of image point description models. Due to the nature of keypoint detection, the number of\n keypoints is n...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of image point description models. Due to the nature of keypoint detection, the number of\n keypoints is not fixed and can vary from image to image, which makes batching non-trivial. In the batch of images,\n the maximum number of keypoints is ...
3
1
0
0
0
0
0
3.29
1
0
0
0
0
0
0
0
32
2
7
7
6
23
7
7
6
0
1
0
0
5,442
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/superpoint/modeling_superpoint.py
transformers.models.superpoint.modeling_superpoint.SuperPointPreTrainedModel
import torch from torch import nn from transformers import PreTrainedModel from typing import Optional, Union from transformers.models.superpoint.configuration_superpoint import SuperPointConfig from ...utils import ModelOutput, auto_docstring, logging @auto_docstring class SuperPointPreTrainedModel(PreTrainedModel): ...
@auto_docstring class SuperPointPreTrainedModel(PreTrainedModel): def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None: '''Initialize the weights''' pass def extract_one_channel_pixel_values(self, pixel_values: torch.FloatTensor) -> torch.FloatTensor: ''' ...
4
2
13
2
5
7
3
1.13
1
0
0
1
2
0
2
129
38
6
15
7
12
17
14
7
11
4
2
2
5
5,443
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/configuration_swiftformer.py
transformers.models.swiftformer.configuration_swiftformer.SwiftFormerConfig
from ...configuration_utils import PretrainedConfig class SwiftFormerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`SwiftFormerModel`]. It is used to instantiate an SwiftFormer model according to the specified arguments, defining the model architecture. Inst...
class SwiftFormerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`SwiftFormerModel`]. It is used to instantiate an SwiftFormer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will...
2
1
37
0
37
0
1
1.28
1
1
0
0
1
16
1
1
100
11
39
38
18
50
20
19
18
1
1
0
1
5,444
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/configuration_swiftformer.py
transformers.models.swiftformer.configuration_swiftformer.SwiftFormerOnnxConfig
from collections import OrderedDict from ...onnx import OnnxConfig from collections.abc import Mapping from packaging import version class SwiftFormerOnnxConfig(OnnxConfig): torch_onnx_minimum_version = version.parse('1.11') @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return Ord...
class SwiftFormerOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def atol_for_validation(self) -> float: pass
5
0
4
0
4
0
1
0
1
4
0
0
2
0
2
2
14
2
12
6
7
0
6
4
3
1
1
0
2
5,445
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerConvEncoder
from .configuration_swiftformer import SwiftFormerConfig from torch import nn import torch class SwiftFormerConvEncoder(nn.Module): """ `SwiftFormerConvEncoder` with 3*3 and 1*1 convolutions. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels...
class SwiftFormerConvEncoder(nn.Module): ''' `SwiftFormerConvEncoder` with 3*3 and 1*1 convolutions. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels, height, width]` ''' def __init__(self, config: SwiftFormerConfig, dim: int): ...
3
1
10
1
10
0
1
0.25
1
3
1
0
2
7
2
12
30
5
20
11
17
5
20
11
17
1
1
0
2
5,446
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerDropPath
from .configuration_swiftformer import SwiftFormerConfig from torch import nn import torch class SwiftFormerDropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).""" def __init__(self, config: SwiftFormerConfig) -> None: super().__init__() ...
class SwiftFormerDropPath(nn.Module): '''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).''' def __init__(self, config: SwiftFormerConfig) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass def extra_repr(self) -...
4
1
2
0
2
0
1
0.13
1
4
1
0
3
1
3
13
12
3
8
5
4
1
8
5
4
1
1
0
3
5,447
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerEfficientAdditiveAttention
from torch import nn from .configuration_swiftformer import SwiftFormerConfig import torch class SwiftFormerEfficientAdditiveAttention(nn.Module): """ Efficient Additive Attention module for SwiftFormer. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_si...
class SwiftFormerEfficientAdditiveAttention(nn.Module): ''' Efficient Additive Attention module for SwiftFormer. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels, height, width]` ''' def __init__(self, config: SwiftFormerConfig, dim:...
3
1
14
4
11
0
1
0.23
1
3
1
0
2
6
2
12
38
11
22
15
19
5
22
15
19
1
1
0
2
5,448
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerEmbeddings
from torch import nn import collections.abc from .configuration_swiftformer import SwiftFormerConfig class SwiftFormerEmbeddings(nn.Module): """ Embeddings layer consisting of a single 2D convolutional and batch normalization layer. Input: tensor of shape `[batch_size, channels, height, width]` Outpu...
class SwiftFormerEmbeddings(nn.Module): ''' Embeddings layer consisting of a single 2D convolutional and batch normalization layer. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels, height/stride, width/stride]` ''' def __init__(self...
3
1
11
2
9
0
3
0.28
1
4
1
0
2
2
2
12
31
8
18
11
15
5
18
11
15
4
1
0
5
5,449
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerEncoder
from typing import Optional, Union import torch from torch import nn from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention from .configuration_swiftformer import SwiftFormerConfig class SwiftFormerEncoder(nn.Module): def __init__(self, config: SwiftFormerConfig) -> N...
class SwiftFormerEncoder(nn.Module): def __init__(self, config: SwiftFormerConfig) -> None: pass def forward(self, hidden_states: torch.Tensor, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> Union[tuple, BaseModelOutputWithNoAttention]: pass
3
0
23
4
19
1
6
0.05
1
9
4
0
2
3
2
12
48
8
38
19
30
2
28
14
25
7
1
2
11
5,450
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerEncoderBlock
from .configuration_swiftformer import SwiftFormerConfig from torch import nn import torch class SwiftFormerEncoderBlock(nn.Module): """ SwiftFormer Encoder Block for SwiftFormer. It consists of (1) Local representation module, (2) SwiftFormerEfficientAdditiveAttention, and (3) MLP block. Input: tenso...
class SwiftFormerEncoderBlock(nn.Module): ''' SwiftFormer Encoder Block for SwiftFormer. It consists of (1) Local representation module, (2) SwiftFormerEfficientAdditiveAttention, and (3) MLP block. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size,...
3
1
15
1
14
0
3
0.21
1
8
5
0
2
7
2
12
41
6
29
14
26
6
24
14
21
3
1
1
5
5,451
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerForImageClassification
from ...utils import auto_docstring, logging import torch from torch import nn from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention from typing import Optional, Union from .configuration_swiftformer import SwiftFormerConfig @auto_docstring class SwiftFormerForImageClassi...
@auto_docstring class SwiftFormerForImageClassification(SwiftFormerPreTrainedModel): def __init__(self, config: SwiftFormerConfig) -> None: pass @auto_docstring def forward(self, pixel_values: Optional[torch.Tensor]=None, labels: Optional[torch.Tensor]=None, output_hidden_states: Optional[bool]=Non...
5
1
40
6
29
6
8
0.17
1
8
3
0
2
5
2
3
88
12
65
24
49
11
39
17
36
13
2
3
16
5,452
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerLocalRepresentation
from torch import nn import torch from .configuration_swiftformer import SwiftFormerConfig class SwiftFormerLocalRepresentation(nn.Module): """ Local Representation module for SwiftFormer that is implemented by 3*3 depth-wise and point-wise convolutions. Input: tensor of shape `[batch_size, channels, heig...
class SwiftFormerLocalRepresentation(nn.Module): ''' Local Representation module for SwiftFormer that is implemented by 3*3 depth-wise and point-wise convolutions. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels, height, width]` ''' ...
3
1
10
1
9
0
1
0.26
1
3
1
0
2
7
2
12
29
5
19
10
16
5
19
10
16
1
1
0
2
5,453
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerMlp
from torch import nn from .configuration_swiftformer import SwiftFormerConfig from ...activations import ACT2CLS class SwiftFormerMlp(nn.Module): """ MLP layer with 1*1 convolutions. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels, height,...
class SwiftFormerMlp(nn.Module): ''' MLP layer with 1*1 convolutions. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels, height, width]` ''' def __init__(self, config: SwiftFormerConfig, in_features: int): pass def forwar...
3
1
9
0
9
0
1
0.28
1
3
1
0
2
5
2
12
27
4
18
10
15
5
18
10
15
1
1
0
2
5,454
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerModel
from .configuration_swiftformer import SwiftFormerConfig from typing import Optional, Union from ...utils import auto_docstring, logging import torch from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention @auto_docstring class SwiftFormerModel(SwiftFormerPreTrainedModel): ...
@auto_docstring class SwiftFormerModel(SwiftFormerPreTrainedModel): def __init__(self, config: SwiftFormerConfig): pass @auto_docstring def forward(self, pixel_values: Optional[torch.Tensor]=None, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> Union[tuple, BaseModel...
5
0
20
4
15
1
3
0.05
1
9
4
0
2
3
2
3
49
8
39
14
23
2
17
8
14
5
2
1
6
5,455
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerPatchEmbedding
from .configuration_swiftformer import SwiftFormerConfig from torch import nn class SwiftFormerPatchEmbedding(nn.Module): """ Patch Embedding Layer constructed of two 2D convolutional layers. Input: tensor of shape `[batch_size, in_channels, height, width]` Output: tensor of shape `[batch_size, out_c...
class SwiftFormerPatchEmbedding(nn.Module): ''' Patch Embedding Layer constructed of two 2D convolutional layers. Input: tensor of shape `[batch_size, in_channels, height, width]` Output: tensor of shape `[batch_size, out_channels, height/4, width/4]` ''' def __init__(self, config: SwiftFormer...
3
1
8
1
7
0
1
0.33
1
2
1
0
2
1
2
12
25
5
15
6
12
5
8
6
5
1
1
0
2
5,456
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerPreTrainedModel
from ...utils import auto_docstring, logging from torch import nn from ...modeling_utils import PreTrainedModel from .configuration_swiftformer import SwiftFormerConfig @auto_docstring class SwiftFormerPreTrainedModel(PreTrainedModel): config: SwiftFormerConfig base_model_prefix = 'swiftformer' main_input_...
@auto_docstring class SwiftFormerPreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module) -> None: '''Initialize the weights''' pass
3
1
9
0
8
1
4
0.36
1
0
0
2
1
0
1
1
21
2
14
7
12
5
13
7
11
4
1
2
4
5,457
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swiftformer/modeling_swiftformer.py
transformers.models.swiftformer.modeling_swiftformer.SwiftFormerStage
from .configuration_swiftformer import SwiftFormerConfig from torch import nn class SwiftFormerStage(nn.Module): """ A Swiftformer stage consisting of a series of `SwiftFormerConvEncoder` blocks and a final `SwiftFormerEncoderBlock`. Input: tensor in shape `[batch_size, channels, height, width]` ...
class SwiftFormerStage(nn.Module): ''' A Swiftformer stage consisting of a series of `SwiftFormerConvEncoder` blocks and a final `SwiftFormerEncoderBlock`. Input: tensor in shape `[batch_size, channels, height, width]` Output: tensor in shape `[batch_size, channels, height, width]` ''' def...
3
1
11
2
9
0
3
0.33
1
6
3
0
2
1
2
12
32
8
18
11
15
6
17
11
14
3
1
2
5
5,458
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/configuration_swin.py
transformers.models.swin.configuration_swin.SwinConfig
from ...configuration_utils import PretrainedConfig from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices class SwinConfig(BackboneConfigMixin, PretrainedConfig): """ This is the configuration class to store the configuration of a [`SwinModel`]. It is used to insta...
class SwinConfig(BackboneConfigMixin, PretrainedConfig): ''' This is the configuration class to store the configuration of a [`SwinModel`]. It is used to instantiate a Swin model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will ...
2
1
50
1
47
2
1
1.25
2
3
0
0
1
22
1
6
130
11
53
47
29
66
26
25
24
1
1
0
1
5,459
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/configuration_swin.py
transformers.models.swin.configuration_swin.SwinOnnxConfig
from collections import OrderedDict from collections.abc import Mapping from ...onnx import OnnxConfig from packaging import version class SwinOnnxConfig(OnnxConfig): torch_onnx_minimum_version = version.parse('1.11') @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return OrderedDic...
class SwinOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def atol_for_validation(self) -> float: pass
5
0
4
0
4
0
1
0
1
4
0
0
2
0
2
2
14
2
12
6
7
0
6
4
3
1
1
0
2
5,460
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinAttention
from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer from typing import Optional, Union from torch import nn import torch class SwinAttention(nn.Module): def __init__(self, config, dim, num_heads, window_size): super().__init__() self.self = SwinSelfAttention...
class SwinAttention(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_attentions...
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
5,461
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinBackbone
from torch import nn from ...utils import ModelOutput, auto_docstring, logging, torch_int import torch from .configuration_swin import SwinConfig from ...modeling_outputs import BackboneOutput from typing import Optional, Union from ...utils.backbone_utils import BackboneMixin @auto_docstring(custom_intro='\n Swin ...
@auto_docstring(custom_intro='\n Swin backbone, to be used with frameworks like DETR and MaskFormer.\n ') class SwinBackbone(SwinPreTrainedModel, BackboneMixin): def __init__(self, config: SwinConfig): pass def get_input_embeddings(self): pass def forward(self, pixel_values: torch.T...
5
1
31
5
19
7
4
0.38
2
10
4
0
3
4
3
16
96
16
58
23
48
22
37
17
33
9
2
2
12
5,462
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinDropPath
from typing import Optional, Union from torch import nn import torch class SwinDropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).""" def __init__(self, drop_prob: Optional[float]=None) -> None: super().__init__() self.drop_prob = dr...
class SwinDropPath(nn.Module): '''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).''' def __init__(self, drop_prob: Optional[float]=None) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass def extra_repr(self) ->...
4
1
2
0
2
0
1
0.13
1
4
0
0
3
1
3
13
12
3
8
5
4
1
8
5
4
1
1
0
3
5,463
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinEmbeddings
import torch from typing import Optional, Union from torch import nn from ...utils import ModelOutput, auto_docstring, logging, torch_int class SwinEmbeddings(nn.Module): """ Construct the patch and position embeddings. Optionally, also the mask token. """ def __init__(self, config, use_mask_token=Fal...
class SwinEmbeddings(nn.Module): ''' Construct the patch and position embeddings. Optionally, also the mask token. ''' def __init__(self, config, use_mask_token=False): pass def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor: ''' ...
4
2
27
6
19
3
3
0.23
1
5
1
0
3
8
3
13
90
20
57
31
48
13
45
26
41
4
1
2
9
5,464
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinEncoder
from typing import Optional, Union import torch from torch import nn class SwinEncoder(nn.Module): def __init__(self, config, grid_size): super().__init__() self.num_layers = len(config.depths) self.config = config dpr = [x.item() for x in torch.linspace(0, config.drop_path_rate, s...
class SwinEncoder(nn.Module): def __init__(self, config, grid_size): pass def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int], head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, output_hidden_states: Optional[bool]=False, output_hidden_s...
3
0
49
5
42
2
7
0.05
1
10
3
0
2
4
2
12
99
11
84
28
71
4
43
18
40
12
1
2
14
5,465
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinEncoderOutput
from dataclasses import dataclass from ...utils import ModelOutput, auto_docstring, logging, torch_int from typing import Optional, Union import torch @dataclass @auto_docstring(custom_intro="\n Swin encoder's outputs, with potential hidden states and attentions.\n ") class SwinEncoderOutput(ModelOutput): ""...
@dataclass @auto_docstring(custom_intro="\n Swin encoder's outputs, with potential hidden states and attentions.\n ") class SwinEncoderOutput(ModelOutput): ''' reshaped_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_...
3
1
0
0
0
0
0
4
1
0
0
0
0
0
0
0
30
5
5
5
4
20
5
5
4
0
1
0
0
5,466
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinForImageClassification
from typing import Optional, Union import torch from torch import nn from ...utils import ModelOutput, auto_docstring, logging, torch_int @auto_docstring(custom_intro="\n Swin Model transformer with an image classification head on top (a linear layer on top of the final hidden state of\n the [CLS] token) e.g. fo...
@auto_docstring(custom_intro="\n Swin Model transformer with an image classification head on top (a linear layer on top of the final hidden state of\n the [CLS] token) e.g. for ImageNet.\n\n <Tip>\n\n Note that it's possible to fine-tune Swin on higher resolution images than the ones it has been trained...
5
1
39
5
30
4
7
0.12
1
5
2
0
2
3
2
3
87
11
68
22
49
8
32
12
29
12
2
3
14
5,467
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinForMaskedImageModeling
from ...utils import ModelOutput, auto_docstring, logging, torch_int from torch import nn import torch import math from typing import Optional, Union @auto_docstring(custom_intro='\n Swin Model with a decoder on top for masked image modeling, as proposed in [SimMIM](https://huggingface.co/papers/2111.09886).\n\n ...
@auto_docstring(custom_intro='\n Swin Model with a decoder on top for masked image modeling, as proposed in [SimMIM](https://huggingface.co/papers/2111.09886).\n\n <Tip>\n\n Note that we provide a script to pre-train this model on custom data in our [examples\n directory](https://github.com/huggingface/tran...
5
1
50
8
30
13
3
0.42
1
5
2
0
2
2
2
3
104
16
62
26
48
26
27
16
24
5
2
1
6
5,468
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinImageClassifierOutput
from typing import Optional, Union from ...utils import ModelOutput, auto_docstring, logging, torch_int import torch from dataclasses import dataclass @dataclass @auto_docstring(custom_intro='\n Swin outputs for image classification.\n ') class SwinImageClassifierOutput(ModelOutput): """ loss (`torch.Flo...
@dataclass @auto_docstring(custom_intro='\n Swin outputs for image classification.\n ') class SwinImageClassifierOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification (or regression if config.num_labels==1) loss. log...
3
1
0
0
0
0
0
3.67
1
0
0
0
0
0
0
0
33
5
6
6
5
22
6
6
5
0
1
0
0
5,469
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinIntermediate
import torch from ...activations import ACT2FN from torch import nn class SwinIntermediate(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): self.intermediate_act_fn = ...
class SwinIntermediate(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
5,470
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinLayer
from typing import Optional, Union from ...utils import ModelOutput, auto_docstring, logging, torch_int import torch from torch import nn class SwinLayer(nn.Module): def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0): super().__init__() self.chunk_size_f...
class SwinLayer(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, hidden...
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
5,471
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinMaskedImageModelingOutput
import warnings import torch from ...utils import ModelOutput, auto_docstring, logging, torch_int from dataclasses import dataclass from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Swin masked image model outputs.\n ') class SwinMaskedImageModelingOutput(ModelOutput): """ lo...
@dataclass @auto_docstring(custom_intro='\n Swin masked image model outputs.\n ') class SwinMaskedImageModelingOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `bool_masked_pos` is provided): Masked image modeling (MLM) loss. reconstruction (`torch....
5
1
7
0
7
0
1
1.57
1
1
0
0
1
0
1
1
42
6
14
8
11
22
9
7
7
1
1
0
1
5,472
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinModel
from ...utils import ModelOutput, auto_docstring, logging, torch_int from torch import nn from typing import Optional, Union import torch @auto_docstring class SwinModel(SwinPreTrainedModel): def __init__(self, config, add_pooling_layer=True, use_mask_token=False): """ add_pooling_layer (`bool`, *...
@auto_docstring class SwinModel(SwinPreTrainedModel): def __init__(self, config, add_pooling_layer=True, use_mask_token=False): ''' add_pooling_layer (`bool`, *optional*, defaults to `True`): Whether or not to apply pooling layer. use_mask_token (`bool`, *optional*, defaults to ...
7
3
22
3
15
4
3
0.2
1
7
3
0
4
7
4
5
98
15
69
28
47
14
35
18
30
7
2
1
12
5,473
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinModelOutput
import torch from typing import Optional, Union from dataclasses import dataclass from ...utils import ModelOutput, auto_docstring, logging, torch_int @dataclass @auto_docstring(custom_intro="\n Swin model's outputs that also contains a pooling of the last hidden states.\n ") class SwinModelOutput(ModelOutput): ...
@dataclass @auto_docstring(custom_intro="\n Swin model's outputs that also contains a pooling of the last hidden states.\n ") class SwinModelOutput(ModelOutput): ''' pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*, returned when `add_pooling_layer=True` is passed): ...
3
1
0
0
0
0
0
3.67
1
0
0
0
0
0
0
0
33
5
6
6
5
22
6
6
5
0
1
0
0
5,474
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinOutput
import torch from torch import nn class SwinOutput(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, hidden_states: torch.Tensor) -> torch.Ten...
class SwinOutput(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
5,475
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinPatchEmbeddings
import collections.abc from torch import nn from typing import Optional, Union import torch class SwinPatchEmbeddings(nn.Module): """ This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial `hidden_states` (patch embeddings) of shape `(batch_size, seq_length, h...
class SwinPatchEmbeddings(nn.Module): ''' This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial `hidden_states` (patch embeddings) of shape `(batch_size, seq_length, hidden_size)` to be consumed by a Transformer. ''' def __init__(self, config): ...
4
1
11
1
10
0
2
0.2
1
4
0
0
3
6
3
13
41
5
30
17
26
6
30
17
26
3
1
1
7
5,476
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinPatchMerging
from torch import nn import torch class SwinPatchMerging(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.Laye...
class SwinPatchMerging(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`): Normalization ...
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
5,477
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinPreTrainedModel
from ...utils import ModelOutput, auto_docstring, logging, torch_int from .configuration_swin import SwinConfig from torch import nn from ...modeling_utils import PreTrainedModel @auto_docstring class SwinPreTrainedModel(PreTrainedModel): config: SwinConfig base_model_prefix = 'swin' main_input_name = 'pix...
@auto_docstring class SwinPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
11
0
8
3
4
0.5
1
0
0
4
1
0
1
1
23
2
14
7
12
7
13
7
11
4
1
2
4
5,478
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinSelfAttention
import collections.abc import math from torch import nn from typing import Optional, Union import torch from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer class SwinSelfAttention(nn.Module): def __init__(self, config, dim, num_heads, window_size): super().__init__(...
class SwinSelfAttention(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.Tenso...
3
0
32
6
24
2
3
0.1
1
6
0
0
3
9
3
13
98
19
72
38
62
7
56
32
52
4
1
1
8
5,479
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinSelfOutput
import torch from torch import nn class SwinSelfOutput(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: torch.Tensor, input_tensor: torch.Ten...
class SwinSelfOutput(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
5,480
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin/modeling_swin.py
transformers.models.swin.modeling_swin.SwinStage
from torch import nn from ...modeling_layers import GradientCheckpointingLayer import torch from typing import Optional, Union class SwinStage(GradientCheckpointingLayer): def __init__(self, config, dim, input_resolution, depth, num_heads, drop_path, downsample): super().__init__() self.config = c...
class SwinStage(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[bool...
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
5,481
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/configuration_swin2sr.py
transformers.models.swin2sr.configuration_swin2sr.Swin2SRConfig
from ...configuration_utils import PretrainedConfig class Swin2SRConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`Swin2SRModel`]. It is used to instantiate a Swin Transformer v2 model according to the specified arguments, defining the model architecture. Insta...
class Swin2SRConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`Swin2SRModel`]. It is used to instantiate a Swin Transformer v2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will ...
2
1
49
1
48
0
2
1.13
1
1
0
0
1
22
1
1
128
11
55
50
29
62
27
26
25
2
1
0
2
5,482
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/image_processing_swin2sr.py
transformers.models.swin2sr.image_processing_swin2sr.Swin2SRImageProcessor
from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...utils import TensorType, filter_out_non_signature_kwargs, logging import numpy as np from typing import Optional, Union from ...image_transforms import get_image_size, pad, to_channel_dimension_format from ...utils.deprecation import depreca...
class Swin2SRImageProcessor(BaseImageProcessor): ''' Constructs a Swin2SR image processor. Args: do_rescale (`bool`, *optional*, defaults to `True`): Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the `do_rescale` parameter in the ...
10
3
49
5
26
19
4
0.84
1
8
2
0
3
4
3
23
165
19
80
37
52
67
34
13
30
10
3
1
12
5,483
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.NearestConvUpsampler
import torch from torch import nn class NearestConvUpsampler(nn.Module): def __init__(self, config, num_features): super().__init__() if config.upscale != 4: raise ValueError('The nearest+conv upsampler only supports an upscale factor of 4 at the moment.') self.conv_before_upsa...
class NearestConvUpsampler(nn.Module): def __init__(self, config, num_features): pass def forward(self, sequence_output): pass
3
0
12
1
11
0
2
0
1
2
0
0
2
7
2
12
25
2
23
11
20
0
19
11
16
2
1
1
3
5,484
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.PixelShuffleAuxUpsampler
from torch import nn class PixelShuffleAuxUpsampler(nn.Module): def __init__(self, config, num_features): super().__init__() self.upscale = config.upscale self.conv_bicubic = nn.Conv2d(config.num_channels, num_features, 3, 1, 1) self.conv_before_upsample = nn.Conv2d(config.embed_di...
class PixelShuffleAuxUpsampler(nn.Module): def __init__(self, config, num_features): pass def forward(self, sequence_output, bicubic, height, width): pass
3
0
12
1
11
0
1
0
1
2
1
0
2
8
2
12
26
3
23
13
20
0
20
13
17
1
1
0
2
5,485
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.PixelShuffleUpsampler
from torch import nn class PixelShuffleUpsampler(nn.Module): def __init__(self, config, num_features): super().__init__() self.conv_before_upsample = nn.Conv2d(config.embed_dim, num_features, 3, 1, 1) self.activation = nn.LeakyReLU(inplace=True) self.upsample = Upsample(config.upsc...
class PixelShuffleUpsampler(nn.Module): def __init__(self, config, num_features): pass def forward(self, sequence_output): pass
3
0
7
1
6
0
1
0
1
2
1
0
2
4
2
12
15
2
13
8
10
0
13
8
10
1
1
0
2
5,486
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRAttention
from typing import Optional, Union from torch import nn import torch import collections.abc from ...pytorch_utils import find_pruneable_heads_and_indices, meshgrid, prune_linear_layer class Swin2SRAttention(nn.Module): def __init__(self, config, dim, num_heads, window_size, pretrained_window_size=0): supe...
class Swin2SRAttention(nn.Module): def __init__(self, config, dim, num_heads, window_size, pretrained_window_size=0): pass def prune_heads(self, heads): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTe...
4
0
14
1
12
1
2
0.08
1
7
2
0
3
3
3
13
44
4
38
17
28
3
22
11
18
2
1
1
5
5,487
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRDropPath
import torch from typing import Optional, Union from torch import nn class Swin2SRDropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).""" def __init__(self, drop_prob: Optional[float]=None) -> None: super().__init__() self.drop_prob =...
class Swin2SRDropPath(nn.Module): '''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).''' def __init__(self, drop_prob: Optional[float]=None) -> None: pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass def extra_repr(self)...
4
1
2
0
2
0
1
0.13
1
4
0
0
3
1
3
13
12
3
8
5
4
1
8
5
4
1
1
0
3
5,488
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SREmbeddings
from torch import nn from typing import Optional, Union import torch class Swin2SREmbeddings(nn.Module): """ Construct the patch and optional position embeddings. """ def __init__(self, config): super().__init__() self.patch_embeddings = Swin2SRPatchEmbeddings(config) num_patch...
class Swin2SREmbeddings(nn.Module): ''' Construct the patch and optional position embeddings. ''' def __init__(self, config): pass def forward(self, pixel_values: Optional[torch.FloatTensor]) -> tuple[torch.Tensor]: pass
3
1
11
3
8
0
2
0.18
1
3
1
0
2
4
2
12
28
8
17
9
14
3
16
9
13
2
1
1
4
5,489
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SREncoder
from typing import Optional, Union import torch from torch import nn class Swin2SREncoder(nn.Module): def __init__(self, config, grid_size): super().__init__() self.num_stages = len(config.depths) self.config = config dpr = [x.item() for x in torch.linspace(0, config.drop_path_rate...
class Swin2SREncoder(nn.Module): def __init__(self, config, grid_size): pass def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple[int, int], head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, output_hidden_states: Optional[bool]=False, return_dict:...
3
0
34
5
29
0
6
0
1
9
2
0
2
4
2
12
69
11
58
23
47
0
30
15
27
10
1
2
11
5,490
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SREncoderOutput
from dataclasses import dataclass from typing import Optional, Union from ...utils import ModelOutput, auto_docstring, logging import torch @dataclass @auto_docstring(custom_intro="\n Swin2SR encoder's outputs, with potential hidden states and attentions.\n ") class Swin2SREncoderOutput(ModelOutput): last_hi...
@dataclass @auto_docstring(custom_intro="\n Swin2SR encoder's outputs, with potential hidden states and attentions.\n ") class Swin2SREncoderOutput(ModelOutput): pass
3
0
0
0
0
0
0
3.75
1
0
0
0
0
0
0
0
23
4
4
4
3
15
4
4
3
0
1
0
0
5,491
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRForImageSuperResolution
from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutput, ImageSuperResolutionOutput from typing import Optional, Union import torch from torch import nn @auto_docstring(custom_intro='\n Swin2SR Model transformer with an upsampler head on top for image super resoluti...
@auto_docstring(custom_intro='\n Swin2SR Model transformer with an upsampler head on top for image super resolution and restoration.\n ') class Swin2SRForImageSuperResolution(Swin2SRPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, pixel_values: Optional[tor...
5
1
55
9
32
14
7
0.42
1
9
6
0
2
5
2
3
114
19
67
26
54
28
35
17
32
8
2
1
13
5,492
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRIntermediate
import torch from ...activations import ACT2FN from torch import nn class Swin2SRIntermediate(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): self.intermediate_act_fn...
class Swin2SRIntermediate(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
5,493
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRLayer
from torch import nn from typing import Optional, Union import torch import collections.abc class Swin2SRLayer(nn.Module): def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0, pretrained_window_size=0): super().__init__() self.input_resolution = input_reso...
class Swin2SRLayer(nn.Module): def __init__(self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0, pretrained_window_size=0): pass def _compute_window_shift(self, target_window_size, target_shift_size) -> tuple[tuple[int, int], tuple[int, int]]: pass def get_at...
6
0
24
2
20
1
3
0.05
1
12
4
0
5
9
5
15
123
15
103
52
89
5
72
44
66
6
1
3
17
5,494
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRModel
from torch import nn from ...utils import ModelOutput, auto_docstring, logging from ...modeling_outputs import BaseModelOutput, ImageSuperResolutionOutput from typing import Optional, Union import torch @auto_docstring class Swin2SRModel(Swin2SRPreTrainedModel): def __init__(self, config): super().__init_...
@auto_docstring class Swin2SRModel(Swin2SRPreTrainedModel): def __init__(self, config): pass def get_input_embeddings(self): pass def _prune_heads(self, heads_to_prune): ''' Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer...
8
1
20
3
14
3
2
0.17
1
7
4
0
5
9
5
6
111
21
77
35
56
13
48
27
42
5
2
1
11
5,495
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SROutput
import torch from torch import nn class Swin2SROutput(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, hidden_states: torch.Tensor) -> torch....
class Swin2SROutput(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
5,496
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRPatchEmbeddings
import collections.abc from typing import Optional, Union import torch from torch import nn class Swin2SRPatchEmbeddings(nn.Module): def __init__(self, config, normalize_patches=True): super().__init__() num_channels = config.embed_dim image_size, patch_size = (config.image_size, config.pa...
class Swin2SRPatchEmbeddings(nn.Module): def __init__(self, config, normalize_patches=True): pass def forward(self, embeddings: Optional[torch.FloatTensor]) -> tuple[torch.Tensor, tuple[int]]: pass
3
0
12
2
10
0
3
0
1
4
0
0
2
4
2
12
25
5
20
12
17
0
20
12
17
4
1
1
6
5,497
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRPatchMerging
import torch from torch import nn class Swin2SRPatchMerging(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.L...
class Swin2SRPatchMerging(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`): Normalizati...
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
5,498
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRPatchUnEmbeddings
from torch import nn class Swin2SRPatchUnEmbeddings(nn.Module): """Image to Patch Unembedding""" def __init__(self, config): super().__init__() self.embed_dim = config.embed_dim def forward(self, embeddings, x_size): batch_size, height_width, num_channels = embeddings.shape ...
class Swin2SRPatchUnEmbeddings(nn.Module): '''Image to Patch Unembedding''' def __init__(self, config): pass def forward(self, embeddings, x_size): pass
3
1
4
1
4
1
1
0.25
1
1
0
0
2
1
2
12
12
3
8
5
5
2
8
5
5
1
1
0
2
5,499
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/swin2sr/modeling_swin2sr.py
transformers.models.swin2sr.modeling_swin2sr.Swin2SRPreTrainedModel
from torch import nn import torch from ...modeling_utils import PreTrainedModel from ...utils import ModelOutput, auto_docstring, logging from .configuration_swin2sr import Swin2SRConfig @auto_docstring class Swin2SRPreTrainedModel(PreTrainedModel): config: Swin2SRConfig base_model_prefix = 'swin2sr' main_...
@auto_docstring class Swin2SRPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
9
0
8
1
4
0.38
1
0
0
2
1
0
1
1
20
2
13
6
11
5
12
6
10
4
1
2
4