





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


lowerCAmelCase__     						=			logging.get_logger(__name__)

lowerCAmelCase__     						=			{
    "facebook/nllb-moe-54B": "https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json",
}
class     a_			(						a_						):






 '''simple docstring'''






 UpperCAmelCase_     			= "nllb-moe"
 UpperCAmelCase_     			= ["past_key_values"]
 UpperCAmelCase_     			= {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}




 def __init__(      self :  str      ,   lowercase__ :  Optional[int]=128_112      ,   lowercase__ :  Optional[int]=1_024      ,   lowercase__ :  List[str]=12      ,   lowercase__ :  Union[str, Any]=4_096      ,   lowercase__ :  Tuple=16      ,   lowercase__ :  Optional[Any]=12      ,   lowercase__ :  Optional[int]=4_096      ,   lowercase__ :  str=16      ,   lowercase__ :  Union[str, Any]=0.05      ,   lowercase__ :  Optional[Any]=0.05      ,   lowercase__ :  Any=True      ,   lowercase__ :  Dict=True      ,   lowercase__ :  List[Any]="relu"      ,   lowercase__ :  Optional[int]=1_024      ,   lowercase__ :  Any=0.1      ,   lowercase__ :  Union[str, Any]=0.1      ,   lowercase__ :  Optional[int]=0.0      ,   lowercase__ :  Optional[Any]=0.02      ,   lowercase__ :  Optional[int]=2      ,   lowercase__ :  str=True      ,   lowercase__ :  Dict=False      ,   lowercase__ :  List[str]="float32"      ,   lowercase__ :  List[str]=False      ,   lowercase__ :  Dict=128      ,   lowercase__ :  int=64      ,   lowercase__ :  Tuple=4      ,   lowercase__ :  int=4      ,   lowercase__ :  str=0.001      ,   lowercase__ :  int=0.001      ,   lowercase__ :  Any="all"      ,   lowercase__ :  Any=False      ,   lowercase__ :  Tuple=False      ,   lowercase__ :  Union[str, Any]=1.0      ,   lowercase__ :  Optional[Any]=0.2      ,   lowercase__ :  Dict=1      ,   lowercase__ :  Union[str, Any]=0      ,   lowercase__ :  Dict=2      ,   lowercase__ :  Tuple=False      ,   **lowercase__ :  str      ,   ):







        '''simple docstring'''



        lowerCAmelCase__					     = vocab_size
        lowerCAmelCase__					     = max_position_embeddings
        lowerCAmelCase__					     = d_model
        lowerCAmelCase__					     = encoder_ffn_dim
        lowerCAmelCase__					     = encoder_layers
        lowerCAmelCase__					     = encoder_attention_heads
        lowerCAmelCase__					     = decoder_ffn_dim
        lowerCAmelCase__					     = decoder_layers
        lowerCAmelCase__					     = decoder_attention_heads
        lowerCAmelCase__					     = dropout
        lowerCAmelCase__					     = attention_dropout
        lowerCAmelCase__					     = activation_dropout
        lowerCAmelCase__					     = activation_function
        lowerCAmelCase__					     = init_std
        lowerCAmelCase__					     = encoder_layerdrop
        lowerCAmelCase__					     = decoder_layerdrop
        lowerCAmelCase__					     = use_cache
        lowerCAmelCase__					     = encoder_layers
        lowerCAmelCase__					     = scale_embedding  # scale factor will be sqrt(d_model) if True
        lowerCAmelCase__					     = router_z_loss_coef
        lowerCAmelCase__					     = router_aux_loss_coef
        lowerCAmelCase__					     = decoder_sparse_step
        lowerCAmelCase__					     = encoder_sparse_step
        lowerCAmelCase__					     = num_experts
        lowerCAmelCase__					     = expert_capacity
        lowerCAmelCase__					     = router_bias
        if router_dtype not in ["float32", "float16", "bfloat16"]:
               raise ValueError(F"""`router_dtype` must be one of \'float32\', \'float16\' or \'bfloat16\', got {router_dtype}""")
        lowerCAmelCase__					     = router_dtype

        lowerCAmelCase__					     = router_ignore_padding_tokens
        lowerCAmelCase__					     = batch_prioritized_routing
        lowerCAmelCase__					     = second_expert_policy
        lowerCAmelCase__					     = normalize_router_prob_before_dropping
        lowerCAmelCase__					     = moe_eval_capacity_token_fraction
        lowerCAmelCase__					     = moe_token_dropout
        lowerCAmelCase__					     = output_router_logits
        super().__init__(
            pad_token_id=lowercase__      ,   bos_token_id=lowercase__      ,   eos_token_id=lowercase__      ,   is_encoder_decoder=lowercase__      ,   decoder_start_token_id=lowercase__      ,   **lowercase__      ,   )

from math import log

from scipy.constants import Boltzmann, physical_constants

lowerCAmelCase__     						=			300  # TEMPERATURE (unit = K)






def 				__lowerCamelCase		(						lowerCAmelCase__     ,  lowerCAmelCase__     ,  lowerCAmelCase__     ,  ):

       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()
