
    Z jp;                         S r SSKrSSKrSSKJr  SSKJr  SSKJr  \" SS9\ " S	 S
\5      5       5       r	\" SS9\ " S S\5      5       5       r
S
S/rg)zSpeechT5 model configuration    N)strict   )PreTrainedConfig)auto_docstringzmicrosoft/speecht5_asr)
checkpointc                     ^  \ rS rSr% SrSrSSS.rSr\\	S'   S	r
\\	S
'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Sr\\-  \	S'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Sr\\-  \	S'   Sr\\	S'   Sr\\-  \	S'   Sr\\-  \	S'   Sr\\-  \	S'   Sr\\-  \	S'   Sr\\	S'   Sr\\	S'   Sr\\	S '   S!r\\	S"'   S#r\\-  \	S$'   Sr \\	S%'   S&r!\"\   \#\S'4   -  \	S('   S)r$\"\   \#\S'4   -  \	S*'   S+r%\"\   \#\S'4   -  \	S,'   Sr&\\	S-'   S.r'\\	S/'   S0r(\\	S1'   S2r)\\	S3'   S4r*\\-  \	S5'   S6r+\\	S7'   S8r,\\	S9'   S#r-\\-  \	S:'   S6r.\\	S;'   S<r/\\	S='   S>r0\S?-  \	S@'   S<r1\S?-  \	SA'   S8r2\\"\   -  S?-  \	SB'   S8r3\S?-  \	SC'   SDr4\\	SE'   S8r5\\	SF'   SGr6\\	SH'   SIr7\\-  \	SJ'   SKr8\\	SL'   SMr9\\	SN'   SGr:\\	SO'   SMr;\\	SP'   SIr<\\-  \	SQ'   S8r=\\	SR'   SSr>\\	ST'   SUr?\\	SV'   SWr@\\	SX'   S2rA\\	SY'   S8rB\\	SZ'   S[rC\\	S\'   S]rD\\	S^'   S2rE\\	S_'   S2rF\\	S`'   S2rG\\	Sa'   U 4Sb jrHSc rISd rJSerKU =rL$ )fSpeechT5Config   a  
positional_dropout (`float`, *optional*, defaults to 0.1):
    The dropout probability for the text position encoding layers.
feat_extract_norm (`str`, *optional*, defaults to `"group"`):
    The norm to be applied to 1D convolutional layers in the speech encoder pre-net. One of `"group"` for group
    normalization of only the first 1D convolutional layer or `"layer"` for layer normalization of all 1D
    convolutional layers.
feat_proj_dropout (`float`, *optional*, defaults to 0.0):
    The dropout probability for output of the speech encoder pre-net.
