




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


UpperCAmelCase_		:				Union[str, Any]									=     logging.get_logger(__name__)

UpperCAmelCase_		:				Any									=     {}




class 		__A      (			UpperCamelCase__			):
						UpperCamelCase     						=					"""llama"""
						UpperCamelCase     						=					["""past_key_values"""]

						def __init__(		self   :List[Any]    , __snake_case   :Optional[int]=3_20_00    , __snake_case   :Optional[int]=40_96    , __snake_case   :Optional[Any]=1_10_08    , __snake_case   :int=32    , __snake_case   :Any=32    , __snake_case   :str=None    , __snake_case   :int="silu"    , __snake_case   :Any=20_48    , __snake_case   :Optional[Any]=0.02    , __snake_case   :Optional[int]=1E-6    , __snake_case   :Dict=True    , __snake_case   :List[Any]=0    , __snake_case   :List[Any]=1    , __snake_case   :Tuple=2    , __snake_case   :Union[str, Any]=1    , __snake_case   :Dict=False    , __snake_case   :int=None    , **__snake_case   :Dict    , ):
										'''simple docstring'''

										__magic_name__	:	Optional[Any]								=vocab_size
										__magic_name__	:	Optional[int]								=max_position_embeddings
										__magic_name__	:	int								=hidden_size
										__magic_name__	:	Tuple								=intermediate_size
										__magic_name__	:	Tuple								=num_hidden_layers
										__magic_name__	:	List[str]								=num_attention_heads

										# for backward compatibility
										if num_key_value_heads is None:
														__magic_name__	:	Optional[int]								=num_attention_heads

										__magic_name__	:	List[str]								=num_key_value_heads
										__magic_name__	:	List[str]								=hidden_act
										__magic_name__	:	List[str]								=initializer_range
										__magic_name__	:	List[Any]								=rms_norm_eps
										__magic_name__	:	Any								=pretraining_tp
										__magic_name__	:	List[Any]								=use_cache
										__magic_name__	:	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   :Tuple ):
										'''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}" )
										__magic_name__	:	Tuple								=self.rope_scaling.get("""type"""    , __snake_case )
										__magic_name__	:	List[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}" )










import pytest

import datasets


# Import fixture modules as plugins
UpperCAmelCase_		:				Union[str, Any]									=     ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"]




def 		lowerCAmelCase_   (	lowerCamelCase	,     lowerCamelCase   ):
				# Mark tests as "unit" by default if not marked as "integration" (or already marked as "unit")
				for item in items:
								if any(marker in item.keywords for marker in ["""integration""", """unit"""]   ):
												continue
								item.add_marker(pytest.mark.unit   )




def 		lowerCAmelCase_   (	lowerCamelCase   ):
				config.addinivalue_line("""markers"""	,     """torchaudio_latest: mark test to run with torchaudio>=0.12"""   )




@pytest.fixture(autouse=lowerCamelCase   )
def 		lowerCAmelCase_   (	lowerCamelCase	,     lowerCamelCase   ):
				# test_hf_cache_home = tmp_path_factory.mktemp("cache")  # TODO: why a cache dir per test function does not work?
				__magic_name__	:	Tuple								=tmp_path_factory.getbasetemp() / """cache"""
				__magic_name__	:	Optional[int]								=test_hf_cache_home / """datasets"""
				__magic_name__	:	List[str]								=test_hf_cache_home / """metrics"""
				__magic_name__	:	List[str]								=test_hf_cache_home / """modules"""
				monkeypatch.setattr("""datasets.config.HF_DATASETS_CACHE"""	,     str(lowerCamelCase   )   )
				monkeypatch.setattr("""datasets.config.HF_METRICS_CACHE"""	,     str(lowerCamelCase   )   )
				monkeypatch.setattr("""datasets.config.HF_MODULES_CACHE"""	,     str(lowerCamelCase   )   )
				__magic_name__	:	Optional[Any]								=test_hf_datasets_cache / """downloads"""
				monkeypatch.setattr("""datasets.config.DOWNLOADED_DATASETS_PATH"""	,     str(lowerCamelCase   )   )
				__magic_name__	:	Tuple								=test_hf_datasets_cache / """downloads""" / """extracted"""
				monkeypatch.setattr("""datasets.config.EXTRACTED_DATASETS_PATH"""	,     str(lowerCamelCase   )   )




@pytest.fixture(autouse=lowerCamelCase	,     scope="""session"""   )
def 		lowerCAmelCase_   (	):
				datasets.disable_progress_bar()




@pytest.fixture(autouse=lowerCamelCase   )
def 		lowerCAmelCase_   (	lowerCamelCase   ):
				# don't take tests into account when counting downloads
				monkeypatch.setattr("""datasets.config.HF_UPDATE_DOWNLOAD_COUNTS"""	,     lowerCamelCase   )




@pytest.fixture
def 		lowerCAmelCase_   (	lowerCamelCase   ):
				# Required to suppress RemovedIn20Warning when feature(s) are not compatible with SQLAlchemy 2.0
				# To be removed once SQLAlchemy 2.0 supported
				monkeypatch.setattr("""sqlalchemy.util.deprecations.SILENCE_UBER_WARNING"""	,     lowerCamelCase   )




