






"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


snake_case : List[Any]     		=		logging.get_logger(__name__)

snake_case : Optional[Any]     		=		{
    """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""",
}



class        UpperCamelCase__ (				a_):







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







    def __init__(		self :	Optional[int]				,    UpperCamelCase_ :	Dict=1_2_8_1_1_2				,    UpperCamelCase_ :	List[str]=1_0_2_4				,    UpperCamelCase_ :	int=1_2				,    UpperCamelCase_ :	Any=4_0_9_6				,    UpperCamelCase_ :	List[str]=1_6				,    UpperCamelCase_ :	List[Any]=1_2				,    UpperCamelCase_ :	List[Any]=4_0_9_6				,    UpperCamelCase_ :	Any=1_6				,    UpperCamelCase_ :	Optional[Any]=0.05				,    UpperCamelCase_ :	List[Any]=0.05				,    UpperCamelCase_ :	Tuple=True				,    UpperCamelCase_ :	List[Any]=True				,    UpperCamelCase_ :	Tuple="relu"				,    UpperCamelCase_ :	Union[str, Any]=1_0_2_4				,    UpperCamelCase_ :	Optional[int]=0.1				,    UpperCamelCase_ :	str=0.1				,    UpperCamelCase_ :	int=0.0				,    UpperCamelCase_ :	Dict=0.02				,    UpperCamelCase_ :	str=2				,    UpperCamelCase_ :	Any=True				,    UpperCamelCase_ :	str=False				,    UpperCamelCase_ :	List[Any]="float32"				,    UpperCamelCase_ :	Any=False				,    UpperCamelCase_ :	int=1_2_8				,    UpperCamelCase_ :	Union[str, Any]=6_4				,    UpperCamelCase_ :	int=4				,    UpperCamelCase_ :	str=4				,    UpperCamelCase_ :	str=0.001				,    UpperCamelCase_ :	Any=0.001				,    UpperCamelCase_ :	List[Any]="all"				,    UpperCamelCase_ :	List[Any]=False				,    UpperCamelCase_ :	Tuple=False				,    UpperCamelCase_ :	Union[str, Any]=1.0				,    UpperCamelCase_ :	List[Any]=0.2				,    UpperCamelCase_ :	Optional[int]=1				,    UpperCamelCase_ :	Optional[int]=0				,    UpperCamelCase_ :	List[Any]=2				,    UpperCamelCase_ :	List[str]=False				,    **UpperCamelCase_ :	List[Any]				,    ):





           '''simple docstring'''

           __magic_name__      				=    vocab_size
           __magic_name__      				=    max_position_embeddings
           __magic_name__      				=    d_model
           __magic_name__      				=    encoder_ffn_dim
           __magic_name__      				=    encoder_layers
           __magic_name__      				=    encoder_attention_heads
           __magic_name__      				=    decoder_ffn_dim
           __magic_name__      				=    decoder_layers
           __magic_name__      				=    decoder_attention_heads
           __magic_name__      				=    dropout
           __magic_name__      				=    attention_dropout
           __magic_name__      				=    activation_dropout
           __magic_name__      				=    activation_function
           __magic_name__      				=    init_std
           __magic_name__      				=    encoder_layerdrop
           __magic_name__      				=    decoder_layerdrop
           __magic_name__      				=    use_cache
           __magic_name__      				=    encoder_layers
           __magic_name__      				=    scale_embedding  # scale factor will be sqrt(d_model) if True
           __magic_name__      				=    router_z_loss_coef
           __magic_name__      				=    router_aux_loss_coef
           __magic_name__      				=    decoder_sparse_step
           __magic_name__      				=    encoder_sparse_step
           __magic_name__      				=    num_experts
           __magic_name__      				=    expert_capacity
           __magic_name__      				=    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}""" )
           __magic_name__      				=    router_dtype

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







"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
)


snake_case : int     		=		{}

try:
 if not is_sentencepiece_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 snake_case : str     		=		["""NllbTokenizer"""]

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 snake_case : Dict     		=		["""NllbTokenizerFast"""]


if TYPE_CHECKING:
 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_nllb import NllbTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_nllb_fast import NllbTokenizerFast

else:
 import sys

 snake_case : Dict     		=		_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)