

import functools
import operator

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowerCamelCase    :       Tuple        =							logging.get_logger(__name__)

_lowerCamelCase    :       List[str]        =							{
    "microsoft/unispeech-sat-base-100h-libri-ft": (
        "https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json"
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}





class  __UpperCAmelCase					(	lowerCamelCase__						):
   UpperCamelCase       					=					"""unispeech-sat"""



   def __init__(							self							:					Any,		__A							:					str=3_2,		__A							:					str=7_6_8,		__A							:					Union[str, Any]=1_2,		__A							:					str=1_2,		__A							:					Tuple=3_0_7_2,		__A							:					Optional[Any]="gelu",		__A							:					int=0.1,		__A							:					List[Any]=0.1,		__A							:					Union[str, Any]=0.1,		__A							:					Tuple=0.0,		__A							:					Union[str, Any]=0.0,		__A							:					Union[str, Any]=0.1,		__A							:					Union[str, Any]=0.1,		__A							:					str=0.0_2,		__A							:					Optional[int]=1E-5,		__A							:					List[Any]="group",		__A							:					str="gelu",		__A							:					Union[str, Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2),		__A							:					Optional[Any]=(5, 2, 2, 2, 2, 2, 2),		__A							:					Tuple=(1_0, 3, 3, 3, 3, 2, 2),		__A							:					List[str]=False,		__A							:					Tuple=1_2_8,		__A							:					Optional[int]=1_6,		__A							:					Any=False,		__A							:					List[Any]=True,		__A							:					Any=0.0_5,		__A							:					List[Any]=1_0,		__A							:					List[Any]=2,		__A							:					Optional[Any]=0.0,		__A							:					Optional[Any]=1_0,		__A							:					Dict=0,		__A							:					Optional[int]=3_2_0,		__A							:					Tuple=2,		__A							:					Any=0.1,		__A							:					Dict=1_0_0,		__A							:					Optional[int]=2_5_6,		__A							:					str=2_5_6,		__A							:					List[str]=0.1,		__A							:					List[str]="mean",		__A							:					Tuple=False,		__A							:					int=False,		__A							:					Dict=2_5_6,		__A							:					List[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0),		__A							:					Optional[Any]=(5, 3, 3, 1, 1),		__A							:					int=(1, 2, 3, 1, 1),		__A							:					Dict=5_1_2,		__A							:					Union[str, Any]=0,		__A							:					List[str]=1,		__A							:					Optional[Any]=2,		__A							:					Optional[int]=5_0_4,		**__A							:					int,		):
     super().__init__(**__A,		pad_token_id=__A,		bos_token_id=__A,		eos_token_id=__A						)
     UpperCAmelCase	:							List[Any]						=			hidden_size
     UpperCAmelCase	:							int						=			feat_extract_norm
     UpperCAmelCase	:							Any						=			feat_extract_activation
     UpperCAmelCase	:							int						=			list(__A						)
     UpperCAmelCase	:							str						=			list(__A						)
     UpperCAmelCase	:							Tuple						=			list(__A						)
     UpperCAmelCase	:							Optional[Any]						=			conv_bias
     UpperCAmelCase	:							List[Any]						=			num_conv_pos_embeddings
     UpperCAmelCase	:							List[str]						=			num_conv_pos_embedding_groups
     UpperCAmelCase	:							List[str]						=			len(self.conv_dim						)
     UpperCAmelCase	:							Optional[Any]						=			num_hidden_layers
     UpperCAmelCase	:							Optional[int]						=			intermediate_size
     UpperCAmelCase	:							Optional[int]						=			hidden_act
     UpperCAmelCase	:							List[Any]						=			num_attention_heads
     UpperCAmelCase	:							Optional[Any]						=			hidden_dropout
     UpperCAmelCase	:							List[str]						=			attention_dropout
     UpperCAmelCase	:							str						=			activation_dropout
     UpperCAmelCase	:							int						=			feat_proj_dropout
     UpperCAmelCase	:							Dict						=			final_dropout
     UpperCAmelCase	:							Optional[Any]						=			layerdrop
     UpperCAmelCase	:							str						=			layer_norm_eps
     UpperCAmelCase	:							Optional[int]						=			initializer_range
     UpperCAmelCase	:							str						=			vocab_size
     UpperCAmelCase	:							Dict						=			num_clusters
     UpperCAmelCase	:							Union[str, Any]						=			do_stable_layer_norm
     UpperCAmelCase	:							Dict						=			use_weighted_layer_sum

     if (
         (len(self.conv_stride						) != self.num_feat_extract_layers)
         or (len(self.conv_kernel						) != self.num_feat_extract_layers)
         or (len(self.conv_dim						) != self.num_feat_extract_layers)
     ):
       raise ValueError(
           '''Configuration 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) ='''
           F''' {len(self.conv_dim						)}`, `len(config.conv_stride) = {len(self.conv_stride						)}`,'''
           F''' `len(config.conv_kernel) = {len(self.conv_kernel						)}`.'''						)

     # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
     UpperCAmelCase	:							List[str]						=			apply_spec_augment
     UpperCAmelCase	:							Optional[int]						=			mask_time_prob
     UpperCAmelCase	:							int						=			mask_time_length
     UpperCAmelCase	:							Union[str, Any]						=			mask_time_min_masks
     UpperCAmelCase	:							Dict						=			mask_feature_prob
     UpperCAmelCase	:							List[Any]						=			mask_feature_length
     UpperCAmelCase	:							List[str]						=			mask_feature_min_masks

     # parameters for pretraining with codevector quantized representations
     UpperCAmelCase	:							List[Any]						=			num_codevectors_per_group
     UpperCAmelCase	:							Tuple						=			num_codevector_groups
     UpperCAmelCase	:							Tuple						=			contrastive_logits_temperature
     UpperCAmelCase	:							Any						=			feat_quantizer_dropout
     UpperCAmelCase	:							Optional[int]						=			num_negatives
     UpperCAmelCase	:							str						=			codevector_dim
     UpperCAmelCase	:							Dict						=			proj_codevector_dim
     UpperCAmelCase	:							Optional[Any]						=			diversity_loss_weight

     # ctc loss
     UpperCAmelCase	:							List[Any]						=			ctc_loss_reduction
     UpperCAmelCase	:							List[str]						=			ctc_zero_infinity

     # SequenceClassification-specific parameter. Feel free to ignore for other classes.
     UpperCAmelCase	:							List[str]						=			classifier_proj_size

     # XVector-specific parameters. Feel free to ignore for other classes.
     UpperCAmelCase	:							int						=			list(__A						)
     UpperCAmelCase	:							Dict						=			list(__A						)
     UpperCAmelCase	:							int						=			list(__A						)
     UpperCAmelCase	:							Union[str, Any]						=			xvector_output_dim





   @property
   def 	__magic_name__   (							self							:					str						):
     return functools.reduce(operator.mul,		self.conv_stride,		1						)








from math import log

from scipy.constants import Boltzmann, physical_constants

_lowerCamelCase    :       Tuple        =							3_0_0  # TEMPERATURE (unit = K)

def       a__					(		UpperCAmelCase							:      float    ,			UpperCAmelCase							:      float    ,			UpperCAmelCase							:      float    ,			)  ->						float:

  if donor_conc <= 0:
    raise ValueError('''Donor concentration should be positive'''      )
  elif acceptor_conc <= 0:
    raise ValueError('''Acceptor concentration should be positive'''      )
  elif intrinsic_conc <= 0:
    raise ValueError('''Intrinsic concentration should be positive'''      )
  elif donor_conc <= intrinsic_conc:
    raise ValueError(
        '''Donor concentration should be greater than intrinsic concentration'''      )
  elif acceptor_conc <= intrinsic_conc:
    raise ValueError(
        '''Acceptor concentration should be greater than intrinsic concentration'''      )
  else:
    return (
        Boltzmann
        * T
        * log((donor_conc * acceptor_conc) / intrinsic_conc**2      )
        / physical_constants["electron volt"][0]
    )


if __name__ == "__main__":
     import doctest

     doctest.testmod()





