




'''simple docstring'''


import argparse
import os

from accelerate.utils import ComputeEnvironment

from .cluster import get_cluster_input
from .config_args import cache_dir, default_config_file, default_yaml_config_file, load_config_from_file  # noqa: F401
from .config_utils import _ask_field, _ask_options, _convert_compute_environment  # noqa: F401
from .sagemaker import get_sagemaker_input


lowercase_      :				Union[str, Any]   					=    '''Launches a series of prompts to create and save a `default_config.yaml` configuration file for your training system. Should always be ran first on your machine'''







def      SCREAMING_SNAKE_CASE				(				):
						lowercase        =							_ask_options(
						    """In which compute environment are you running?""" ,  ["""This machine""", """AWS (Amazon SageMaker)"""] ,  _convert_compute_environment ,  )
						if compute_environment == ComputeEnvironment.AMAZON_SAGEMAKER:
												lowercase        =							get_sagemaker_input()
						else:
												lowercase        =							get_cluster_input()
						return config







def      SCREAMING_SNAKE_CASE				(				lowercase_    :      List[Any]=None						):
						if subparsers is not None:
												lowercase        =							subparsers.add_parser("""config""" ,  description=lowerCamelCase_						)
						else:
												lowercase        =							argparse.ArgumentParser("""Accelerate config command""" ,  description=lowerCamelCase_						)

						parser.add_argument(
						    """--config_file""" ,  default=lowerCamelCase_ ,  help=(
						        """The path to use to store the config file. Will default to a file named default_config.yaml in the cache """
						        """location, which is the content of the environment `HF_HOME` suffixed with \'accelerate\', or if you don\'t have """
						        """such an environment variable, your cache directory (\'~/.cache\' or the content of `XDG_CACHE_HOME`) suffixed """
						        """with \'huggingface\'."""
						    ) ,  )

						if subparsers is not None:
												parser.set_defaults(func=lowerCamelCase_						)
						return parser







def      SCREAMING_SNAKE_CASE				(				lowercase_    :      str						):
						lowercase        =							get_user_input()
						if args.config_file is not None:
												lowercase        =							args.config_file
						else:
												if not os.path.isdir(lowerCamelCase_						):
																		os.makedirs(lowerCamelCase_						)
												lowercase        =							default_yaml_config_file

						if config_file.endswith(""".json"""						):
												config.to_json_file(lowerCamelCase_						)
						else:
												config.to_yaml_file(lowerCamelCase_						)
						print(F"""accelerate configuration saved at {config_file}"""						)







def      SCREAMING_SNAKE_CASE				(				):
						lowercase        =							config_command_parser()
						lowercase        =							parser.parse_args()
						config_command(lowerCamelCase_						)


if __name__ == "__main__":
						main()







'''simple docstring'''


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


lowercase_      :				Optional[Any]   					=    logging.get_logger(__name__)

lowercase_      :				int   					=    {
    '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json''',
}




class      __UpperCamelCase       (_UpperCAmelCase			):
	__A			  =					'''gpt_bigcode'''
	__A			  =					['''past_key_values''']
	__A			  =					{
	    '''hidden_size''': '''n_embd''',
	    '''max_position_embeddings''': '''n_positions''',
	    '''num_attention_heads''': '''n_head''',
	    '''num_hidden_layers''': '''n_layer''',
	}







	def __init__(    self ,				_lowerCAmelCase=5_0257 ,				_lowerCAmelCase=1024 ,				_lowerCAmelCase=768 ,				_lowerCAmelCase=12 ,				_lowerCAmelCase=12 ,				_lowerCAmelCase=None ,				_lowerCAmelCase="gelu_pytorch_tanh" ,				_lowerCAmelCase=0.1 ,				_lowerCAmelCase=0.1 ,				_lowerCAmelCase=0.1 ,				_lowerCAmelCase=1E-5 ,				_lowerCAmelCase=0.02 ,				_lowerCAmelCase=True ,				_lowerCAmelCase=True ,				_lowerCAmelCase=5_0256 ,				_lowerCAmelCase=5_0256 ,				_lowerCAmelCase=True ,				_lowerCAmelCase=True ,				_lowerCAmelCase=True ,				**_lowerCAmelCase ,				)    ->    Optional[int]:
							'''simple docstring'''






							lowercase        =							vocab_size
							lowercase        =							n_positions
							lowercase        =							n_embd
							lowercase        =							n_layer
							lowercase        =							n_head
							lowercase        =							n_inner
							lowercase        =							activation_function
							lowercase        =							resid_pdrop
							lowercase        =							embd_pdrop
							lowercase        =							attn_pdrop
							lowercase        =							layer_norm_epsilon
							lowercase        =							initializer_range
							lowercase        =							scale_attn_weights
							lowercase        =							use_cache
							lowercase        =							attention_softmax_in_fpaa
							lowercase        =							scale_attention_softmax_in_fpaa
							lowercase        =							multi_query

							lowercase        =							bos_token_id
							lowercase        =							eos_token_id

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


