



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


__a      =				logging.get_logger(__name__)

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






					'''simple docstring'''





					_A		:			Optional[int]						=     """nllb-moe"""
					_A		:			List[str]						=     ["""past_key_values"""]
					_A		:			List[Any]						=     {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}






					def __init__(       self:							Union[str, Any]						,     snake_case:							str=128_112						,     snake_case:							Optional[int]=1_024						,     snake_case:							str=12						,     snake_case:							Union[str, Any]=4_096						,     snake_case:							Dict=16						,     snake_case:							Tuple=12						,     snake_case:							Union[str, Any]=4_096						,     snake_case:							str=16						,     snake_case:							Dict=0.0_5						,     snake_case:							Any=0.0_5						,     snake_case:							str=True						,     snake_case:							Any=True						,     snake_case:							Any="relu"						,     snake_case:							Dict=1_024						,     snake_case:							List[Any]=0.1						,     snake_case:							Union[str, Any]=0.1						,     snake_case:							Optional[Any]=0.0						,     snake_case:							str=0.0_2						,     snake_case:							int=2						,     snake_case:							List[str]=True						,     snake_case:							str=False						,     snake_case:							Optional[Any]="float32"						,     snake_case:							int=False						,     snake_case:							Optional[Any]=128						,     snake_case:							Any=64						,     snake_case:							List[Any]=4						,     snake_case:							str=4						,     snake_case:							int=0.0_0_1						,     snake_case:							Optional[Any]=0.0_0_1						,     snake_case:							List[Any]="all"						,     snake_case:							Dict=False						,     snake_case:							Any=False						,     snake_case:							Dict=1.0						,     snake_case:							Optional[Any]=0.2						,     snake_case:							Any=1						,     snake_case:							Tuple=0						,     snake_case:							Any=2						,     snake_case:							str=False						,     **snake_case:							Optional[Any]						,     )   ->	int:
											snake_case_ :List[Any]						=			vocab_size
											snake_case_ :List[Any]						=			max_position_embeddings
											snake_case_ :Any						=			d_model
											snake_case_ :Tuple						=			encoder_ffn_dim
											snake_case_ :Tuple						=			encoder_layers
											snake_case_ :List[str]						=			encoder_attention_heads
											snake_case_ :List[Any]						=			decoder_ffn_dim
											snake_case_ :Optional[Any]						=			decoder_layers
											snake_case_ :Optional[Any]						=			decoder_attention_heads
											snake_case_ :Tuple						=			dropout
											snake_case_ :List[str]						=			attention_dropout
											snake_case_ :Union[str, Any]						=			activation_dropout
											snake_case_ :Tuple						=			activation_function
											snake_case_ :Optional[int]						=			init_std
											snake_case_ :Union[str, Any]						=			encoder_layerdrop
											snake_case_ :int						=			decoder_layerdrop
											snake_case_ :Dict						=			use_cache
											snake_case_ :Optional[int]						=			encoder_layers
											snake_case_ :List[Any]						=			scale_embedding  # scale factor will be sqrt(d_model) if True
											snake_case_ :int						=			router_z_loss_coef
											snake_case_ :Tuple						=			router_aux_loss_coef
											snake_case_ :Tuple						=			decoder_sparse_step
											snake_case_ :str						=			encoder_sparse_step
											snake_case_ :Optional[Any]						=			num_experts
											snake_case_ :Union[str, Any]						=			expert_capacity
											snake_case_ :Dict						=			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}"""						)
											snake_case_ :Any						=			router_dtype

											snake_case_ :List[str]						=			router_ignore_padding_tokens
											snake_case_ :Optional[int]						=			batch_prioritized_routing
											snake_case_ :Optional[int]						=			second_expert_policy
											snake_case_ :str						=			normalize_router_prob_before_dropping
											snake_case_ :Optional[int]						=			moe_eval_capacity_token_fraction
											snake_case_ :Tuple						=			moe_token_dropout
											snake_case_ :Optional[int]						=			output_router_logits
											super().__init__(
											    pad_token_id=snake_case						,     bos_token_id=snake_case						,     eos_token_id=snake_case						,     is_encoder_decoder=snake_case						,     decoder_start_token_id=snake_case						,     **snake_case						,     )


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__lowerCAmelCase			:     List[str]           =   {
    'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'],
    'tokenization_xlm': ['XLMTokenizer'],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCAmelCase			:     str           =   [
        'XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
        'XLMForMultipleChoice',
        'XLMForQuestionAnswering',
        'XLMForQuestionAnsweringSimple',
        'XLMForSequenceClassification',
        'XLMForTokenClassification',
        'XLMModel',
        'XLMPreTrainedModel',
        'XLMWithLMHeadModel',
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCAmelCase			:     Dict           =   [
        'TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
        'TFXLMForMultipleChoice',
        'TFXLMForQuestionAnsweringSimple',
        'TFXLMForSequenceClassification',
        'TFXLMForTokenClassification',
        'TFXLMMainLayer',
        'TFXLMModel',
        'TFXLMPreTrainedModel',
        'TFXLMWithLMHeadModel',
    ]


if TYPE_CHECKING:
    from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig, XLMOnnxConfig
    from .tokenization_xlm import XLMTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_xlm import (
            XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
            XLMForMultipleChoice,
            XLMForQuestionAnswering,
            XLMForQuestionAnsweringSimple,
            XLMForSequenceClassification,
            XLMForTokenClassification,
            XLMModel,
            XLMPreTrainedModel,
            XLMWithLMHeadModel,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_xlm import (
            TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFXLMForMultipleChoice,
            TFXLMForQuestionAnsweringSimple,
            TFXLMForSequenceClassification,
            TFXLMForTokenClassification,
            TFXLMMainLayer,
            TFXLMModel,
            TFXLMPreTrainedModel,
            TFXLMWithLMHeadModel,
        )

else:
    import sys

    __lowerCAmelCase			:     Any           =   _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

