




'''simple docstring'''


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


_snake_case : str  				=						logging.get_logger(__name__)

_snake_case : Tuple  				=						{
    """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""",
}

class      A       (						__lowercase       ):
							lowercase_							     =							'''nllb-moe'''
							lowercase_							     =							['''past_key_values''']
							lowercase_							     =							{'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}







							def __init__(    self			:    int				,     lowerCAmelCase_			:    Optional[int]=12_81_12				,     lowerCAmelCase_			:    Optional[int]=10_24				,     lowerCAmelCase_			:    Union[str, Any]=12				,     lowerCAmelCase_			:    str=40_96				,     lowerCAmelCase_			:    List[Any]=16				,     lowerCAmelCase_			:    Tuple=12				,     lowerCAmelCase_			:    List[str]=40_96				,     lowerCAmelCase_			:    Any=16				,     lowerCAmelCase_			:    Dict=0.0_5				,     lowerCAmelCase_			:    Tuple=0.0_5				,     lowerCAmelCase_			:    Tuple=True				,     lowerCAmelCase_			:    int=True				,     lowerCAmelCase_			:    List[str]="relu"				,     lowerCAmelCase_			:    List[Any]=10_24				,     lowerCAmelCase_			:    Any=0.1				,     lowerCAmelCase_			:    int=0.1				,     lowerCAmelCase_			:    int=0.0				,     lowerCAmelCase_			:    Tuple=0.0_2				,     lowerCAmelCase_			:    List[str]=2				,     lowerCAmelCase_			:    Optional[Any]=True				,     lowerCAmelCase_			:    Dict=False				,     lowerCAmelCase_			:    Any="float32"				,     lowerCAmelCase_			:    List[Any]=False				,     lowerCAmelCase_			:    List[Any]=1_28				,     lowerCAmelCase_			:    str=64				,     lowerCAmelCase_			:    Dict=4				,     lowerCAmelCase_			:    Tuple=4				,     lowerCAmelCase_			:    Union[str, Any]=0.0_0_1				,     lowerCAmelCase_			:    Union[str, Any]=0.0_0_1				,     lowerCAmelCase_			:    Union[str, Any]="all"				,     lowerCAmelCase_			:    List[Any]=False				,     lowerCAmelCase_			:    Optional[Any]=False				,     lowerCAmelCase_			:    Optional[int]=1.0				,     lowerCAmelCase_			:    List[str]=0.2				,     lowerCAmelCase_			:    Any=1				,     lowerCAmelCase_			:    Union[str, Any]=0				,     lowerCAmelCase_			:    Optional[Any]=2				,     lowerCAmelCase_			:    List[str]=False				,     **lowerCAmelCase_			:    List[Any]				,     )     ->				Dict:


														"""simple docstring"""


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

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








from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream





class 				a			(      __lowercase			):






				def __init__(  self			, _lowerCAmelCase			, _lowerCAmelCase = None			, _lowerCAmelCase = None			, _lowerCAmelCase = False			, _lowerCAmelCase = False			, _lowerCAmelCase = None			, _lowerCAmelCase = None			, **_lowerCAmelCase			, ):

										"""simple docstring"""




										super().__init__(
										    features=_lowerCAmelCase			, cache_dir=_lowerCAmelCase			, keep_in_memory=_lowerCAmelCase			, streaming=_lowerCAmelCase			, num_proc=_lowerCAmelCase			, **_lowerCAmelCase			, )
										__SCREAMING_SNAKE_CASE:				Any           =   Generator(
										    cache_dir=_lowerCAmelCase			, features=_lowerCAmelCase			, generator=_lowerCAmelCase			, gen_kwargs=_lowerCAmelCase			, **_lowerCAmelCase			, )






				def 			snake_case_    (  self					):

										"""simple docstring"""




										if self.streaming:
																__SCREAMING_SNAKE_CASE:				List[str]           =   self.builder.as_streaming_dataset(split='''train'''					)
										# Build regular (map-style) dataset
										else:
																__SCREAMING_SNAKE_CASE:				str           =   None
																__SCREAMING_SNAKE_CASE:				List[Any]           =   None
																__SCREAMING_SNAKE_CASE:				Tuple           =   None
																__SCREAMING_SNAKE_CASE:				Optional[Any]           =   None

																self.builder.download_and_prepare(
																    download_config=_lowerCAmelCase			, download_mode=_lowerCAmelCase			, verification_mode=_lowerCAmelCase			, base_path=_lowerCAmelCase			, num_proc=self.num_proc			, )
																__SCREAMING_SNAKE_CASE:				List[str]           =   self.builder.as_dataset(
																    split='''train'''			, verification_mode=_lowerCAmelCase			, in_memory=self.keep_in_memory					)
										return dataset



