



"""simple docstring"""





import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


A   =       [
    """EAGER""",
    """AOT_EAGER""",
    """INDUCTOR""",
    """NVFUSER""",
    """AOT_NVFUSER""",
    """AOT_CUDAGRAPHS""",
    """OFI""",
    """FX2TRT""",
    """ONNXRT""",
    """IPEX""",
]

def 					_UpperCamelCase    (			UpperCamelCase				,       UpperCamelCase=None				,       UpperCamelCase=None				,       UpperCamelCase=None							)			->			Dict:


			"""simple docstring"""
			__UpperCAmelCase	: Union[str, Any]		=					True
			while ask_again:
						__UpperCAmelCase	: Dict		=					input(UpperCamelCase							)
						try:
									if default is not None and len(UpperCamelCase							) == 0:
												return default
									return convert_value(UpperCamelCase							) if convert_value is not None else result
						except Exception:
									if error_message is not None:
												print(UpperCamelCase							)

def 					_UpperCamelCase    (			UpperCamelCase				,       UpperCamelCase=[]				,       UpperCamelCase=None				,       UpperCamelCase=0							)			->			str:


			"""simple docstring"""
			__UpperCAmelCase	: Optional[Any]		=					BulletMenu(UpperCamelCase				,       UpperCamelCase							)
			__UpperCAmelCase	: str		=					menu.run(default_choice=UpperCamelCase							)
			return convert_value(UpperCamelCase							) if convert_value is not None else result

def 					_UpperCamelCase    (			UpperCamelCase							)			->			List[str]:


			"""simple docstring"""
			__UpperCAmelCase	: Optional[Any]		=					int(UpperCamelCase							)
			return ComputeEnvironment(["LOCAL_MACHINE", "AMAZON_SAGEMAKER"][value]							)

def 					_UpperCamelCase    (			UpperCamelCase							)			->			int:


			"""simple docstring"""
			__UpperCAmelCase	: Any		=					int(UpperCamelCase							)
			return DistributedType(["NO", "MULTI_CPU", "MULTI_XPU", "MULTI_GPU", "MULTI_NPU", "TPU"][value]							)

def 					_UpperCamelCase    (			UpperCamelCase							)			->			List[str]:


			"""simple docstring"""
			__UpperCAmelCase	: List[Any]		=					int(UpperCamelCase							)
			return DynamoBackend(DYNAMO_BACKENDS[value]							).value

def 					_UpperCamelCase    (			UpperCamelCase							)			->			List[str]:


			"""simple docstring"""
			__UpperCAmelCase	: str		=					int(UpperCamelCase							)
			return PrecisionType(["no", "fp16", "bf16", "fp8"][value]							)

def 					_UpperCamelCase    (			UpperCamelCase							)			->			int:


			"""simple docstring"""
			__UpperCAmelCase	: str		=					int(UpperCamelCase							)
			return SageMakerDistributedType(["NO", "DATA_PARALLEL", "MODEL_PARALLEL"][value]							)

def 					_UpperCamelCase    (			UpperCamelCase							)			->			Union[str, Any]:


			"""simple docstring"""
			return {"yes": True, "no": False}[value.lower()]





class      a__				(	argparse.RawDescriptionHelpFormatter   ):


			def       a_     (      self      :    Any      ,  UpperCamelCase_      :    Optional[Any]      ,  UpperCamelCase_      :    str      ,  UpperCamelCase_      :    str      ,  UpperCamelCase_      :    Tuple):


						"""simple docstring"""




						__UpperCAmelCase	: List[str]		=					super()._format_usage(UpperCamelCase_      ,  UpperCamelCase_      ,  UpperCamelCase_      ,  UpperCamelCase_)
						__UpperCAmelCase	: Optional[Any]		=					usage.replace("<command> [<args>] "      ,  "")
						return usage








"""simple docstring"""





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


A   =       logging.get_logger(__name__)

A   =       {
    """bigcode/gpt_bigcode-santacoder""": """https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json""",
}



class      a__				(	__magic_name__   ):
			lowercase_    =	"gpt_bigcode"
			lowercase_    =	["past_key_values"]
			lowercase_    =	{
			    "hidden_size": "n_embd",
			    "max_position_embeddings": "n_positions",
			    "num_attention_heads": "n_head",
			    "num_hidden_layers": "n_layer",
			}


			def __init__(      self      :    Any      ,  UpperCamelCase_      :    Tuple=50257      ,  UpperCamelCase_      :    Dict=1024      ,  UpperCamelCase_      :    Optional[Any]=768      ,  UpperCamelCase_      :    Optional[Any]=12      ,  UpperCamelCase_      :    Any=12      ,  UpperCamelCase_      :    Optional[int]=None      ,  UpperCamelCase_      :    List[Any]="gelu_pytorch_tanh"      ,  UpperCamelCase_      :    Optional[Any]=0.1      ,  UpperCamelCase_      :    Union[str, Any]=0.1      ,  UpperCamelCase_      :    Tuple=0.1      ,  UpperCamelCase_      :    Tuple=1e-5      ,  UpperCamelCase_      :    List[str]=0.02      ,  UpperCamelCase_      :    Dict=True      ,  UpperCamelCase_      :    Optional[int]=True      ,  UpperCamelCase_      :    str=50256      ,  UpperCamelCase_      :    Union[str, Any]=50256      ,  UpperCamelCase_      :    Dict=True      ,  UpperCamelCase_      :    List[str]=True      ,  UpperCamelCase_      :    Union[str, Any]=True      ,  **UpperCamelCase_      :    Union[str, Any]      ,  ):


						"""simple docstring"""




						__UpperCAmelCase	: Tuple		=					vocab_size
						__UpperCAmelCase	: Optional[int]		=					n_positions
						__UpperCAmelCase	: Tuple		=					n_embd
						__UpperCAmelCase	: str		=					n_layer
						__UpperCAmelCase	: Dict		=					n_head
						__UpperCAmelCase	: Optional[Any]		=					n_inner
						__UpperCAmelCase	: Optional[Any]		=					activation_function
						__UpperCAmelCase	: List[str]		=					resid_pdrop
						__UpperCAmelCase	: List[Any]		=					embd_pdrop
						__UpperCAmelCase	: Optional[Any]		=					attn_pdrop
						__UpperCAmelCase	: Dict		=					layer_norm_epsilon
						__UpperCAmelCase	: List[str]		=					initializer_range
						__UpperCAmelCase	: int		=					scale_attn_weights
						__UpperCAmelCase	: Tuple		=					use_cache
						__UpperCAmelCase	: List[Any]		=					attention_softmax_in_fpaa
						__UpperCAmelCase	: Any		=					scale_attention_softmax_in_fpaa
						__UpperCAmelCase	: str		=					multi_query

						__UpperCAmelCase	: int		=					bos_token_id
						__UpperCAmelCase	: str		=					eos_token_id

						super().__init__(bos_token_id=UpperCamelCase_      ,  eos_token_id=UpperCamelCase_      ,  **UpperCamelCase_)


