





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


UpperCamelCase__											= logging.get_logger(__name__)

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

class        __SCREAMING_SNAKE_CASE					(     _a       ):
							snake_case     :      str						     =       """nllb-moe"""
							snake_case     :      str						     =       ["""past_key_values"""]
							snake_case     :      Tuple						     =       {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}






							def __init__(						self  , __lowerCAmelCase=128112  , __lowerCAmelCase=1024  , __lowerCAmelCase=12  , __lowerCAmelCase=4096  , __lowerCAmelCase=16  , __lowerCAmelCase=12  , __lowerCAmelCase=4096  , __lowerCAmelCase=16  , __lowerCAmelCase=0.05  , __lowerCAmelCase=0.05  , __lowerCAmelCase=True  , __lowerCAmelCase=True  , __lowerCAmelCase="relu"  , __lowerCAmelCase=1024  , __lowerCAmelCase=0.1  , __lowerCAmelCase=0.1  , __lowerCAmelCase=0.0  , __lowerCAmelCase=0.02  , __lowerCAmelCase=2  , __lowerCAmelCase=True  , __lowerCAmelCase=False  , __lowerCAmelCase="float32"  , __lowerCAmelCase=False  , __lowerCAmelCase=128  , __lowerCAmelCase=64  , __lowerCAmelCase=4  , __lowerCAmelCase=4  , __lowerCAmelCase=0.001  , __lowerCAmelCase=0.001  , __lowerCAmelCase="all"  , __lowerCAmelCase=False  , __lowerCAmelCase=False  , __lowerCAmelCase=1.0  , __lowerCAmelCase=0.2  , __lowerCAmelCase=1  , __lowerCAmelCase=0  , __lowerCAmelCase=2  , __lowerCAmelCase=False  , **__lowerCAmelCase  , ):
														UpperCamelCase__				     =			vocab_size
														UpperCamelCase__				     =			max_position_embeddings
														UpperCamelCase__				     =			d_model
														UpperCamelCase__				     =			encoder_ffn_dim
														UpperCamelCase__				     =			encoder_layers
														UpperCamelCase__				     =			encoder_attention_heads
														UpperCamelCase__				     =			decoder_ffn_dim
														UpperCamelCase__				     =			decoder_layers
														UpperCamelCase__				     =			decoder_attention_heads
														UpperCamelCase__				     =			dropout
														UpperCamelCase__				     =			attention_dropout
														UpperCamelCase__				     =			activation_dropout
														UpperCamelCase__				     =			activation_function
														UpperCamelCase__				     =			init_std
														UpperCamelCase__				     =			encoder_layerdrop
														UpperCamelCase__				     =			decoder_layerdrop
														UpperCamelCase__				     =			use_cache
														UpperCamelCase__				     =			encoder_layers
														UpperCamelCase__				     =			scale_embedding  # scale factor will be sqrt(d_model) if True
														UpperCamelCase__				     =			router_z_loss_coef
														UpperCamelCase__				     =			router_aux_loss_coef
														UpperCamelCase__				     =			decoder_sparse_step
														UpperCamelCase__				     =			encoder_sparse_step
														UpperCamelCase__				     =			num_experts
														UpperCamelCase__				     =			expert_capacity
														UpperCamelCase__				     =			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__				     =			router_dtype

														UpperCamelCase__				     =			router_ignore_padding_tokens
														UpperCamelCase__				     =			batch_prioritized_routing
														UpperCamelCase__				     =			second_expert_policy
														UpperCamelCase__				     =			normalize_router_prob_before_dropping
														UpperCamelCase__				     =			moe_eval_capacity_token_fraction
														UpperCamelCase__				     =			moe_token_dropout
														UpperCamelCase__				     =			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 TYPE_CHECKING

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


UpperCamelCase__											= {
    "configuration_pix2struct": [
        "PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Pix2StructConfig",
        "Pix2StructTextConfig",
        "Pix2StructVisionConfig",
    ],
    "processing_pix2struct": ["Pix2StructProcessor"],
}

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__											= ["Pix2StructImageProcessor"]


try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__											= [
					    "PIX2STRUCT_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "Pix2StructPreTrainedModel",
					    "Pix2StructForConditionalGeneration",
					    "Pix2StructVisionModel",
					    "Pix2StructTextModel",
					]

if TYPE_CHECKING:
					from .configuration_pixastruct import (
					    PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    PixaStructConfig,
					    PixaStructTextConfig,
					    PixaStructVisionConfig,
					)
					from .processing_pixastruct import PixaStructProcessor

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .image_processing_pixastruct import PixaStructImageProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_pixastruct import (
										    PIX2STRUCT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    PixaStructForConditionalGeneration,
										    PixaStructPreTrainedModel,
										    PixaStructTextModel,
										    PixaStructVisionModel,
										)

else:
					import sys

					UpperCamelCase__											= _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




