






"""simple docstring"""


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


__SCREAMING_SNAKE_CASE   =   logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE   =   {
    's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json',
}




class 						__UpperCamelCase     (     SCREAMING_SNAKE_CASE__						):
					lowercase_    :				Dict      =  '''open-llama'''
					def __init__(							self							:	Any     , UpperCAmelCase							:	List[str]=10_0000     , UpperCAmelCase							:	Any=4096     , UpperCAmelCase							:	List[Any]=1_1008     , UpperCAmelCase							:	Union[str, Any]=32     , UpperCAmelCase							:	Tuple=32     , UpperCAmelCase							:	Any="silu"     , UpperCAmelCase							:	List[Any]=2048     , UpperCAmelCase							:	List[str]=0.0_2     , UpperCAmelCase							:	str=1e-6     , UpperCAmelCase							:	Optional[int]=True     , UpperCAmelCase							:	List[Any]=0     , UpperCAmelCase							:	int=1     , UpperCAmelCase							:	Tuple=2     , UpperCAmelCase							:	int=False     , UpperCAmelCase							:	Optional[Any]=True     , UpperCAmelCase							:	int=0.1     , UpperCAmelCase							:	Optional[Any]=0.1     , UpperCAmelCase							:	Optional[int]=True     , UpperCAmelCase							:	str=True     , UpperCAmelCase							:	Optional[int]=None     , **UpperCAmelCase							:	int     , )	->       Optional[Any]:
											lowerCAmelCase   :List[Any]						=			vocab_size
											lowerCAmelCase   :Optional[int]						=			max_position_embeddings
											lowerCAmelCase   :str						=			hidden_size
											lowerCAmelCase   :List[Any]						=			intermediate_size
											lowerCAmelCase   :Optional[int]						=			num_hidden_layers
											lowerCAmelCase   :str						=			num_attention_heads
											lowerCAmelCase   :Any						=			hidden_act
											lowerCAmelCase   :str						=			initializer_range
											lowerCAmelCase   :Union[str, Any]						=			rms_norm_eps
											lowerCAmelCase   :List[str]						=			use_cache
											lowerCAmelCase   :List[str]						=			kwargs.pop(
											    'use_memorry_efficient_attention'     , __lowerCAmelCase   )
											lowerCAmelCase   :Any						=			hidden_dropout_prob
											lowerCAmelCase   :Tuple						=			attention_dropout_prob
											lowerCAmelCase   :Optional[Any]						=			use_stable_embedding
											lowerCAmelCase   :Union[str, Any]						=			shared_input_output_embedding
											lowerCAmelCase   :str						=			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							:	List[str]   )	->       int:
											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}"""   )
											lowerCAmelCase   :Any						=			self.rope_scaling.get('type'     , __lowerCAmelCase   )
											lowerCAmelCase   :Optional[Any]						=			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}"""   )







'''simple docstring'''

# Lint as: python3
import itertools
import os
import re


UpperCamelCase      					=re.compile(R"([A-Z]+)([A-Z][a-z])")
UpperCamelCase      					=re.compile(R"([a-z\d])([A-Z])")

UpperCamelCase      					=re.compile(R"(?<!_)_(?!_)")
UpperCamelCase      					=re.compile(R"(_{2,})")

UpperCamelCase      					=R"^\w+(\.\w+)*$"

UpperCamelCase      					=R"<>:/\|?*"



def 				snake_case       (  a_				:			Union[str, Any]						)							->					List[Any]:





      """simple docstring"""

      UpperCamelCase_					: Tuple            =				_uppercase_uppercase_re.sub(r"""\1_\2"""     , a_						)
      UpperCamelCase_					: Any            =				_lowercase_uppercase_re.sub(r"""\1_\2"""     , a_						)
      return name.lower()



def 				snake_case       (  a_				:			str						)							->					Optional[int]:





      """simple docstring"""

      UpperCamelCase_					: Dict            =				_single_underscore_re.split(a_						)
      UpperCamelCase_					: Any            =				[_multiple_underscores_re.split(a_						) for n in name]
      return "".join(n.capitalize() for n in itertools.chain.from_iterable(a_						) if n != """"""						)



def 				snake_case       (  a_				:			str						)							->					List[Any]:





      """simple docstring"""

      if os.path.basename(a_						) != name:
            raise ValueError(f"Should be a dataset name, not a path: {name}"						)
      return camelcase_to_snakecase(a_						)



def 				snake_case       (  a_				:			int     , a_				:			List[Any]						)							->					List[Any]:





      """simple docstring"""

      if os.path.basename(a_						) != name:
            raise ValueError(f"Should be a dataset name, not a path: {name}"						)
      if not re.match(_split_re     , a_						):
            raise ValueError(f"Split name should match '{_split_re}'' but got '{split}'."						)
      return f"{filename_prefix_for_name(a_						)}-{split}"



def 				snake_case       (  a_				:			str     , a_				:			Optional[int]     , a_				:			List[Any]     , a_				:			Optional[int]=None						)							->					Tuple:





      """simple docstring"""

      UpperCamelCase_					: Tuple            =				filename_prefix_for_split(a_     , a_						)
      if filetype_suffix:
            prefix += f".{filetype_suffix}"
      UpperCamelCase_					: List[str]            =				os.path.join(a_     , a_						)
      return f"{filepath}*"



def 				snake_case       (  a_				:			List[Any]     , a_				:			Optional[int]     , a_				:			List[Any]     , a_				:			int=None     , a_				:			Dict=None						)							->					Any:





      """simple docstring"""

      UpperCamelCase_					: Union[str, Any]            =				filename_prefix_for_split(a_     , a_						)
      UpperCamelCase_					: Union[str, Any]            =				os.path.join(a_     , a_						)

      if shard_lengths:
            UpperCamelCase_					: List[Any]            =				len(a_						)
            UpperCamelCase_					: Optional[int]            =				[f"{prefix}-{shard_id:05d}-of-{num_shards:05d}" for shard_id in range(a_						)]
            if filetype_suffix:
                  UpperCamelCase_					: Tuple            =				[filename + f".{filetype_suffix}" for filename in filenames]
            return filenames
      else:
            UpperCamelCase_					: List[Any]            =				prefix
            if filetype_suffix:
                  filename += f".{filetype_suffix}"
            return [filename]






