






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


__UpperCAmelCase							:   Dict							=  logging.get_logger(__name__)

__UpperCAmelCase							:   List[str]							=  {
    "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json",
}


class 					_snake_case						(			_A ):
	_A          =   'open-llama'






	def __init__(		self					,UpperCamelCase=100_000					,UpperCamelCase=4_096					,UpperCamelCase=11_008					,UpperCamelCase=32					,UpperCamelCase=32					,UpperCamelCase="silu"					,UpperCamelCase=2_048					,UpperCamelCase=0.02					,UpperCamelCase=1E-6					,UpperCamelCase=True					,UpperCamelCase=0					,UpperCamelCase=1					,UpperCamelCase=2					,UpperCamelCase=False					,UpperCamelCase=True					,UpperCamelCase=0.1					,UpperCamelCase=0.1					,UpperCamelCase=True					,UpperCamelCase=True					,UpperCamelCase=None					,**UpperCamelCase					,)						->    str:
					snake_case__      :str         =   vocab_size
					snake_case__      :Union[str, Any]         =   max_position_embeddings
					snake_case__      :Union[str, Any]         =   hidden_size
					snake_case__      :str         =   intermediate_size
					snake_case__      :List[Any]         =   num_hidden_layers
					snake_case__      :Tuple         =   num_attention_heads
					snake_case__      :List[str]         =   hidden_act
					snake_case__      :str         =   initializer_range
					snake_case__      :Optional[Any]         =   rms_norm_eps
					snake_case__      :Union[str, Any]         =   use_cache
					snake_case__      :Optional[Any]         =   kwargs.pop(
					    "use_memorry_efficient_attention"					,UpperCamelCase       )
					snake_case__      :Optional[int]         =   hidden_dropout_prob
					snake_case__      :str         =   attention_dropout_prob
					snake_case__      :List[Any]         =   use_stable_embedding
					snake_case__      :Optional[int]         =   shared_input_output_embedding
					snake_case__      :Tuple         =   rope_scaling
					self._rope_scaling_validation()

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






	def    lowerCAmelCase_							(		self       )						->    Dict:
					if self.rope_scaling is None:
									return

					if not isinstance(self.rope_scaling					,UpperCamelCase       ) 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}'       )
					snake_case__      :int         =   self.rope_scaling.get("type"					,UpperCamelCase       )
					snake_case__      :List[Any]         =   self.rope_scaling.get("factor"					,UpperCamelCase       )
					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(UpperCamelCase					,UpperCamelCase       ) 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


__UpperCAmelCase							:   int							=  "__dummy_dataset1__"

__UpperCAmelCase							:   int							=  "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", \"validation\": REPO_URL + \"wikiann-bn-validation.jsonl\"}\n\n\nclass __DummyDataset1__(datasets.GeneratorBasedBuilder):\n\n    def _info(self):\n        features = datasets.Features(\n            {\n                \"tokens\": datasets.Sequence(datasets.Value(\"string\")),\n                \"ner_tags\": datasets.Sequence(\n                    datasets.features.ClassLabel(\n                        names=[\n                            \"O\",\n                            \"B-PER\",\n                            \"I-PER\",\n                            \"B-ORG\",\n                            \"I-ORG\",\n                            \"B-LOC\",\n                            \"I-LOC\",\n                        ]\n                    )\n                ),\n                \"langs\": datasets.Sequence(datasets.Value(\"string\")),\n                \"spans\": datasets.Sequence(datasets.Value(\"string\")),\n            }\n        )\n        return datasets.DatasetInfo(features=features)\n\n    def _split_generators(self, dl_manager):\n        dl_path = dl_manager.download(URLS)\n        return [\n            datasets.SplitGenerator(datasets.Split.TRAIN, gen_kwargs={\"filepath\": dl_path[\"train\"]}),\n            datasets.SplitGenerator(datasets.Split.VALIDATION, gen_kwargs={\"filepath\": dl_path[\"validation\"]}),\n        ]\n\n    def _generate_examples(self, filepath):\n        with open(filepath, \"r\", encoding=\"utf-8\") as f:\n            for i, line in enumerate(f):\n                yield i, json.loads(line)\n"





@pytest.fixture
def 					lowercase_ (    )     -> Optional[Any]:





				'''simple docstring'''


				return DATASET_LOADING_SCRIPT_NAME





@pytest.fixture
def 					lowercase_ (    )     -> Optional[int]:





				'''simple docstring'''


				return DATASET_LOADING_SCRIPT_CODE





@pytest.fixture
def 					lowercase_ (    __snake_case     :							Optional[int]	,	__snake_case     :							List[Any]	,	__snake_case     :							Any      )     -> Dict:





				'''simple docstring'''


				snake_case__      :Optional[Any]         =   dataset_loading_script_name
				snake_case__      :Optional[Any]         =   tmp_path / "datasets" / script_name
				script_dir.mkdir(parents=__snake_case      )
				snake_case__      :List[Any]         =   script_dir / F'{script_name}.py'
				with open(__snake_case	,	"w"      ) as f:
								f.write(__snake_case      )
				return str(__snake_case      )