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


lowerCamelCase_						: Optional[int]         =  logging.get_logger(__name__)

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

class        _UpperCamelCase				(					_A  ):
			__UpperCamelCase      :						Union[str, Any]					      = """nllb-moe"""
			__UpperCamelCase      :						List[str]					      = ["""past_key_values"""]
			__UpperCamelCase      :						List[Any]					      = {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}

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

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








# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCamelCase_						: List[str]         =  {
    """configuration_mgp_str""": ["""MGP_STR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MgpstrConfig"""],
    """processing_mgp_str""": ["""MgpstrProcessor"""],
    """tokenization_mgp_str""": ["""MgpstrTokenizer"""],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowerCamelCase_						: Optional[Any]         =  [
							    """MGP_STR_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """MgpstrModel""",
							    """MgpstrPreTrainedModel""",
							    """MgpstrForSceneTextRecognition""",
							]

if TYPE_CHECKING:
							from .configuration_mgp_str import MGP_STR_PRETRAINED_CONFIG_ARCHIVE_MAP, MgpstrConfig
							from .processing_mgp_str import MgpstrProcessor
							from .tokenization_mgp_str import MgpstrTokenizer

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_mgp_str import (
														    MGP_STR_PRETRAINED_MODEL_ARCHIVE_LIST,
														    MgpstrForSceneTextRecognition,
														    MgpstrModel,
														    MgpstrPreTrainedModel,
														)
else:
							import sys

							lowerCamelCase_						: int         =  _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






