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,100
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamPreTrainedModel
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel from .configuration_sam import SamConfig, SamMaskDecoderConfig, SamPromptEncoderConfig, SamVisionConfig from ...utils import ModelOutput, auto_docstring, logging from torch import Tensor, nn @auto_docstring class SamPreTrainedModel(PreTrainedModel)...
@auto_docstring class SamPreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module): pass
3
0
10
0
10
0
5
0
1
0
0
1
1
0
1
1
18
1
17
9
15
0
16
9
14
5
1
2
5
5,101
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamPromptEncoder
from torch import Tensor, nn import torch from typing import Callable, Optional, Union from .configuration_sam import SamConfig, SamMaskDecoderConfig, SamPromptEncoderConfig, SamVisionConfig import torch.nn.functional as F class SamPromptEncoder(nn.Module): def __init__(self, config: SamConfig): super()._...
class SamPromptEncoder(nn.Module): def __init__(self, config: SamConfig): pass def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pad: bool) -> torch.Tensor: '''Embeds point prompts.''' pass def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: '''...
5
3
27
3
20
4
3
0.21
1
7
2
0
4
8
4
14
110
13
82
37
71
17
58
30
53
7
1
2
11
5,102
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamTwoWayAttentionBlock
from transformers.utils.generic import OutputRecorder, TransformersKwargs, check_model_inputs from ...processing_utils import Unpack from torch import Tensor, nn class SamTwoWayAttentionBlock(nn.Module): def __init__(self, config, attention_downsample_rate: int=2, skip_first_layer_pe: bool=False): """ ...
class SamTwoWayAttentionBlock(nn.Module): def __init__(self, config, attention_downsample_rate: int=2, skip_first_layer_pe: bool=False): ''' A transformer block with four layers: (1) self-attention of sparse inputs (2) cross attention of sparse inputs -> dense inputs (3) mlp block on ...
3
1
43
8
27
8
2
0.29
1
5
1
0
2
11
2
12
88
17
55
27
44
16
39
19
36
3
1
1
4
5,103
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamTwoWayTransformer
from ...processing_utils import Unpack from torch import Tensor, nn from typing import Callable, Optional, Union from ...modeling_outputs import BaseModelOutput from .configuration_sam import SamConfig, SamMaskDecoderConfig, SamPromptEncoderConfig, SamVisionConfig from transformers.utils.generic import OutputRecorder, ...
class SamTwoWayTransformer(nn.Module): def __init__(self, config: SamMaskDecoderConfig): pass def forward(self, point_embeddings: Tensor, image_embeddings: Tensor, image_positional_embeddings: Tensor, attention_similarity: Tensor, target_embedding=None, **kwargs: Unpack[TransformersKwargs]) -> Union[...
3
0
34
7
26
2
5
0.06
1
8
3
0
2
5
2
12
69
14
52
27
39
3
33
17
30
8
1
2
10
5,104
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamVisionAttention
import torch.nn.functional as F from torch import Tensor, nn import torch class SamVisionAttention(nn.Module): """Multi-head Attention block with relative position embeddings.""" def __init__(self, config, window_size): super().__init__() input_size = (config.image_size // config.patch_size, c...
class SamVisionAttention(nn.Module): '''Multi-head Attention block with relative position embeddings.''' def __init__(self, config, window_size): pass def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor) -> torch.Tensor: ''' Get relative positional embeddings acc...
5
3
33
5
19
10
2
0.51
1
4
0
1
4
8
4
14
138
23
76
43
63
39
53
35
48
4
1
2
9
5,105
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamVisionEncoder
from ...processing_utils import Unpack from typing import Callable, Optional, Union import torch import torch.nn.functional as F from torch import Tensor, nn from transformers.utils.generic import OutputRecorder, TransformersKwargs, check_model_inputs from .configuration_sam import SamConfig, SamMaskDecoderConfig, SamP...
class SamVisionEncoder(SamPreTrainedModel): def __init__(self, config: SamVisionConfig): pass def get_input_embeddings(self): pass @check_model_inputs def forward(self, pixel_values: Optional[torch.FloatTensor]=None, **kwargs: Unpack[TransformersKwargs]) -> SamVisionEncoderOutput: ...
5
0
30
5
24
0
7
0.01
1
10
5
0
3
7
3
13
93
18
74
25
64
1
48
19
44
16
1
2
21
5,106
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamVisionLayer
import torch.nn.functional as F from torch import Tensor, nn from ...modeling_layers import GradientCheckpointingLayer import torch class SamVisionLayer(GradientCheckpointingLayer): def __init__(self, config, window_size): super().__init__() self.layer_norm1 = nn.LayerNorm(config.hidden_size, eps=...
class SamVisionLayer(GradientCheckpointingLayer): def __init__(self, config, window_size): pass def window_partition(self, hidden_states: torch.Tensor, window_size: int) -> tuple[torch.Tensor, tuple[int, int]]: ''' Args: Partition into non-overlapping windows with padding if n...
5
2
22
3
14
6
2
0.43
1
5
1
0
4
5
4
14
93
13
56
31
45
24
41
25
36
4
1
1
7
5,107
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamVisionNeck
from torch import Tensor, nn from .configuration_sam import SamConfig, SamMaskDecoderConfig, SamPromptEncoderConfig, SamVisionConfig class SamVisionNeck(nn.Module): def __init__(self, config: SamVisionConfig): super().__init__() self.config = config self.conv1 = nn.Conv2d(config.hidden_siz...
class SamVisionNeck(nn.Module): def __init__(self, config: SamVisionConfig): pass def forward(self, hidden_states): pass
3
0
8
1
7
0
1
0
1
3
2
0
2
5
2
12
18
3
15
8
12
0
15
8
12
1
1
0
2
5,108
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/modeling_sam.py
transformers.models.sam.modeling_sam.SamVisionSdpaAttention
import torch import torch.nn.functional as F class SamVisionSdpaAttention(SamVisionAttention): """ Multi-head Attention block with relative position embeddings. Using SDPA instead of the default attention. """ def __init__(self, config, window_size): super().__init__(config, window_size) ...
class SamVisionSdpaAttention(SamVisionAttention): ''' Multi-head Attention block with relative position embeddings. Using SDPA instead of the default attention. ''' def __init__(self, config, window_size): pass def forward(self, hidden_states: torch.Tensor, output_attentions=False...
3
1
30
3
21
6
2
0.34
1
3
0
0
3
0
3
17
99
13
64
27
53
22
43
20
39
5
2
2
7
5,109
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/processing_sam.py
transformers.models.sam.processing_sam.SamImagesKwargs
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin from typing import Optional, Union from ...image_utils import ImageInput class SamImagesKwargs(ImagesKwargs): segmentation_maps: Optional[ImageInput] input_points: Optional[list[list[float]]] input_labels: Optional[list[list[int...
class SamImagesKwargs(ImagesKwargs): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
6
0
6
1
5
0
6
1
5
0
2
0
0
5,110
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/processing_sam.py
transformers.models.sam.processing_sam.SamProcessor
import numpy as np from typing import Optional, Union from ...tokenization_utils_base import AudioInput, BatchEncoding, PreTokenizedInput, TextInput from ...video_utils import VideoInput from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin from copy import deepcopy from ...image_utils import I...
class SamProcessor(ProcessorMixin): ''' Constructs a SAM processor which wraps a SAM image processor and an 2D points & Bounding boxes processor into a single processor. [`SamProcessor`] offers all the functionalities of [`SamImageProcessor`]. See the docstring of [`~SamImageProcessor.__call__`] fo...
10
5
28
3
22
4
6
0.23
1
10
2
0
8
1
8
25
254
32
183
50
149
42
106
25
97
23
2
3
44
5,111
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/sam/processing_sam.py
transformers.models.sam.processing_sam.SamProcessorKwargs
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin class SamProcessorKwargs(ProcessingKwargs, total=False): images_kwargs: SamImagesKwargs _defaults = {'images_kwargs': {'point_pad_value': -10}}
class SamProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
7
0
7
2
6
0
3
2
2
0
3
0
0
5,112
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/configuration_seamless_m4t.py
transformers.models.seamless_m4t.configuration_seamless_m4t.SeamlessM4TConfig
from ...configuration_utils import PretrainedConfig class SeamlessM4TConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`~SeamlessM4TModel`]. It is used to instantiate an SeamlessM4T model according to the specified arguments, defining the model architecture. Ins...
class SeamlessM4TConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`~SeamlessM4TModel`]. It is used to instantiate an SeamlessM4T model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults wil...
2
1
174
6
154
14
1
1.34
1
1
0
0
1
69
1
1
390
25
156
147
79
209
73
72
71
1
1
0
1
5,113
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/feature_extraction_seamless_m4t.py
transformers.models.seamless_m4t.feature_extraction_seamless_m4t.SeamlessM4TFeatureExtractor
from typing import Optional, Union from ...feature_extraction_utils import BatchFeature from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...utils import PaddingStrategy, TensorType, logging from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...utils import is_tor...
class SeamlessM4TFeatureExtractor(SequenceFeatureExtractor): ''' Constructs a SeamlessM4T feature extractor. This feature extractor inherits from [`SequenceFeatureExtractor`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. ...
6
4
60
8
35
17
5
0.6
1
11
1
0
3
5
4
21
269
41
143
53
112
86
65
27
60
14
3
3
21
5,114
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TAttention
from torch import Tensor, nn import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union from .configuration_seamless_m4t import SeamlessM4TConfig from ...utils.deprecation import deprecate_kwarg class SeamlessM4TAttention(nn.Module): """Multi-headed attentio...
class SeamlessM4TAttention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[SeamlessM4TConfig]=None, layer_idx: Optional[int]=N...
4
2
47
6
32
8
4
0.28
1
7
1
0
3
12
3
13
147
22
98
43
78
27
63
27
59
10
1
2
13
5,115
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TCodeHifiGan
from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...modeling_utils import PreTrainedModel from typing import Optional, Union from .configuration_seamless_m4t import SeamlessM4TConfig @auto_docstring(custom_intro='\n Code HiFi-GAN vocoder as described in this [...
@auto_docstring(custom_intro='\n Code HiFi-GAN vocoder as described in this [repository](https://github.com/facebookresearch/speech-resynthesis).\n ') class SeamlessM4TCodeHifiGan(PreTrainedModel): def __init__(self, config): pass def _get_dur_output_lengths(self, input_ids, dur_out): ''...
11
4
17
3
11
3
3
0.29
1
8
2
0
7
6
7
7
155
30
97
36
85
28
79
34
69
6
1
3
25
5,116
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerAdapter
from torch import Tensor, nn class SeamlessM4TConformerAdapter(nn.Module): def __init__(self, config): super().__init__() self.layers = nn.ModuleList((SeamlessM4TConformerAdapterLayer(config) for _ in range(config.num_adapter_layers))) def forward(self, hidden_states, attention_mask): ...
class SeamlessM4TConformerAdapter(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, attention_mask): pass
3
0
6
2
4
1
2
0.13
1
3
1
0
2
1
2
12
13
4
8
5
5
1
8
5
5
2
1
1
3
5,117
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerAdapterLayer
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask import torch from typing import Optional, Union from torch import Tensor, nn class SeamlessM4TConformerAdapterLayer(nn.Module): def __init__(self, config): super().__init__() embed_dim = config.hi...
class SeamlessM4TConformerAdapterLayer(nn.Module): def __init__(self, config): pass def _compute_sub_sample_lengths_from_attention_mask(self, attention_mask): pass def forward(self, hidden_states, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False): pass
4
0
31
4
23
4
1
0.17
1
5
2
0
3
11
3
13
96
15
69
27
60
12
43
22
39
2
1
1
4
5,118
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerConvolutionModule
from torch import Tensor, nn from ...activations import ACT2FN class SeamlessM4TConformerConvolutionModule(nn.Module): """Convolution block used in the conformer block""" def __init__(self, config): super().__init__() if (config.conv_depthwise_kernel_size - 1) % 2 == 1: raise Value...
class SeamlessM4TConformerConvolutionModule(nn.Module): '''Convolution block used in the conformer block''' def __init__(self, config): pass def forward(self, hidden_states, attention_mask=None): pass
3
1
30
3
24
4
2
0.16
1
2
0
0
2
8
2
12
64
7
49
11
46
8
27
11
24
2
1
1
4
5,119
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerEncoder
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn import torch from ...integrations.fsdp import is_fsdp_managed_module from ...integrations.deepspeed import is_deepspeed_zero3_enabled cla...
class SeamlessM4TConformerEncoder(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, attention_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True): pass
3
0
49
8
40
2
9
0.05
1
8
4
0
2
6
2
12
100
16
80
26
70
4
46
18
43
14
1
3
17
5,120
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerEncoderLayer
from ...modeling_layers import GradientCheckpointingLayer import torch from typing import Optional, Union from torch import Tensor, nn class SeamlessM4TConformerEncoderLayer(GradientCheckpointingLayer): """Conformer block based on https://huggingface.co/papers/2005.08100.""" def __init__(self, config): ...
class SeamlessM4TConformerEncoderLayer(GradientCheckpointingLayer): '''Conformer block based on https://huggingface.co/papers/2005.08100.''' def __init__(self, config): pass def forward(self, hidden_states, attention_mask: Optional[torch.Tensor]=None, relative_position_embeddings: Optional[torch....
3
1
31
5
23
4
1
0.22
1
6
3
0
2
9
2
12
67
11
46
23
36
10
34
16
31
1
1
0
2
5,121
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerFeatureProjection
from torch import Tensor, nn class SeamlessM4TConformerFeatureProjection(nn.Module): def __init__(self, config): super().__init__() self.layer_norm = nn.LayerNorm(config.feature_projection_input_dim, eps=config.layer_norm_eps) self.projection = nn.Linear(config.feature_projection_input_dim...
class SeamlessM4TConformerFeatureProjection(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
6
0
5
1
1
0.09
1
1
0
0
2
3
2
12
13
1
11
7
8
1
11
7
8
1
1
0
2
5,122
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerFeedForward
from torch import Tensor, nn from ...activations import ACT2FN class SeamlessM4TConformerFeedForward(nn.Module): def __init__(self, config, act_fn=None, dropout=None): super().__init__() dropout = dropout if dropout is not None else config.speech_encoder_dropout act_fn = act_fn if act_fn i...
class SeamlessM4TConformerFeedForward(nn.Module): def __init__(self, config, act_fn=None, dropout=None): pass def forward(self, hidden_states): pass
3
0
10
2
8
0
3
0
1
2
0
0
2
5
2
12
21
4
17
8
14
0
17
8
14
4
1
0
5
5,123
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerPositionalConvEmbedding
from ...integrations.deepspeed import is_deepspeed_zero3_enabled from torch import Tensor, nn from ...activations import ACT2FN class SeamlessM4TConformerPositionalConvEmbedding(nn.Module): def __init__(self, config): super().__init__() self.conv = nn.Conv1d(config.hidden_size, config.hidden_size,...
class SeamlessM4TConformerPositionalConvEmbedding(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
21
3
18
0
3
0
1
2
1
0
2
3
2
12
43
7
36
10
32
0
28
10
24
4
1
2
5
5,124
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerRelPositionalEmbedding
import math import torch from torch import Tensor, nn class SeamlessM4TConformerRelPositionalEmbedding(nn.Module): """Relative positional encoding module.""" def __init__(self, config): super().__init__() self.max_len = config.max_source_positions self.d_model = config.hidden_size ...
class SeamlessM4TConformerRelPositionalEmbedding(nn.Module): '''Relative positional encoding module.''' def __init__(self, config): pass def extend_pe(self, x): pass def forward(self, hidden_states: torch.Tensor): pass
4
1
14
1
11
3
2
0.3
1
2
0
0
3
3
3
13
48
5
33
15
29
10
31
15
27
4
1
3
6
5,125
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerRotaryPositionalEmbedding
import torch from torch import Tensor, nn class SeamlessM4TConformerRotaryPositionalEmbedding(nn.Module): """Rotary positional embedding Reference : https://blog.eleuther.ai/rotary-embeddings/ Paper: https://huggingface.co/papers/2104.09864 """ def __init__(self, config): super().__init__() ...
class SeamlessM4TConformerRotaryPositionalEmbedding(nn.Module): '''Rotary positional embedding Reference : https://blog.eleuther.ai/rotary-embeddings/ Paper: https://huggingface.co/papers/2104.09864 ''' def __init__(self, config): pass def forward(self, hidden_states): pass
3
1
13
2
10
1
2
0.24
1
1
0
0
2
2
2
12
32
6
21
14
18
5
21
14
18
2
1
1
3
5,126
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerSamePadLayer
from torch import Tensor, nn class SeamlessM4TConformerSamePadLayer(nn.Module): def __init__(self, num_conv_pos_embeddings): super().__init__() self.num_pad_remove = 1 if num_conv_pos_embeddings % 2 == 0 else 0 def forward(self, hidden_states): if self.num_pad_remove > 0: ...
class SeamlessM4TConformerSamePadLayer(nn.Module): def __init__(self, num_conv_pos_embeddings): pass def forward(self, hidden_states): pass
3
0
4
0
4
0
2
0
1
1
0
0
2
1
2
12
9
1
8
4
5
0
8
4
5
2
1
1
4
5,127
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TConformerSelfAttention
import math import torch from typing import Optional, Union from torch import Tensor, nn class SeamlessM4TConformerSelfAttention(nn.Module): """Construct a SeamlessM4TConformerSelfAttention object. Can be enhanced with rotary or relative position embeddings. """ def __init__(self, config, use_position...
class SeamlessM4TConformerSelfAttention(nn.Module): '''Construct a SeamlessM4TConformerSelfAttention object. Can be enhanced with rotary or relative position embeddings. ''' def __init__(self, config, use_position_embeddings=True): pass def forward(self, hidden_states: torch.Tensor, atten...
5
1
35
6
22
7
3
0.36
1
4
0
0
4
11
4
14
149
28
89
45
78
32
73
39
68
6
1
2
11
5,128
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TDecoder
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask from typing import Optional, Union from .configuration_seamless_m4t import SeamlessM4TConfig import math from ...modeling_outputs import BaseModelOutp...
@auto_docstring(custom_intro='\n Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`SeamlessM4TDecoderLayer`].\n ') class SeamlessM4TDecoder(SeamlessM4TPreTrainedModel): def __init__(self, config: SeamlessM4TConfig, embed_tokens: Optional[nn.Embedding]=None): ''' ...
5
1
59
8
37
14
9
0.36
1
12
5
0
4
10
4
7
238
34
150
47
129
54
80
31
75
29
2
3
35
5,129
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TDecoderLayer
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union from ...activations import ACT2FN from .configuration_seamless_m4t import SeamlessM4TConfig from ...utils.deprecation import deprecate_kwarg from torch import Tensor, nn from ...modeling_layers import GradientCheckpoi...
class SeamlessM4TDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4TConfig, decoder_ffn_dim=None, decoder_attention_heads=None, layer_idx=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: torch.T...
4
1
56
8
35
13
4
0.35
1
6
3
0
2
11
2
12
113
17
71
30
59
25
42
21
39
5
1
1
8
5,130
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TEncoder
import math from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...modeling_attn_mask_utils import _prepare_4d_att...
@auto_docstring(custom_intro='\n Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`SeamlessM4TEncoderLayer`].\n ') class SeamlessM4TEncoder(SeamlessM4TPreTrainedModel): def __init__(self, config: SeamlessM4TConfig, embed_tokens: Optional[nn.Embedding]=None, is...
4
2
87
15
57
16
14
0.28
1
12
5
0
2
10
2
5
176
30
115
40
98
32
68
26
65
22
2
3
27
5,131
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TEncoderLayer
from ...modeling_layers import GradientCheckpointingLayer import torch from torch import Tensor, nn from .configuration_seamless_m4t import SeamlessM4TConfig class SeamlessM4TEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4TConfig, encoder_ffn_dim=None, encoder_attention_heads=None)...
class SeamlessM4TEncoderLayer(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4TConfig, encoder_ffn_dim=None, encoder_attention_heads=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor: ''' ...
3
1
30
5
21
4
3
0.19
1
6
3
0
2
7
2
12
61
11
42
18
34
8
27
13
24
3
1
1
5
5,132
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TFeedForwardNetwork
from .configuration_seamless_m4t import SeamlessM4TConfig import torch from torch import Tensor, nn from ...activations import ACT2FN class SeamlessM4TFeedForwardNetwork(nn.Module): def __init__(self, config: SeamlessM4TConfig, ffn_dim: int): super().__init__() self.fc1 = nn.Linear(config.hidden_s...
class SeamlessM4TFeedForwardNetwork(nn.Module): def __init__(self, config: SeamlessM4TConfig, ffn_dim: int): pass def forward(self, hidden_states): pass
3
0
9
0
9
0
2
0
1
4
1
0
2
4
2
12
20
1
19
7
16
0
15
7
12
2
1
1
3
5,133
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TForSpeechToSpeech
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
12
2
28
4
19
5
3
0.26
1
14
7
0
10
6
11
14
333
55
220
80
182
58
117
54
105
16
2
3
36
5,134
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TForSpeechToText
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union from .configuration_seamless_m4t import SeamlessM4TConfig from torch.nn import CrossEntropyLoss from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModel...
null
11
2
22
2
15
5
3
0.33
1
10
5
0
10
4
11
14
264
30
176
61
136
58
78
33
66
16
2
3
34
5,135
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TForTextToSpeech
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
12
2
27
4
18
5
3
0.28
1
15
8
0
10
6
11
14
323
55
210
77
173
58
114
52
102
15
2
3
34
5,136
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TForTextToText
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union from .configuration_seamless_m4t import SeamlessM4TConfig from torch.nn import CrossEntropyLoss from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModel...
null
11
2
22
2
14
6
3
0.37
2
10
5
0
10
4
11
14
260
33
166
59
126
61
75
31
63
15
2
3
31
5,137
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TGenerationOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Class defining the generated outputs from [`SeamlessM4TModel`], [`SeamlessM4TForTextToText`],\n [`SeamlessM4TForTextToSpeech`], [...
@dataclass @auto_docstring(custom_intro='\n Class defining the generated outputs from [`SeamlessM4TModel`], [`SeamlessM4TForTextToText`],\n [`SeamlessM4TForTextToSpeech`], [`SeamlessM4TForSpeechToSpeech`] and [`SeamlessM4TForTextToSpeech`].\n ') class SeamlessM4TGenerationOutput(ModelOutput): ''' wavef...
3
1
0
0
0
0
0
3.4
1
0
0
0
0
0
0
0
24
2
5
5
4
17
5
5
4
0
1
0
0
5,138
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4THifiGan
import torch from torch import Tensor, nn from .configuration_seamless_m4t import SeamlessM4TConfig class SeamlessM4THifiGan(nn.Module): def __init__(self, config: SeamlessM4TConfig): super().__init__() model_in_dim = config.unit_embed_dim + config.lang_embed_dim + config.spkr_embed_dim se...
class SeamlessM4THifiGan(nn.Module): def __init__(self, config: SeamlessM4TConfig): pass def forward(self, input_embeds: torch.FloatTensor) -> torch.FloatTensor: ''' Converts a log-mel spectrogram into a speech waveform. Passing a batch of log-mel spectrograms returns a batch ...
3
1
34
5
22
7
4
0.31
1
6
2
0
2
7
2
12
70
11
45
19
42
14
31
19
28
4
1
2
7
5,139
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
12
3
37
5
26
7
5
0.24
1
15
8
0
10
9
11
14
432
65
295
84
254
72
152
55
140
20
2
3
52
5,140
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TPreTrainedModel
import math from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...modeling_utils import PreTrainedModel from typing import Optional, Union from .configuration_seamless_m4t import SeamlessM4TConfig @auto_docstring class SeamlessM4TPreTrainedModel(PreTrainedModel): ...
@auto_docstring class SeamlessM4TPreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module): '''Initialize the weights''' pass def _compute_sub_sample_lengths_from_attention_mask(self, attention_mask): pass def compute_last_hidden_states_per_sample(self, hidden_s...
5
2
32
3
19
9
5
0.52
1
4
3
10
3
0
3
3
108
14
62
20
54
32
48
16
44
13
1
2
16
5,141
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TScaledWordEmbedding
import torch from typing import Optional, Union from torch import Tensor, nn class SeamlessM4TScaledWordEmbedding(nn.Embedding): """ This module overrides nn.Embeddings' forward by multiplying with embeddings scale. """ def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embe...
class SeamlessM4TScaledWordEmbedding(nn.Embedding): ''' This module overrides nn.Embeddings' forward by multiplying with embeddings scale. ''' def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0): pass def forward(self, input_ids:...
3
1
3
0
3
0
1
0.5
1
4
0
0
2
1
2
2
11
2
6
4
3
3
6
4
3
1
1
0
2
5,142
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TSinusoidalPositionalEmbedding
import math import torch from typing import Optional, Union from torch import Tensor, nn class SeamlessM4TSinusoidalPositionalEmbedding(nn.Module): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=N...
class SeamlessM4TSinusoidalPositionalEmbedding(nn.Module): '''This module produces sinusoidal positional embeddings of any length.''' def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): pass def make_weights(self, num_embeddings: int, embedding_dim: int, p...
11
4
13
2
9
3
2
0.34
1
3
0
0
4
3
5
15
76
13
47
22
37
16
38
18
32
3
1
1
10
5,143
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TSpeechEncoder
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from typing import Optional, Union from .configuration_seamless_m4t...
@auto_docstring(custom_intro='\n Transformer speech encoder consisting of *config.speech_encoder_layers* conformer self attention layers.\n Each layer is a [`SeamlessM4TConformerEncoderLayer`].\n ') class SeamlessM4TSpeechEncoder(SeamlessM4TPreTrainedModel): def __init__(self, config: SeamlessM4TConfig): ...
4
0
30
6
24
1
5
0.02
1
10
6
0
2
5
2
5
64
13
50
20
39
1
27
12
24
7
2
1
9
5,144
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TTextToUnitForConditionalGeneration
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn import copy from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache...
@auto_docstring(custom_intro='\n Transformer text-to-unit encoder-decoder with a language model head. The base encoder-decoder model is a [`SeamlessM4TTextToUnit`].\n ') class SeamlessM4TTextToUnitForConditionalGeneration(SeamlessM4TPreTrainedModel, GenerationMixin): def __init__(self, config: SeamlessM4TCon...
11
2
10
1
9
0
2
0.03
2
7
3
0
10
2
11
14
130
19
108
46
75
3
55
25
43
8
2
2
23
5,145
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TTextToUnitModel
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union from .configuration_seamless_m4t import SeamlessM4TConfig from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from t...
@auto_docstring(custom_intro='\n Transformer bare text-to-unit encoder-decoder. The encoder is a [`SeamlessM4TEncoder`] without embeddings and the decoder is a [`SeamlessM4TDecoder`].\n ') class SeamlessM4TTextToUnitModel(SeamlessM4TPreTrainedModel): def __init__(self, config: SeamlessM4TConfig, embed_tokens...
4
1
39
3
35
2
6
0.04
1
8
5
0
2
2
2
5
80
7
70
24
49
3
18
6
15
10
2
1
11
5,146
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
transformers.models.seamless_m4t.modeling_seamless_m4t.SeamlessM4TVariancePredictor
from torch import Tensor, nn class SeamlessM4TVariancePredictor(nn.Module): def __init__(self, config): super().__init__() embed_dim = config.unit_embed_dim kernel_size = config.variance_predictor_kernel_size var_pred_dropout = config.var_pred_dropout self.conv1 = nn.Conv1d...
class SeamlessM4TVariancePredictor(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: Tensor) -> Tensor: pass
3
0
17
1
15
1
1
0.03
1
2
0
0
2
7
2
12
35
3
31
13
28
1
21
13
18
1
1
0
2
5,147
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/processing_seamless_m4t.py
transformers.models.seamless_m4t.processing_seamless_m4t.SeamlessM4TProcessor
from ...processing_utils import ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack from ...tokenization_utils_base import PreTokenizedInput, TextInput from ...audio_utils import AudioInput from typing import Optional, Union from ...utils.deprecation import deprecate_kwarg class SeamlessM4TProcessor(ProcessorMixin): ...
class SeamlessM4TProcessor(ProcessorMixin): ''' Constructs a SeamlessM4T processor which wraps a SeamlessM4T feature extractor and a SeamlessM4T tokenizer into a single processor. [`SeamlessM4TProcessor`] offers all the functionalities of [`SeamlessM4TFeatureExtractor`] and [`SeamlessM4TTokenizerFa...
4
2
14
1
6
8
2
1.59
1
4
0
0
5
0
5
22
96
13
32
13
25
51
26
12
20
6
2
2
10
5,148
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/tokenization_seamless_m4t.py
transformers.models.seamless_m4t.tokenization_seamless_m4t.SeamlessM4TTokenizer
from ...tokenization_utils import BatchEncoding, PreTokenizedInput, PreTrainedTokenizer, TextInput from shutil import copyfile from ...utils import PaddingStrategy, logging import os from ...convert_slow_tokenizer import import_protobuf from ...tokenization_utils_base import AddedToken from typing import Any, Optional,...
@requires(backends=('sentencepiece',)) class SeamlessM4TTokenizer(PreTrainedTokenizer): ''' Construct a SeamlessM4T tokenizer. Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). The tokenization method is `<language code> <tok...
35
13
15
2
9
4
2
0.75
1
8
1
0
27
12
27
116
520
84
250
116
172
187
160
64
132
8
3
2
59
5,149
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t/tokenization_seamless_m4t_fast.py
transformers.models.seamless_m4t.tokenization_seamless_m4t_fast.SeamlessM4TTokenizerFast
from tokenizers import processors from ...utils import PaddingStrategy, is_sentencepiece_available, logging from shutil import copyfile from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...tokenization_utils import BatchEncoding, PreTokenizedInput, TextInput from typing import Optional, Union import o...
class SeamlessM4TTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" SeamlessM4T tokenizer (backed by HuggingFace's *tokenizers* library). Based on [BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models). This tokenizer inherits from [`PreTrainedToken...
22
7
18
2
12
4
2
0.65
1
8
1
0
16
4
17
105
406
63
208
96
132
135
99
38
81
5
3
1
34
5,150
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/configuration_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.configuration_seamless_m4t_v2.SeamlessM4Tv2Config
from ...configuration_utils import PretrainedConfig class SeamlessM4Tv2Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`~SeamlessM4Tv2Model`]. It is used to instantiate an SeamlessM4Tv2 model according to the specified arguments, defining the model architectur...
class SeamlessM4Tv2Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`~SeamlessM4Tv2Model`]. It is used to instantiate an SeamlessM4Tv2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaul...
2
1
180
6
160
18
1
1.33
1
1
0
0
1
72
1
1
399
25
162
153
82
216
76
75
74
1
1
0
1
5,151
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.HifiGanResidualBlock
from torch import Tensor, nn class HifiGanResidualBlock(nn.Module): def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_relu_slope=0.1): super().__init__() self.leaky_relu_slope = leaky_relu_slope self.convs1 = nn.ModuleList([nn.Conv1d(channels, channels, kernel_size, str...
class HifiGanResidualBlock(nn.Module): def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_relu_slope=0.1): pass def get_padding(self, kernel_size, dilation=1): pass def apply_weight_norm(self): pass def remove_weight_norm(self): pass def forwa...
6
0
11
0
11
0
2
0
1
3
0
0
5
3
5
15
60
6
54
15
48
0
30
14
24
4
1
1
11
5,152
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2Attention
from torch import Tensor, nn import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config from ...utils.deprecation import deprecate_kwarg class SeamlessM4Tv2Attention(nn.Module): """Multi-headed a...
class SeamlessM4Tv2Attention(nn.Module): '''Multi-headed attention from 'Attention Is All You Need' paper''' def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[SeamlessM4Tv2Config]=None, layer_idx: Optional[in...
4
2
31
3
22
6
3
0.28
1
7
1
0
3
12
3
13
100
13
68
44
48
19
47
28
43
7
1
2
10
5,153
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2CodeHifiGan
from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...modeling_utils import PreTrainedModel from typing import Optional, Union from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config @auto_docstring(custom_intro='\n Code HiFi-GAN vocoder as described in t...
@auto_docstring(custom_intro='\n Code HiFi-GAN vocoder as described in this [repository](https://github.com/facebookresearch/speech-resynthesis).\n ') class SeamlessM4Tv2CodeHifiGan(PreTrainedModel): def __init__(self, config): pass def _get_dur_output_lengths(self, input_ids, dur_out): ...
11
4
17
3
11
3
3
0.34
1
8
2
0
7
6
7
7
164
30
100
39
88
34
82
37
72
6
1
3
25
5,154
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerAdapter
from torch import Tensor, nn class SeamlessM4Tv2ConformerAdapter(nn.Module): def __init__(self, config): super().__init__() self.layers = nn.ModuleList((SeamlessM4Tv2ConformerAdapterLayer(config) for _ in range(config.num_adapter_layers))) def forward(self, hidden_states, attention_mask): ...
class SeamlessM4Tv2ConformerAdapter(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, attention_mask): pass
3
0
7
2
5
1
2
0.1
1
3
1
0
2
1
2
12
15
4
10
6
7
1
8
5
5
2
1
1
3
5,155
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerAdapterLayer
from torch import Tensor, nn from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask import torch from typing import Optional, Union class SeamlessM4Tv2ConformerAdapterLayer(nn.Module): def __init__(self, config): super().__init__() embed_dim = config....
class SeamlessM4Tv2ConformerAdapterLayer(nn.Module): def __init__(self, config): pass def _compute_sub_sample_lengths_from_attention_mask(self, attention_mask): pass def forward(self, hidden_states, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False): pass
4
0
31
4
23
4
1
0.17
1
5
2
0
3
11
3
13
96
15
69
27
60
12
43
22
39
2
1
1
4
5,156
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerConvolutionModule
from torch import Tensor, nn from ...activations import ACT2FN import torch class SeamlessM4Tv2ConformerConvolutionModule(nn.Module): """Convolution block used in the conformer block. Uses a causal depthwise convolution similar to that described in Section 2.1 of https://huggingface.co/papers/1609.03499 ""...
class SeamlessM4Tv2ConformerConvolutionModule(nn.Module): '''Convolution block used in the conformer block. Uses a causal depthwise convolution similar to that described in Section 2.1 of https://huggingface.co/papers/1609.03499 ''' def __init__(self, config): pass def forward(self, hidde...
3
1
32
3
25
4
2
0.2
1
2
0
0
2
8
2
12
68
8
50
11
47
10
28
11
25
2
1
1
4
5,157
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerEncoder
from ...integrations.deepspeed import is_deepspeed_zero3_enabled from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn import torch from ...integrations.fsdp import is_fsdp_managed_module cla...
class SeamlessM4Tv2ConformerEncoder(nn.Module): def __init__(self, config): pass def _apply_chunk_attention(self, attention_mask, hidden_states): ''' Creates a chunk attention mask. It creates a mask to prevent attention across chunks, ensuring that each position attends only ...
4
1
40
7
29
3
6
0.11
1
6
2
0
3
5
3
13
123
24
89
31
78
10
60
23
56
15
1
3
19
5,158
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerEncoderLayer
from torch import Tensor, nn from ...modeling_layers import GradientCheckpointingLayer import torch from typing import Optional, Union class SeamlessM4Tv2ConformerEncoderLayer(GradientCheckpointingLayer): """Conformer block based on https://huggingface.co/papers/2005.08100.""" def __init__(self, config): ...
class SeamlessM4Tv2ConformerEncoderLayer(GradientCheckpointingLayer): '''Conformer block based on https://huggingface.co/papers/2005.08100.''' def __init__(self, config): pass def forward(self, hidden_states, attention_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, conv_attenti...
3
1
30
5
22
4
1
0.23
1
6
3
0
2
9
2
12
65
11
44
22
35
10
34
16
31
1
1
0
2
5,159
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerFeatureProjection
from torch import Tensor, nn class SeamlessM4Tv2ConformerFeatureProjection(nn.Module): def __init__(self, config): super().__init__() self.layer_norm = nn.LayerNorm(config.feature_projection_input_dim, eps=config.layer_norm_eps) self.projection = nn.Linear(config.feature_projection_input_d...
class SeamlessM4Tv2ConformerFeatureProjection(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
6
0
5
1
1
0.18
1
1
0
0
2
3
2
12
14
1
11
7
8
2
11
7
8
1
1
0
2
5,160
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerFeedForward
from torch import Tensor, nn from ...activations import ACT2FN class SeamlessM4Tv2ConformerFeedForward(nn.Module): def __init__(self, config, act_fn=None, dropout=None): super().__init__() dropout = dropout if dropout is not None else config.speech_encoder_dropout act_fn = act_fn if act_fn...
class SeamlessM4Tv2ConformerFeedForward(nn.Module): def __init__(self, config, act_fn=None, dropout=None): pass def forward(self, hidden_states): pass
3
0
10
2
8
0
3
0
1
2
0
0
2
5
2
12
21
4
17
8
14
0
17
8
14
4
1
0
5
5,161
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ConformerSelfAttention
from torch import Tensor, nn import math import torch from typing import Optional, Union class SeamlessM4Tv2ConformerSelfAttention(nn.Module): """Construct a SeamlessM4Tv2ConformerSelfAttention object. Can be enhanced with relative position embeddings. """ def __init__(self, config, use_position_embed...
class SeamlessM4Tv2ConformerSelfAttention(nn.Module): '''Construct a SeamlessM4Tv2ConformerSelfAttention object. Can be enhanced with relative position embeddings. ''' def __init__(self, config, use_position_embeddings=True): pass def forward(self, hidden_states: torch.Tensor, attention_m...
3
1
39
9
26
5
4
0.23
1
3
0
0
2
11
2
12
83
20
52
34
44
12
47
29
44
4
1
1
7
5,162
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2Decoder
import math from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils import Cache, DynamicCache, Encoder...
@auto_docstring(custom_intro='\n Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`SeamlessM4Tv2DecoderLayer`].\n ') class SeamlessM4Tv2Decoder(SeamlessM4Tv2PreTrainedModel): def __init__(self, config: SeamlessM4Tv2Config, embed_tokens: Optional[nn.Embedding]=None): ...
5
1
59
8
37
14
9
0.36
1
12
5
0
4
10
4
10
238
34
150
47
129
54
80
31
75
29
2
3
35
5,163
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2DecoderLayer
from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config from torch import Tensor, nn from ...modeling_layers import GradientCheckpointingLayer import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Optional, Union from ...activations import ACT2FN from ...utils.deprec...
class SeamlessM4Tv2DecoderLayer(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4Tv2Config, decoder_ffn_dim=None, decoder_attention_heads=None, layer_idx=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states: tor...
4
1
56
8
35
13
4
0.35
1
6
3
0
2
11
2
12
113
17
71
30
59
25
42
21
39
5
1
1
8
5,164
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2Encoder
import math from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...modeling_attn_mask_utils import _prepare_4d_att...
@auto_docstring(custom_intro='\n Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a [`SeamlessM4Tv2EncoderLayer`].\n ') class SeamlessM4Tv2Encoder(SeamlessM4Tv2PreTrainedModel): def __init__(self, config: SeamlessM4Tv2Config, embed_tokens: Optional[nn.Embedding]=...
4
2
87
15
57
16
14
0.28
1
12
5
0
2
10
2
8
176
30
115
40
98
32
68
26
65
22
2
3
27
5,165
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2EncoderLayer
from torch import Tensor, nn from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config from ...modeling_layers import GradientCheckpointingLayer import torch class SeamlessM4Tv2EncoderLayer(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4Tv2Config, encoder_ffn_dim=None, encoder_attention_he...
class SeamlessM4Tv2EncoderLayer(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4Tv2Config, encoder_ffn_dim=None, encoder_attention_heads=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor: '...
3
1
30
5
21
4
3
0.19
1
6
3
0
2
7
2
12
61
11
42
18
34
8
27
13
24
3
1
1
5
5,166
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2FeedForwardNetwork
from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config import torch from torch import Tensor, nn from ...activations import ACT2FN class SeamlessM4Tv2FeedForwardNetwork(nn.Module): def __init__(self, config: SeamlessM4Tv2Config, ffn_dim: int): super().__init__() self.fc1 = nn.Linear(config...
class SeamlessM4Tv2FeedForwardNetwork(nn.Module): def __init__(self, config: SeamlessM4Tv2Config, ffn_dim: int): pass def forward(self, hidden_states): pass
3
0
9
0
9
0
2
0
1
4
1
0
2
4
2
12
20
1
19
7
16
0
15
7
12
2
1
1
3
5,167
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ForSpeechToSpeech
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
12
2
31
5
21
6
3
0.31
1
14
7
0
10
6
11
17
374
62
239
88
201
74
126
62
114
16
2
3
36
5,168
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ForSpeechToText
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
11
2
22
2
15
5
3
0.39
1
10
5
0
10
4
11
17
275
30
176
61
136
69
78
33
66
16
2
3
34
5,169
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ForTextToSpeech
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
12
2
30
5
20
6
3
0.32
1
15
8
0
10
6
11
17
365
62
230
85
193
74
124
60
112
15
2
3
35
5,170
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ForTextToText
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
11
2
22
2
14
6
3
0.37
2
10
5
0
10
4
11
17
260
33
166
59
126
61
75
31
63
15
2
3
31
5,171
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2GenerationOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Class defining the generated outputs from [`SeamlessM4Tv2Model`], [`SeamlessM4Tv2ForTextToText`],\n [`SeamlessM4Tv2ForTextToSpeec...
@dataclass @auto_docstring(custom_intro='\n Class defining the generated outputs from [`SeamlessM4Tv2Model`], [`SeamlessM4Tv2ForTextToText`],\n [`SeamlessM4Tv2ForTextToSpeech`], [`SeamlessM4Tv2ForSpeechToSpeech`] and [`SeamlessM4Tv2ForTextToSpeech`].\n ') class SeamlessM4Tv2GenerationOutput(ModelOutput): '...
3
1
0
0
0
0
0
3.4
1
0
0
0
0
0
0
0
24
2
5
5
4
17
5
5
4
0
1
0
0
5,172
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2HifiGan
from torch import Tensor, nn from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config import torch class SeamlessM4Tv2HifiGan(nn.Module): def __init__(self, config: SeamlessM4Tv2Config): super().__init__() model_in_dim = config.unit_embed_dim + config.lang_embed_dim + config.spkr_embed_dim ...
class SeamlessM4Tv2HifiGan(nn.Module): def __init__(self, config: SeamlessM4Tv2Config): pass def forward(self, input_embeds: torch.FloatTensor) -> torch.FloatTensor: ''' Converts a log-mel spectrogram into a speech waveform. Passing a batch of log-mel spectrograms returns a batch ...
3
1
34
5
22
7
4
0.31
1
6
2
0
2
7
2
12
70
11
45
19
42
14
31
19
28
4
1
2
7
5,173
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2Model
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...cache_utils impor...
null
12
3
41
6
28
7
5
0.28
1
15
8
0
10
9
11
17
478
72
319
93
278
88
165
64
153
20
2
3
54
5,174
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2PreTrainedModel
import math from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...modeling_utils import PreTrainedModel from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config @auto_docstring class SeamlessM4Tv2PreTrainedModel(PreTrainedModel): config: SeamlessM4Tv2Conf...
@auto_docstring class SeamlessM4Tv2PreTrainedModel(PreTrainedModel): def _init_weights(self, module: nn.Module): '''Initialize the weights''' pass def _compute_sub_sample_lengths_from_attention_mask(self, attention_mask): pass def _indices_to_subwords(self, input_ids): '''...
8
5
35
4
22
10
6
0.43
1
9
2
11
6
0
6
6
233
28
143
51
128
62
99
43
92
12
1
5
37
5,175
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2ScaledWordEmbedding
from torch import Tensor, nn import torch from typing import Optional, Union class SeamlessM4Tv2ScaledWordEmbedding(nn.Embedding): """ This module overrides nn.Embeddings' forward by multiplying with embeddings scale. """ def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, em...
class SeamlessM4Tv2ScaledWordEmbedding(nn.Embedding): ''' This module overrides nn.Embeddings' forward by multiplying with embeddings scale. ''' def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0): pass def forward(self, input_id...
3
1
3
0
3
0
1
0.5
1
4
0
0
2
1
2
2
11
2
6
4
3
3
6
4
3
1
1
0
2
5,176
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2SinusoidalPositionalEmbedding
from torch import Tensor, nn import math import torch from typing import Optional, Union class SeamlessM4Tv2SinusoidalPositionalEmbedding(nn.Module): """This module produces sinusoidal positional embeddings of any length.""" def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]...
class SeamlessM4Tv2SinusoidalPositionalEmbedding(nn.Module): '''This module produces sinusoidal positional embeddings of any length.''' def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None): pass def make_weights(self, num_embeddings: int, embedding_dim: int,...
11
4
13
2
9
3
2
0.34
1
3
0
0
4
3
5
15
76
13
47
22
37
16
38
18
32
3
1
1
10
5,177
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2SpeechEncoder
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from typing import Optional, Union from .configuration_seamless_m4t...
@auto_docstring(custom_intro='\n Transformer speech encoder consisting of *config.speech_encoder_layers* conformer self attention layers.\n Each layer is a [`SeamlessM4Tv2ConformerEncoderLayer`].\n ') class SeamlessM4Tv2SpeechEncoder(SeamlessM4Tv2PreTrainedModel): def __init__(self, config: SeamlessM4Tv2C...
4
0
30
6
24
1
5
0.02
1
10
6
0
2
5
2
8
64
13
50
20
39
1
27
12
24
7
2
1
9
5,178
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2TextToUnitDecoder
import math from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask from typing import Optional, Union from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config @auto_d...
@auto_docstring(custom_intro='\n Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`SeamlessM4Tv2DecoderLayer`].\n ') class SeamlessM4Tv2TextToUnitDecoder(SeamlessM4Tv2PreTrainedModel): def __init__(self, config: SeamlessM4Tv2Config, embed_tokens: Optional[nn.Embedding]=None)...
4
2
42
5
30
8
5
0.25
1
10
5
0
4
16
4
10
172
23
119
49
102
30
68
37
63
14
2
3
20
5,179
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2TextToUnitDecoderLayer
from .configuration_seamless_m4t_v2 import SeamlessM4Tv2Config from torch import Tensor, nn from ...modeling_layers import GradientCheckpointingLayer import torch from typing import Optional, Union from ...activations import ACT2FN class SeamlessM4Tv2TextToUnitDecoderLayer(GradientCheckpointingLayer): def __init_...
class SeamlessM4Tv2TextToUnitDecoderLayer(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4Tv2Config, decoder_ffn_dim=None, decoder_attention_heads=None): pass def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, padding_mask: Optional[torch.Ten...
3
1
40
6
25
9
4
0.33
1
5
2
0
2
9
2
12
81
13
51
21
42
17
34
15
31
4
1
1
7
5,180
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2TextToUnitDecoderOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Class defining the outputs from [`SeamlessM4Tv2TextToUnitDecoder`].\n ') class SeamlessM4Tv2TextToUnitDecoderOutput(ModelOutput):...
@dataclass @auto_docstring(custom_intro='\n Class defining the outputs from [`SeamlessM4Tv2TextToUnitDecoder`].\n ') class SeamlessM4Tv2TextToUnitDecoderOutput(ModelOutput): ''' padding_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*): Indicates which inputs are to be ign...
3
1
0
0
0
0
0
3.6
1
0
0
0
0
0
0
0
27
4
5
5
4
18
5
5
4
0
1
0
0
5,181
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2TextToUnitForConditionalGeneration
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from ...generation import GenerationMixin from torch import Tensor, nn import copy from ...utils import ModelOutput, auto_docstring, logging import torch from typing i...
@auto_docstring(custom_intro='\n Transformer text-to-unit encoder-decoder with a language model head. The base encoder-decoder model is a [`SeamlessM4Tv2TextToUnitModel`].\n ') class SeamlessM4Tv2TextToUnitForConditionalGeneration(SeamlessM4Tv2PreTrainedModel, GenerationMixin): def __init__(self, config: Sea...
10
2
9
1
8
0
2
0.12
2
7
4
0
9
2
9
15
110
16
84
39
56
10
42
21
32
5
2
2
17
5,182
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2TextToUnitModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Wav2Vec2BaseModelOutput from torch import Tensor, nn from ...utils import ModelOutput, auto_docstring, logging import torch from typing import Optional, Union from .configuration_seamless_m4t...
@auto_docstring(custom_intro='\n Transformer bare text-to-unit encoder-decoder. The encoder is a [`SeamlessM4Tv2Encoder`] without embeddings and the decoder is a [`SeamlessM4Tv2TextToUnitDecoder`].\n ') class SeamlessM4Tv2TextToUnitModel(SeamlessM4Tv2PreTrainedModel): def __init__(self, config: SeamlessM4Tv2...
4
1
35
3
30
2
5
0.07
1
9
6
0
2
2
2
8
72
7
61
21
43
4
17
6
14
9
2
1
10
5,183
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2TextToUnitOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Class defining the outputs from [`SeamlessM4Tv2TextToUnitForConditionalGeneration`] and\n [`SeamlessM4Tv2TextToUnitModel`].\n...
@dataclass @auto_docstring(custom_intro='\n Class defining the outputs from [`SeamlessM4Tv2TextToUnitForConditionalGeneration`] and\n [`SeamlessM4Tv2TextToUnitModel`].\n ') class SeamlessM4Tv2TextToUnitOutput(ModelOutput): ''' last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_l...
3
1
0
0
0
0
0
3.78
1
0
0
0
0
0
0
0
50
7
9
9
8
34
9
9
8
0
1
0
0
5,184
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
transformers.models.seamless_m4t_v2.modeling_seamless_m4t_v2.SeamlessM4Tv2VariancePredictor
from torch import Tensor, nn from typing import Optional, Union class SeamlessM4Tv2VariancePredictor(nn.Module): def __init__(self, embed_dim, hidden_dim, kernel_size, var_pred_dropout): super().__init__() self.conv1 = nn.Conv1d(embed_dim, hidden_dim, kernel_size=kernel_size, padding='same') ...
class SeamlessM4Tv2VariancePredictor(nn.Module): def __init__(self, embed_dim, hidden_dim, kernel_size, var_pred_dropout): pass def forward(self, hidden_states: Tensor, padding_mask: Optional[Tensor]=None) -> Tensor: pass
3
0
17
1
16
1
2
0.03
1
2
0
0
2
7
2
12
35
2
32
10
29
1
22
10
19
3
1
1
4
5,185
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/configuration_segformer.py
transformers.models.segformer.configuration_segformer.SegformerConfig
from ...configuration_utils import PretrainedConfig import warnings class SegformerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`SegformerModel`]. It is used to instantiate an SegFormer model according to the specified arguments, defining the model architec...
class SegformerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`SegformerModel`]. It is used to instantiate an SegFormer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield...
2
1
50
2
48
0
2
1.14
1
2
0
0
1
19
1
1
118
11
50
43
27
57
25
22
23
2
1
1
2
5,186
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/configuration_segformer.py
transformers.models.segformer.configuration_segformer.SegformerOnnxConfig
from collections.abc import Mapping from collections import OrderedDict from ...onnx import OnnxConfig from packaging import version class SegformerOnnxConfig(OnnxConfig): torch_onnx_minimum_version = version.parse('1.11') @property def inputs(self) -> Mapping[str, Mapping[int, str]]: return Order...
class SegformerOnnxConfig(OnnxConfig): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def atol_for_validation(self) -> float: pass @property def default_onnx_opset(self) -> int: pass
7
0
3
0
3
0
1
0
1
4
0
0
3
0
3
3
18
3
15
8
8
0
8
5
4
1
1
0
3
5,187
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/feature_extraction_segformer.py
transformers.models.segformer.feature_extraction_segformer.SegformerFeatureExtractor
from ...utils.import_utils import requires import warnings from .image_processing_segformer import SegformerImageProcessor @requires(backends=('vision',)) class SegformerFeatureExtractor(SegformerImageProcessor): def __init__(self, *args, **kwargs) -> None: warnings.warn('The class SegformerFeatureExtract...
@requires(backends=('vision',)) class SegformerFeatureExtractor(SegformerImageProcessor): def __init__(self, *args, **kwargs) -> None: pass
3
0
7
0
7
0
1
0
1
2
0
0
1
0
1
31
8
0
8
2
6
0
4
2
2
1
4
0
1
5,188
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/image_processing_segformer.py
transformers.models.segformer.image_processing_segformer.SegformerImageProcessor
from typing import Optional, Union from ...image_processing_utils import INIT_SERVICE_KWARGS, BaseImageProcessor, BatchFeature, get_size_dict from ...utils import TensorType, filter_out_non_signature_kwargs, is_torch_available, is_torch_tensor, is_vision_available, logging from ...image_utils import IMAGENET_DEFAULT_ME...
@requires(backends=('vision',)) class SegformerImageProcessor(BaseImageProcessor): ''' Constructs a Segformer image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `(size["height"], ...
13
7
37
2
25
10
4
0.54
1
10
2
1
9
9
10
30
423
34
252
101
167
137
105
29
94
13
3
2
41
5,189
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegFormerImageClassifierOutput
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput, SemanticSegmenterOutput from typing import Optional, Union import torch class SegFormerImageClassifierOutput(ImageClassifierOutput): """ Base class for outputs of image classification models. Args: loss (`torch.FloatTensor` of...
class SegFormerImageClassifierOutput(ImageClassifierOutput): ''' Base class for outputs of image classification models. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification (or regression if config.num_labels==1) loss. ...
1
1
0
0
0
0
0
3.4
1
0
0
0
0
0
0
0
25
3
5
5
4
17
5
5
4
0
2
0
0
5,190
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerAttention
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer from torch import nn class SegformerAttention(nn.Module): def __init__(self, config, hidden_size, num_attention_heads, sequence_reduction_ratio): super().__init__() self.self = SegformerEfficientSelfAttention(config=...
class SegformerAttention(nn.Module): def __init__(self, config, hidden_size, num_attention_heads, sequence_reduction_ratio): pass def prune_heads(self, heads): pass def forward(self, hidden_states, height, width, output_attentions=False): pass
4
0
11
1
9
1
1
0.1
1
4
2
0
3
3
3
13
36
5
29
11
25
3
22
11
18
2
1
1
4
5,191
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerDWConv
from torch import nn class SegformerDWConv(nn.Module): def __init__(self, dim=768): super().__init__() self.dwconv = nn.Conv2d(dim, dim, 3, 1, 1, bias=True, groups=dim) def forward(self, hidden_states, height, width): batch_size, seq_len, num_channels = hidden_states.shape hid...
class SegformerDWConv(nn.Module): def __init__(self, dim=768): pass def forward(self, hidden_states, height, width): pass
3
0
5
1
5
0
1
0
1
1
0
0
2
1
2
12
12
2
10
5
7
0
10
5
7
1
1
0
2
5,192
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerDecodeHead
import torch import math from torch import nn class SegformerDecodeHead(SegformerPreTrainedModel): def __init__(self, config): super().__init__(config) mlps = [] for i in range(config.num_encoder_blocks): mlp = SegformerMLP(config, input_dim=config.hidden_sizes[i]) ...
class SegformerDecodeHead(SegformerPreTrainedModel): def __init__(self, config): pass def forward(self, encoder_hidden_states: torch.FloatTensor) -> torch.Tensor: pass
3
0
27
4
21
3
3
0.12
1
6
1
0
2
7
2
3
56
9
42
19
39
5
33
19
30
3
2
2
5
5,193
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerDropPath
from typing import Optional, Union from torch import nn import torch class SegformerDropPath(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 SegformerDropPath(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(sel...
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,194
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerEfficientSelfAttention
from torch import nn import math import torch class SegformerEfficientSelfAttention(nn.Module): """SegFormer's efficient self-attention mechanism. Employs the sequence reduction process introduced in the [PvT paper](https://huggingface.co/papers/2102.12122).""" def __init__(self, config, hidden_size, num_...
class SegformerEfficientSelfAttention(nn.Module): '''SegFormer's efficient self-attention mechanism. Employs the sequence reduction process introduced in the [PvT paper](https://huggingface.co/papers/2102.12122).''' def __init__(self, config, hidden_size, num_attention_heads, sequence_reduction_ratio): ...
3
1
24
5
17
2
2
0.17
1
3
0
0
3
11
3
13
79
18
52
31
42
9
41
25
37
3
1
1
7
5,195
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerEncoder
import torch from typing import Optional, Union from torch import nn from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput, SemanticSegmenterOutput class SegformerEncoder(nn.Module): def __init__(self, config): super().__init__() self.config = config drop_path_decays = [x....
class SegformerEncoder(nn.Module): def __init__(self, config): pass def forward(self, pixel_values: torch.FloatTensor, output_attentions: Optional[bool]=False, output_hidden_states: Optional[bool]=False, return_dict: Optional[bool]=True) -> Union[tuple, BaseModelOutput]: pass
3
0
44
4
35
5
8
0.13
1
9
3
0
2
4
2
12
89
9
71
29
62
9
41
23
38
9
1
3
15
5,196
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerForImageClassification
from torch import nn from ...utils import auto_docstring, logging from typing import Optional, Union import torch @auto_docstring(custom_intro='\n SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden\n states) e.g. for ImageNet.\n ') class SegformerFo...
@auto_docstring(custom_intro='\n SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden\n states) e.g. for ImageNet.\n ') class SegformerForImageClassification(SegformerPreTrainedModel): def __init__(self, config): pass @auto_docstring ...
5
1
40
6
29
6
7
0.17
1
5
2
0
2
3
2
3
89
12
66
21
49
11
37
13
34
13
2
3
14
5,197
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerForSemanticSegmentation
from ...modeling_outputs import BaseModelOutput, ImageClassifierOutput, SemanticSegmenterOutput from torch import nn import torch from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss from ...utils import auto_docstring, logging from typing import Optional, Union @auto_docstring(custom_intro='\n SegFormer Model ...
@auto_docstring(custom_intro='\n SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.\n ') class SegformerForSemanticSegmentation(SegformerPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, pixel_values: torch.FloatTenso...
5
1
44
7
26
12
7
0.42
1
6
3
0
2
2
2
3
92
15
55
21
43
23
30
13
27
12
2
2
13
5,198
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerLayer
from torch import nn class SegformerLayer(nn.Module): """This corresponds to the Block class in the original implementation.""" def __init__(self, config, hidden_size, num_attention_heads, drop_path, sequence_reduction_ratio, mlp_ratio): super().__init__() self.layer_norm_1 = nn.LayerNorm(hidd...
class SegformerLayer(nn.Module): '''This corresponds to the Block class in the original implementation.''' def __init__(self, config, hidden_size, num_attention_heads, drop_path, sequence_reduction_ratio, mlp_ratio): pass def forward(self, hidden_states, height, width, output_attentions=False): ...
3
1
19
3
15
2
2
0.17
1
5
3
0
2
5
2
12
41
8
30
14
27
5
20
14
17
2
1
0
3
5,199
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/segformer/modeling_segformer.py
transformers.models.segformer.modeling_segformer.SegformerMLP
import torch from .configuration_segformer import SegformerConfig from torch import nn class SegformerMLP(nn.Module): """ Linear Embedding. """ def __init__(self, config: SegformerConfig, input_dim): super().__init__() self.proj = nn.Linear(input_dim, config.decoder_hidden_size) d...
class SegformerMLP(nn.Module): ''' Linear Embedding. ''' def __init__(self, config: SegformerConfig, input_dim): pass def forward(self, hidden_states: torch.Tensor): pass
3
1
4
0
4
0
1
0.38
1
3
1
0
2
1
2
12
13
2
8
4
5
3
8
4
5
1
1
0
2