

'''simple docstring'''

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


UpperCAmelCase					 =	logging.get_logger(__name__)

UpperCAmelCase					 =	{}


class 	lowerCAmelCase  (   A ):
       lowerCAmelCase_												=			"llama"
       lowerCAmelCase_												=			["past_key_values"]







       def __init__(				self      :			List[str]    ,   __lowercase      :			Optional[Any]=32000    ,   __lowercase      :			str=4096    ,   __lowercase      :			Optional[Any]=11008    ,   __lowercase      :			Union[str, Any]=32    ,   __lowercase      :			str=32    ,   __lowercase      :			str=None    ,   __lowercase      :			int="silu"    ,   __lowercase      :			Any=2048    ,   __lowercase      :			List[Any]=0.0_2    ,   __lowercase      :			Dict=1E-6    ,   __lowercase      :			Any=True    ,   __lowercase      :			str=0    ,   __lowercase      :			Tuple=1    ,   __lowercase      :			List[str]=2    ,   __lowercase      :			Optional[int]=1    ,   __lowercase      :			List[Any]=False    ,   __lowercase      :			Union[str, Any]=None    ,   **__lowercase      :			Tuple    ,   ):







            """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=__lowercase    ,   bos_token_id=__lowercase    ,   eos_token_id=__lowercase    ,   tie_word_embeddings=__lowercase    ,   **__lowercase    ,   )







       def       snake_case (				self      :			Dict   ):







            """simple docstring"""







            if self.rope_scaling is None:
                 return

            if not isinstance(self.rope_scaling    ,   __lowercase   ) 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'    ,   __lowercase   )
            __lowercase      		=self.rope_scaling.get('factor'    ,   __lowercase   )
            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(__lowercase    ,   __lowercase   ) or rope_scaling_factor <= 1.0:
                 raise ValueError(f'''`rope_scaling`\'s factor field must be an float > 1, got {rope_scaling_factor}'''   )





'''simple docstring'''

def 					__UpperCamelCase				(						lowercase__    :	list[int]			):






     '''simple docstring'''





     if not nums:  # Makes sure that the list is not empty
          raise ValueError('List is empty'			)

     __lowercase      		=sum(lowercase__			) / len(lowercase__			)  # Calculate the average
     return sum(abs(x - average			) for x in nums			) / len(lowercase__			)


if __name__ == "__main__":
       import doctest

       doctest.testmod()


