

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


_UpperCAmelCase		:       Dict						    =	logging.get_logger(__name__)

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







class 			lowercase    (	lowercase_      ):
				__SCREAMING_SNAKE_CASE :			Union[str, Any]	      =      '''open-llama'''




				def __init__( self				,       snake_case=10_0000				,       snake_case=4096				,       snake_case=1_1008				,       snake_case=32				,       snake_case=32				,       snake_case="silu"				,       snake_case=2048				,       snake_case=0.02				,       snake_case=1e-6				,       snake_case=True				,       snake_case=0				,       snake_case=1				,       snake_case=2				,       snake_case=False				,       snake_case=True				,       snake_case=0.1				,       snake_case=0.1				,       snake_case=True				,       snake_case=True				,       snake_case=None				,       **snake_case				,       ):
											snake_case_          =   vocab_size
											snake_case_          =   max_position_embeddings
											snake_case_          =   hidden_size
											snake_case_          =   intermediate_size
											snake_case_          =   num_hidden_layers
											snake_case_          =   num_attention_heads
											snake_case_          =   hidden_act
											snake_case_          =   initializer_range
											snake_case_          =   rms_norm_eps
											snake_case_          =   use_cache
											snake_case_          =   kwargs.pop(
											    'use_memorry_efficient_attention'				,       snake_case	)
											snake_case_          =   hidden_dropout_prob
											snake_case_          =   attention_dropout_prob
											snake_case_          =   use_stable_embedding
											snake_case_          =   shared_input_output_embedding
											snake_case_          =   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	):
											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}'''	)
											snake_case_          =   self.rope_scaling.get('type'				,       snake_case	)
											snake_case_          =   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}'''	)







from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_UpperCAmelCase		:       int						    =	logging.get_logger(__name__)

_UpperCAmelCase		:       Optional[Any]						    =	{
    """junnyu/roformer_chinese_small""": """https://huggingface.co/junnyu/roformer_chinese_small/resolve/main/config.json""",
    """junnyu/roformer_chinese_base""": """https://huggingface.co/junnyu/roformer_chinese_base/resolve/main/config.json""",
    """junnyu/roformer_chinese_char_small""": (
        """https://huggingface.co/junnyu/roformer_chinese_char_small/resolve/main/config.json"""
    ),
    """junnyu/roformer_chinese_char_base""": (
        """https://huggingface.co/junnyu/roformer_chinese_char_base/resolve/main/config.json"""
    ),
    """junnyu/roformer_small_discriminator""": (
        """https://huggingface.co/junnyu/roformer_small_discriminator/resolve/main/config.json"""
    ),
    """junnyu/roformer_small_generator""": (
        """https://huggingface.co/junnyu/roformer_small_generator/resolve/main/config.json"""
    ),
    # See all RoFormer models at https://huggingface.co/models?filter=roformer
}







class 			lowercase    (	lowercase_      ):
				__SCREAMING_SNAKE_CASE :			List[Any]	      =      '''roformer'''




				def __init__( self				,       snake_case=5_0000				,       snake_case=None				,       snake_case=768				,       snake_case=12				,       snake_case=12				,       snake_case=3072				,       snake_case="gelu"				,       snake_case=0.1				,       snake_case=0.1				,       snake_case=1536				,       snake_case=2				,       snake_case=0.02				,       snake_case=1e-1_2				,       snake_case=0				,       snake_case=False				,       snake_case=True				,       **snake_case				,       ):
											super().__init__(pad_token_id=snake_case				,       **snake_case	)

											snake_case_          =   vocab_size
											snake_case_          =   hidden_size if embedding_size is None else embedding_size
											snake_case_          =   hidden_size
											snake_case_          =   num_hidden_layers
											snake_case_          =   num_attention_heads
											snake_case_          =   hidden_act
											snake_case_          =   intermediate_size
											snake_case_          =   hidden_dropout_prob
											snake_case_          =   attention_probs_dropout_prob
											snake_case_          =   max_position_embeddings
											snake_case_          =   type_vocab_size
											snake_case_          =   initializer_range
											snake_case_          =   layer_norm_eps
											snake_case_          =   rotary_value
											snake_case_          =   use_cache







class 			lowercase    (	lowercase_      ):




				@property
				def    a							( self	):
											if self.task == "multiple-choice":
																		snake_case_          =   {0: 'batch', 1: 'choice', 2: 'sequence'}
											else:
																		snake_case_          =   {0: 'batch', 1: 'sequence'}
											snake_case_          =   {0: 'batch', 1: 'sequence'}
											return OrderedDict(
											    [
											        ('input_ids', dynamic_axis),
											        ('attention_mask', dynamic_axis),
											        ('token_type_ids', dynamic_axis),
											    ]	)




