





"""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


_UpperCamelCase							=      '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 				lowerCAmelCase_			(      ):


							'''simple docstring'''







							__lowerCamelCase      :      Optional[Any]         =_ask_options(
							    '''In which compute environment are you running?'''    ,						['''This machine''', '''AWS (Amazon SageMaker)''']    ,						_convert_compute_environment    ,						)
							if compute_environment == ComputeEnvironment.AMAZON_SAGEMAKER:
														__lowerCamelCase      :      Union[str, Any]         =get_sagemaker_input()
							else:
														__lowerCamelCase      :      Optional[Any]         =get_cluster_input()
							return config



def 				lowerCAmelCase_			(      SCREAMING_SNAKE_CASE=None   ):


							'''simple docstring'''







							if subparsers is not None:
														__lowerCamelCase      :      List[Any]         =subparsers.add_parser('''config'''    ,						description=SCREAMING_SNAKE_CASE   )
							else:
														__lowerCamelCase      :      Any         =argparse.ArgumentParser('''Accelerate config command'''    ,						description=SCREAMING_SNAKE_CASE   )

							parser.add_argument(
							    '''--config_file'''    ,						default=SCREAMING_SNAKE_CASE    ,						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=SCREAMING_SNAKE_CASE   )
							return parser



def 				lowerCAmelCase_			(      SCREAMING_SNAKE_CASE   ):


							'''simple docstring'''







							__lowerCamelCase      :      Union[str, Any]         =get_user_input()
							if args.config_file is not None:
														__lowerCamelCase      :      Tuple         =args.config_file
							else:
														if not os.path.isdir(SCREAMING_SNAKE_CASE   ):
																					os.makedirs(SCREAMING_SNAKE_CASE   )
														__lowerCamelCase      :      List[Any]         =default_yaml_config_file

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



def 				lowerCAmelCase_			(      ):


							'''simple docstring'''







							__lowerCamelCase      :      int         =config_command_parser()
							__lowerCamelCase      :      Optional[int]         =parser.parse_args()
							config_command(SCREAMING_SNAKE_CASE   )


if __name__ == "__main__":
							main()











"""simple docstring"""





import warnings

from ...utils import logging
from .image_processing_flava import FlavaImageProcessor


_UpperCamelCase							=      logging.get_logger(__name__)
class 		SCREAMING_SNAKE_CASE_							(    snake_case__   ):
				"""simple docstring"""




				def __init__(     self  :List[str]						,    *__lowercase  :int						,    **__lowercase  :Any			):
											warnings.warn(
											    '''The class FlavaFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'''
											    ''' use FlavaImageProcessor instead.'''						,    __lowercase						,    )
											super().__init__(*__lowercase						,    **__lowercase			)