feat_extract_activation (`str, `optional`, defaults to `"gelu"`):
    The non-linear activation function (function or string) in the 1D convolutional layers of the feature
    extractor. If string, `"gelu"`, `"relu"`, `"selu"` and `"gelu_new"` are supported.
conv_dim (`tuple[int]` or `list[int]`, *optional*, defaults to `(512, 512, 512, 512, 512, 512, 512)`):
    A tuple of integers defining the number of input and output channels of each 1D convolutional layer in the
    speech encoder pre-net. The length of *conv_dim* defines the number of 1D convolutional layers.
conv_stride (`tuple[int]` or `list[int]`, *optional*, defaults to `(5, 2, 2, 2, 2, 2, 2)`):
    A tuple of integers defining the stride of each 1D convolutional layer in the speech encoder pre-net. The
    length of *conv_stride* defines the number of convolutional layers and has to match the length of
    *conv_dim*.
conv_kernel (`tuple[int]` or `list[int]`, *optional*, defaults to `(10, 3, 3, 3, 3, 3, 3)`):
    A tuple of integers defining the kernel size of each 1D convolutional layer in the speech encoder pre-net.
    The length of *conv_kernel* defines the number of convolutional layers and has to match the length of
    *conv_dim*.
conv_bias (`bool`, *optional*, defaults to `False`):
    Whether the 1D convolutional layers have a bias.
num_conv_pos_embeddings (`int`, *optional*, defaults to 128):
    Number of convolutional positional embeddings. Defines the kernel size of 1D convolutional positional
    embeddings layer.
num_conv_pos_embedding_groups (`int`, *optional*, defaults to 16):
    Number of groups of 1D convolutional positional embeddings layer.
apply_spec_augment (`bool`, *optional*, defaults to `True`):
    Whether to apply *SpecAugment* data augmentation to the outputs of the speech encoder pre-net. For
    reference see [SpecAugment: A Simple Data Augmentation Method for Automatic Speech
    Recognition](https://huggingface.co/papers/1904.08779).
mask_time_prob (`float`, *optional*, defaults to 0.05):
    Percentage (between 0 and 1) of all feature vectors along the time axis which will be masked. The masking
    procedure generates ''mask_time_prob*len(time_axis)/mask_time_length'' independent masks over the axis. If
    reasoning from the probability of each feature vector to be chosen as the start of the vector span to be
    masked, *mask_time_prob* should be `prob_vector_start*mask_time_length`. Note that overlap may decrease the
    actual percentage of masked vectors. This is only relevant if `apply_spec_augment is True`.
mask_time_length (`int`, *optional*, defaults to 10):
    Length of vector span along the time axis.
mask_time_min_masks (`int`, *optional*, defaults to 2),:
    The minimum number of masks of length `mask_feature_length` generated along the time axis, each time step,
    irrespectively of `mask_feature_prob`. Only relevant if ''mask_time_prob*len(time_axis)/mask_time_length <
    mask_time_min_masks''
mask_feature_prob (`float`, *optional*, defaults to 0.0):
    Percentage (between 0 and 1) of all feature vectors along the feature axis which will be masked. The
    masking procedure generates ''mask_feature_prob*len(feature_axis)/mask_time_length'' independent masks over
    the axis. If reasoning from the probability of each feature vector to be chosen as the start of the vector
    span to be masked, *mask_feature_prob* should be `prob_vector_start*mask_feature_length`. Note that overlap
    may decrease the actual percentage of masked vectors. This is only relevant if `apply_spec_augment is
    True`.
mask_feature_length (`int`, *optional*, defaults to 10):
    Length of vector span along the feature axis.
mask_feature_min_masks (`int`, *optional*, defaults to 0),:
    The minimum number of masks of length `mask_feature_length` generated along the feature axis, each time
    step, irrespectively of `mask_feature_prob`. Only relevant if
    ''mask_feature_prob*len(feature_axis)/mask_feature_length < mask_feature_min_masks''
num_mel_bins (`int`, *optional*, defaults to 80):
    Number of mel features used per input features. Used by the speech decoder pre-net. Should correspond to
    the value used in the [`SpeechT5Processor`] class.
speech_decoder_prenet_layers (`int`, *optional*, defaults to 2):
    Number of layers in the speech decoder pre-net.
speech_decoder_prenet_units (`int`, *optional*, defaults to 256):
    Dimensionality of the layers in the speech decoder pre-net.
speech_decoder_prenet_dropout (`float`, *optional*, defaults to 0.5):
    The dropout probability for the speech decoder pre-net layers.
speaker_embedding_dim (`int`, *optional*, defaults to 512):
    Dimensionality of the *XVector* embedding vectors.
speech_decoder_postnet_layers (`int`, *optional*, defaults to 5):
    Number of layers in the speech decoder post-net.
speech_decoder_postnet_units (`int`, *optional*, defaults to 256):
    Dimensionality of the layers in the speech decoder post-net.
speech_decoder_postnet_kernel (`int`, *optional*, defaults to 5):
    Number of convolutional filter channels in the speech decoder post-net.
speech_decoder_postnet_dropout (`float`, *optional*, defaults to 0.5):
    The dropout probability for the speech decoder post-net layers.
reduction_factor (`int`, *optional*, defaults to 2):
    Spectrogram length reduction factor for the speech decoder inputs.
max_speech_positions (`int`, *optional*, defaults to 4000):
    The maximum sequence length of speech features that this model might ever be used with.
max_text_positions (`int`, *optional*, defaults to 450):
    The maximum sequence length of text features that this model might ever be used with.
encoder_max_relative_position (`int`, *optional*, defaults to 160):
    Maximum distance for relative position embedding in the encoder.
use_guided_attention_loss (`bool`, *optional*, defaults to `True`):
    Whether to apply guided attention loss while training the TTS model.
guided_attention_loss_num_heads (`int`, *optional*, defaults to 2):
    Number of attention heads the guided attention loss will be applied to. Use -1 to apply this loss to all
    attention heads.
guided_attention_loss_sigma (`float`, *optional*, defaults to 0.4):
    Standard deviation for guided attention loss.
guided_attention_loss_scale (`float`, *optional*, defaults to 10.0):
    Scaling coefficient for guided attention loss (also known as lambda).

Example:

```python
>>> from transformers import SpeechT5Model, SpeechT5Config

>>> # Initializing a "microsoft/speecht5_asr" style configuration
>>> configuration = SpeechT5Config()

>>> # Initializing a model (with random weights) from the "microsoft/speecht5_asr" style configuration
>>> model = SpeechT5Model(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```speecht5encoder_attention_headsencoder_layers)num_attention_headsnum_hidden_layersQ   
vocab_sizei   hidden_size   i   encoder_ffn_dim皙?encoder_layerdrop   decoder_layersdecoder_ffn_dimdecoder_attention_headsdecoder_layerdropgelu
hidden_actpositional_dropouthidden_dropoutattention_dropoutactivation_dropoutg{Gz?initializer_rangegh㈵>layer_norm_epsFscale_embeddinggroupfeat_extract_normg        feat_proj_dropoutfeat_extract_activation)   r)   r)   r)   r)   r)   r)   .conv_dim)      r,   r,   r,   r,   r,   conv_stride)
   r   r   r   r   r,   r,   conv_kernel	conv_bias   num_conv_pos_embeddings   num_conv_pos_embedding_groupsTapply_spec_augmentg?mask_time_probr.   mask_time_lengthr,   mask_time_min_masksmask_feature_probmask_feature_lengthr   mask_feature_min_masks   Npad_token_idbos_token_ideos_token_iddecoder_start_token_idP   num_mel_binsspeech_decoder_prenet_layers   speech_decoder_prenet_unitsg      ?speech_decoder_prenet_dropoutr)   speaker_embedding_dimr+   speech_decoder_postnet_layersspeech_decoder_postnet_unitsspeech_decoder_postnet_kernelspeech_decoder_postnet_dropoutreduction_factori  max_speech_positionsi  max_text_positions   encoder_max_relative_positionuse_guided_attention_lossguided_attention_loss_num_headsg?guided_attention_loss_sigmag      $@guided_attention_loss_scale	use_cacheis_encoder_decodertie_word_embeddingsc                 Z   > [        U R                  5      U l        [        TU ]  " S0 UD6  g )N )lenr*   num_feat_extract_layerssuper__post_init__)selfkwargs	__class__s     ڄ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/speecht5/configuration_speecht5.pyr]   SpeechT5Config.__post_init__   s$    '*4=='9$''    c           
      r   [        U R                  5      U R                  :w  dF  [        U R                  5      U R                  :w  d#  [        U R                  5      U R                  :w  aN  [        S[        U R                  5       S[        U R                  5       S[        U R                  5       S35      eg)zOPart of `@strict`-powered validation. Validates the architecture of the config.zConfiguration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) = z`, `len(config.conv_stride) = z`, `len(config.conv_kernel) = z`.N)rZ   r-   r[   r/   r*   
ValueErrorr^   s    ra   validate_architecture$SpeechT5Config.validate_architecture   s     !!"d&B&BBD$$%)E)EEDMM"d&B&BB&''Ec$JZJZF[E\ ]//243C3C/D.ERI  Crc   c                 b    [         R                  " [        R                  U R                  S5      $ )Nr<   )	functoolsreduceoperatormulr-   rf   s    ra   inputs_to_logits_ratio%SpeechT5Config.inputs_to_logits_ratio   s!    d.>.>BBrc   )r[   )M__name__
__module____qualname____firstlineno____doc__
model_typeattribute_mapr   int__annotations__r   r   r   r   r   floatr   r   r   r   r   strr   r   r    r!   r"   r#   r$   boolr&   r'   r(   r*   listtupler-   r/   r0   r2   r4   r5   r6   r7   r8   r9   r:   r;   r=   r>   r?   r@   rB   rC   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rP   rQ   rR   rS   rT   rU   rV   rW   r]   rg   rn   __static_attributes____classcell__)r`   s   @ra   r	   r	      s   m^ J,E\lmMJKNC#%S%OS%(us{(NCOS#%S%%(us{(J&))"%NECK%%(us{(&))#u# NE !OT!$s$%(us{(#)S),OHd3i%S/)O/DKcU38_,D/EKcU38_,EIt#&S&)+!3+##"&NECK&c  %(us{(!!"#C# L#*  L#* +,L#S	/D(,)*C$J*L#() #)'**14!53;4!$3$)*!3*(+ #+)*!3*25"ECK5c $#$!!),!3,&*t*+,#S,),,)--It## $$(C Crc   r	   c                       \ rS rSr% SrSrSr\\S'   Sr	\\S'   Sr
\\S	'   S
r\\   \\S4   -  \S'   Sr\\   \\S4   -  \S'   Sr\\   \\S4   -  \S'   Sr\\-  \S'   Sr\\S'   Sr\\S'   Sr\\S'   Srg)SpeechT5HifiGanConfig   a`  
model_in_dim (`int`, *optional*, defaults to 80):
    The number of frequency bins in the input log-mel spectrogram.
upsample_initial_channel (`int`, *optional*, defaults to 512):
    The number of input channels into the upsampling network.
upsample_rates (`tuple[int]` or `list[int]`, *optional*, defaults to `[4, 4, 4, 4]`):
    A tuple of integers defining the stride of each 1D convolutional layer in the upsampling network. The
    length of *upsample_rates* defines the number of convolutional layers and has to match the length of
    *upsample_kernel_sizes*.
upsample_kernel_sizes (`tuple[int]` or `list[int]`, *optional*, defaults to `[8, 8, 8, 8]`):
    A tuple of integers defining the kernel size of each 1D convolutional layer in the upsampling network. The
    length of *upsample_kernel_sizes* defines the number of convolutional layers and has to match the length of
    *upsample_rates*.
resblock_kernel_sizes (`tuple[int]` or `list[int]`, *optional*, defaults to `[3, 7, 11]`):
    A tuple of integers defining the kernel sizes of the 1D convolutional layers in the multi-receptive field
    fusion (MRF) module.
resblock_dilation_sizes (`tuple[tuple[int]]` or `list[list[int]]`, *optional*, defaults to `[[1, 3, 5], [1, 3, 5], [1, 3, 5]]`):
    A nested tuple of integers defining the dilation rates of the dilated 1D convolutional layers in the
    multi-receptive field fusion (MRF) module.
leaky_relu_slope (`float`, *optional*, defaults to 0.1):
    The angle of the negative slope used by the leaky ReLU activation.
normalize_before (`bool`, *optional*, defaults to `True`):
    Whether or not to normalize the spectrogram before vocoding using the vocoder's learned mean and variance.

Example:

```python
>>> from transformers import SpeechT5HifiGan, SpeechT5HifiGanConfig

>>> # Initializing a "microsoft/speecht5_hifigan" style configuration
>>> configuration = SpeechT5HifiGanConfig()

>>> # Initializing a model (with random weights) from the "microsoft/speecht5_hifigan" style configuration
>>> model = SpeechT5HifiGan(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```speecht5_hifiganrA   model_in_dimi>  sampling_rater)   upsample_initial_channel)   r   r   r   .upsample_rates)   r   r   r   upsample_kernel_sizes)r         resblock_kernel_sizes)r<   r   r+   r   r   resblock_dilation_sizesg{Gz?r"   r   leaky_relu_slopeTnormalize_beforerY   N)rp   rq   rr   rs   rt   ru   r   rw   rx   r   r   r   r|   r}   r   r   r   r"   ry   r   r   r{   r~   rY   rc   ra   r   r      s    %N $JL#M3$'c'2>NDIc3h/>9E49uS#X6E9C49uS#X6C,MTE\M#u#!e!!d!rc   r   )rt   rj   rl   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r	   r   __all__rY   rc   ra   <module>r      s    #   . 3 # 34AC% AC  5ACH 343", 3"  53"l 4
5rc   