






'''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_       (     _a					):




      """simple docstring"""




      UpperCamelCase_             =      '''open-llama'''






      def __init__(			self      :		str  ,   UpperCAmelCase      :		Dict=10_0000  ,   UpperCAmelCase      :		Optional[Any]=4096  ,   UpperCAmelCase      :		int=1_1008  ,   UpperCAmelCase      :		Union[str, Any]=32  ,   UpperCAmelCase      :		Tuple=32  ,   UpperCAmelCase      :		str="silu"  ,   UpperCAmelCase      :		Union[str, Any]=2048  ,   UpperCAmelCase      :		Optional[Any]=0.0_2  ,   UpperCAmelCase      :		Any=1e-6  ,   UpperCAmelCase      :		int=True  ,   UpperCAmelCase      :		List[str]=0  ,   UpperCAmelCase      :		int=1  ,   UpperCAmelCase      :		str=2  ,   UpperCAmelCase      :		List[str]=False  ,   UpperCAmelCase      :		Optional[Any]=True  ,   UpperCAmelCase      :		Optional[int]=0.1  ,   UpperCAmelCase      :		List[Any]=0.1  ,   UpperCAmelCase      :		Any=True  ,   UpperCAmelCase      :		int=True  ,   UpperCAmelCase      :		Tuple=None  ,   **UpperCAmelCase      :		Union[str, Any]  ,   )	->	str:


       '''simple docstring'''

       lowercase       : int						=vocab_size
       lowercase       : Dict						=max_position_embeddings
       lowercase       : Tuple						=hidden_size
       lowercase       : Any						=intermediate_size
       lowercase       : Optional[Any]						=num_hidden_layers
       lowercase       : Dict						=num_attention_heads
       lowercase       : str						=hidden_act
       lowercase       : Optional[Any]						=initializer_range
       lowercase       : List[Any]						=rms_norm_eps
       lowercase       : Union[str, Any]						=use_cache
       lowercase       : Optional[Any]						=kwargs.pop(
           '''use_memorry_efficient_attention'''  ,   snake_case_		)
       lowercase       : str						=hidden_dropout_prob
       lowercase       : Tuple						=attention_dropout_prob
       lowercase       : Union[str, Any]						=use_stable_embedding
       lowercase       : Union[str, Any]						=shared_input_output_embedding
       lowercase       : Union[str, Any]						=rope_scaling
       self._rope_scaling_validation()

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






      def 					A__   (			self      :		Optional[Any]		)	->	Any:


       '''simple docstring'''

       if self.rope_scaling is None:
        return

       if not isinstance(self.rope_scaling  ,   snake_case_		) 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       : Optional[Any]						=self.rope_scaling.get('''type'''  ,   snake_case_		)
       lowercase       : str						=self.rope_scaling.get('''factor'''  ,   snake_case_		)
       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(snake_case_  ,   snake_case_		) 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'''





import importlib
import shutil
import threading
import warnings
from typing import List

import fsspec
import fsspec.asyn

from . import compression
from .hffilesystem import HfFileSystem


__a  			=						importlib.util.find_spec("s3fs") is not None

if _has_safs:
       from .safilesystem import SaFileSystem  # noqa: F401

__a  			=						[
    compression.BzaFileSystem,
    compression.GzipFileSystem,
    compression.LzaFileSystem,
    compression.XzFileSystem,
    compression.ZstdFileSystem,
]

# Register custom filesystems
for fs_class in COMPRESSION_FILESYSTEMS + [HfFileSystem]:
       if fs_class.protocol in fsspec.registry and fsspec.registry[fs_class.protocol] is not fs_class:
              warnings.warn(F"A filesystem protocol was already set for {fs_class.protocol} and will be overwritten.")
       fsspec.register_implementation(fs_class.protocol, fs_class, clobber=True)





def 		__snake_case(							_lowerCAmelCase						)						->					str:
      if "://" in dataset_path:
            snake_case__    :       Tuple       		= dataset_path.split("""://"""						)[1]
      return dataset_path





def 		__snake_case(							_lowerCAmelCase						)						->					bool:
      if fs is not None and fs.protocol != "file":
            return True
      else:
            return False





def 		__snake_case(							_lowerCAmelCase	,  _lowerCAmelCase	,  _lowerCAmelCase						)						->					Optional[int]:
      snake_case__    :       int       		= not is_remote_filesystem(_lowerCAmelCase						)
      if is_local:
            # LocalFileSystem.mv does copy + rm, it is more efficient to simply move a local directory
            shutil.move(fs._strip_protocol(_lowerCAmelCase						)	,  fs._strip_protocol(_lowerCAmelCase						)						)
      else:
            fs.mv(_lowerCAmelCase	,  _lowerCAmelCase	,  recursive=_lowerCAmelCase						)





def 		__snake_case(							)						->					None:
      if hasattr(fsspec.asyn	,  """reset_lock"""						):
            # for future fsspec>2022.05.0
            fsspec.asyn.reset_lock()
      else:
            snake_case__    :       Dict       		= None
            snake_case__    :       List[str]       		= None
            snake_case__    :       Union[str, Any]       		= threading.Lock()
