




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


UpperCAmelCase__				     = logging.get_logger(__name__)

UpperCAmelCase__				     = {}







class a (     __SCREAMING_SNAKE_CASE  ):
						"""simple docstring"""

						UpperCamelCase_	:       Optional[Any]       	=		'llama'
						UpperCamelCase_	:       Dict       	=		['past_key_values']






						def __init__( self :     Union[str, Any]				,							lowerCamelCase__ :     Optional[Any]=32_000				,							lowerCamelCase__ :     List[Any]=4_096				,							lowerCamelCase__ :     Optional[int]=11_008				,							lowerCamelCase__ :     int=32				,							lowerCamelCase__ :     Tuple=32				,							lowerCamelCase__ :     Optional[Any]=None				,							lowerCamelCase__ :     List[str]="silu"				,							lowerCamelCase__ :     List[Any]=2_048				,							lowerCamelCase__ :     Optional[Any]=0.0_2				,							lowerCamelCase__ :     Dict=1e-6				,							lowerCamelCase__ :     int=True				,							lowerCamelCase__ :     Tuple=0				,							lowerCamelCase__ :     List[Any]=1				,							lowerCamelCase__ :     List[Any]=2				,							lowerCamelCase__ :     List[str]=1				,							lowerCamelCase__ :     Any=False				,							lowerCamelCase__ :     Optional[int]=None				,							**lowerCamelCase__ :     Dict				,							)    ->						Dict:
													"""simple docstring"""


													__lowercase      =    vocab_size
													__lowercase      =    max_position_embeddings
													__lowercase      =    hidden_size
													__lowercase      =    intermediate_size
													__lowercase      =    num_hidden_layers
													__lowercase      =    num_attention_heads

													# for backward compatibility
													if num_key_value_heads is None:
																				__lowercase      =    num_attention_heads

													__lowercase      =    num_key_value_heads
													__lowercase      =    hidden_act
													__lowercase      =    initializer_range
													__lowercase      =    rms_norm_eps
													__lowercase      =    pretraining_tp
													__lowercase      =    use_cache
													__lowercase      =    rope_scaling
													self._rope_scaling_validation()

													super().__init__(
													    pad_token_id=lowerCamelCase__				,							bos_token_id=lowerCamelCase__				,							eos_token_id=lowerCamelCase__				,							tie_word_embeddings=lowerCamelCase__				,							**lowerCamelCase__				,							)






						def     UpperCAmelCase_      ( self :     Optional[int]				)    ->						Union[str, Any]:
													"""simple docstring"""


													if self.rope_scaling is None:
																				return

													if not isinstance(self.rope_scaling				,							lowerCamelCase__				) or len(self.rope_scaling				) != 2:
																				raise ValueError(
																				    '''`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, '''
																				    f'got {self.rope_scaling}'				)
													__lowercase      =    self.rope_scaling.get('''type'''				,							lowerCamelCase__				)
													__lowercase      =    self.rope_scaling.get('''factor'''				,							lowerCamelCase__				)
													if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
																				raise ValueError(
																				    f'`rope_scaling`\'s name field must be one of [\'linear\', \'dynamic\'], got {rope_scaling_type}'				)
													if rope_scaling_factor is None or not isinstance(lowerCamelCase__				,							lowerCamelCase__				) or rope_scaling_factor <= 1.0:
																				raise ValueError(f'`rope_scaling`\'s factor field must be an float > 1, got {rope_scaling_factor}'				)












from typing import TYPE_CHECKING

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


UpperCAmelCase__				     = {
    "configuration_m2m_100": ["M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP", "M2M100Config", "M2M100OnnxConfig"],
    "tokenization_m2m_100": ["M2M100Tokenizer"],
}


try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			UpperCAmelCase__				     = [
			    "M2M_100_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "M2M100ForConditionalGeneration",
			    "M2M100Model",
			    "M2M100PreTrainedModel",
			]


if TYPE_CHECKING:
			from .configuration_mam_aaa import M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP, MaMaaaConfig, MaMaaaOnnxConfig
			from .tokenization_mam_aaa import MaMaaaTokenizer

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_mam_aaa import (
						    M2M_100_PRETRAINED_MODEL_ARCHIVE_LIST,
						    MaMaaaForConditionalGeneration,
						    MaMaaaModel,
						    MaMaaaPreTrainedModel,
						)


else:
			import sys

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






