



'''simple docstring'''

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


__lowerCAmelCase									=   logging.get_logger(__name__)

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

class 	__magic_name__						(    _UpperCamelCase   ):
							lowerCAmelCase       :    List[str]   				=					'open-llama'







							def __init__(							self					:       List[str]	,_UpperCAmelCase					:       str=100000	,_UpperCAmelCase					:       Optional[int]=4096	,_UpperCAmelCase					:       Dict=11008	,_UpperCAmelCase					:       Dict=32	,_UpperCAmelCase					:       Dict=32	,_UpperCAmelCase					:       int="silu"	,_UpperCAmelCase					:       Tuple=2048	,_UpperCAmelCase					:       Optional[int]=0.02	,_UpperCAmelCase					:       List[Any]=1E-6	,_UpperCAmelCase					:       int=True	,_UpperCAmelCase					:       int=0	,_UpperCAmelCase					:       List[str]=1	,_UpperCAmelCase					:       int=2	,_UpperCAmelCase					:       List[str]=False	,_UpperCAmelCase					:       List[str]=True	,_UpperCAmelCase					:       Dict=0.1	,_UpperCAmelCase					:       Any=0.1	,_UpperCAmelCase					:       Optional[Any]=True	,_UpperCAmelCase					:       Dict=True	,_UpperCAmelCase					:       Any=None	,**_UpperCAmelCase					:       Union[str, Any]	,):
									_a     :      str        =							vocab_size
									_a     :      Dict        =							max_position_embeddings
									_a     :      Tuple        =							hidden_size
									_a     :      Any        =							intermediate_size
									_a     :      Optional[int]        =							num_hidden_layers
									_a     :      Optional[Any]        =							num_attention_heads
									_a     :      Union[str, Any]        =							hidden_act
									_a     :      List[str]        =							initializer_range
									_a     :      List[str]        =							rms_norm_eps
									_a     :      str        =							use_cache
									_a     :      Tuple        =							kwargs.pop(
									    'use_memorry_efficient_attention'	,_UpperCAmelCase		)
									_a     :      Any        =							hidden_dropout_prob
									_a     :      str        =							attention_dropout_prob
									_a     :      List[str]        =							use_stable_embedding
									_a     :      Tuple        =							shared_input_output_embedding
									_a     :      List[Any]        =							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 							__lowercase			(							self					:       Optional[int]		):
									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}"""		)
									_a     :      Optional[Any]        =							self.rope_scaling.get('type'	,_UpperCAmelCase		)
									_a     :      List[str]        =							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}"""		)









'''simple docstring'''

import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


__lowerCAmelCase									=   logging.getLogger()

@unittest.skip('Temporarily disable the doc tests.'   )
@require_torch
@require_tf
@slow
class 	__magic_name__						(    unittest.TestCase   ):







							def 							__lowercase			(							self					:       str	,_UpperCAmelCase					:       Path	,_UpperCAmelCase					:       Union[str, None] = None	,_UpperCAmelCase					:       Union[List[str], None] = None	,_UpperCAmelCase					:       Union[str, List[str], None] = None	,_UpperCAmelCase					:       bool = True	,):
									_a     :      Dict        =							[file for file in os.listdir(_UpperCAmelCase		) if os.path.isfile(os.path.join(_UpperCAmelCase	,_UpperCAmelCase		)		)]

									if identifier is not None:
											_a     :      str        =							[file for file in files if identifier in file]

									if n_identifier is not None:
											if isinstance(_UpperCAmelCase	,_UpperCAmelCase		):
													for n_ in n_identifier:
															_a     :      int        =							[file for file in files if n_ not in file]
											else:
													_a     :      Optional[Any]        =							[file for file in files if n_identifier not in file]

									_a     :      Dict        =							ignore_files or []
									ignore_files.append('__init__.py'		)
									_a     :      List[str]        =							[file for file in files if file not in ignore_files]

									for file in files:
											# Open all files
											print('Testing'	,_UpperCAmelCase		)

											if only_modules:
													_a     :      Any        =							file.split('.'		)[0]
													try:
															_a     :      Optional[int]        =							getattr(_UpperCAmelCase	,_UpperCAmelCase		)
															_a     :      Dict        =							doctest.DocTestSuite(_UpperCAmelCase		)
															_a     :      Optional[int]        =							unittest.TextTestRunner().run(_UpperCAmelCase		)
															self.assertIs(len(result.failures		)	,0		)
													except AttributeError:
															logger.info(F"""{module_identifier} is not a module."""		)
											else:
													_a     :      str        =							doctest.testfile(str('..' / directory / file		)	,optionflags=doctest.ELLIPSIS		)
													self.assertIs(result.failed	,0		)







							def 							__lowercase			(							self					:       Union[str, Any]		):
									_a     :      Optional[Any]        =							Path('src/transformers'		)
									_a     :      Optional[Any]        =							'modeling'
									_a     :      Union[str, Any]        =							[
									    'modeling_ctrl.py',
									    'modeling_tf_ctrl.py',
									]
									self.analyze_directory(_UpperCAmelCase	,identifier=_UpperCAmelCase	,ignore_files=_UpperCAmelCase		)







							def 							__lowercase			(							self					:       int		):
									_a     :      str        =							Path('src/transformers'		)
									_a     :      List[str]        =							'tokenization'
									self.analyze_directory(_UpperCAmelCase	,identifier=_UpperCAmelCase		)







							def 							__lowercase			(							self					:       int		):
									_a     :      Any        =							Path('src/transformers'		)
									_a     :      str        =							'configuration'
									self.analyze_directory(_UpperCAmelCase	,identifier=_UpperCAmelCase		)







							def 							__lowercase			(							self					:       Dict		):
									_a     :      Tuple        =							Path('src/transformers'		)
									_a     :      Optional[int]        =							['configuration', 'modeling', 'tokenization']
									self.analyze_directory(_UpperCAmelCase	,n_identifier=_UpperCAmelCase		)







							def 							__lowercase			(							self					:       Optional[Any]		):
									_a     :      Union[str, Any]        =							Path('docs/source'		)
									_a     :      List[str]        =							['favicon.ico']
									self.analyze_directory(_UpperCAmelCase	,ignore_files=_UpperCAmelCase	,only_modules=_UpperCAmelCase		)




