




# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

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 			lowerCamelCase_		(       UpperCamelCase__				:      str ,     UpperCamelCase__				:      int=None ,     UpperCamelCase__				:      List[str]=None ,     UpperCamelCase__				:      Tuple=None      )     ->       Optional[int]:





				"""simple docstring"""


				__lowerCamelCase		       =    True
				while ask_again:
								__lowerCamelCase		       =    input(__snake_case      )
								try:
												if default is not None and len(__snake_case      ) == 0:
																return default
												return convert_value(__snake_case      ) if convert_value is not None else result
								except Exception:
												if error_message is not None:
																print(__snake_case      )







def 			lowerCamelCase_		(       UpperCamelCase__				:      Tuple ,     UpperCamelCase__				:      Tuple=[] ,     UpperCamelCase__				:      List[str]=None ,     UpperCamelCase__				:      List[str]=0      )     ->       List[str]:





				"""simple docstring"""


				__lowerCamelCase		       =    BulletMenu(__snake_case ,     __snake_case      )
				__lowerCamelCase		       =    menu.run(default_choice=__snake_case      )
				return convert_value(__snake_case      ) if convert_value is not None else result







def 			lowerCamelCase_		(       UpperCamelCase__				:      Optional[Any]      )     ->       List[Any]:





				"""simple docstring"""


				__lowerCamelCase		       =    int(__snake_case      )
				return ComputeEnvironment(['LOCAL_MACHINE', 'AMAZON_SAGEMAKER'][value]      )







def 			lowerCamelCase_		(       UpperCamelCase__				:      Optional[int]      )     ->       Optional[Any]:





				"""simple docstring"""


				__lowerCamelCase		       =    int(__snake_case      )
				return DistributedType(['NO', 'MULTI_CPU', 'MULTI_XPU', 'MULTI_GPU', 'MULTI_NPU', 'TPU'][value]      )







def 			lowerCamelCase_		(       UpperCamelCase__				:      str      )     ->       Dict:





				"""simple docstring"""


				__lowerCamelCase		       =    int(__snake_case      )
				return DynamoBackend(DYNAMO_BACKENDS[value]      ).value







def 			lowerCamelCase_		(       UpperCamelCase__				:      Any      )     ->       List[str]:





				"""simple docstring"""


				__lowerCamelCase		       =    int(__snake_case      )
				return PrecisionType(['no', 'fp16', 'bf16', 'fp8'][value]      )







def 			lowerCamelCase_		(       UpperCamelCase__				:      List[Any]      )     ->       Optional[int]:





				"""simple docstring"""


				__lowerCamelCase		       =    int(__snake_case      )
				return SageMakerDistributedType(['NO', 'DATA_PARALLEL', 'MODEL_PARALLEL'][value]      )







def 			lowerCamelCase_		(       UpperCamelCase__				:      Tuple      )     ->       Dict:





				"""simple docstring"""


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







class     __lowerCAmelCase (       argparse.RawDescriptionHelpFormatter ):

			"""simple docstring"""







			def       lowercase_    (      self			,						lowerCamelCase__			,						lowerCamelCase__			,						lowerCamelCase__			,						lowerCamelCase__							)    ->      Union[str, Any]:



							'''simple docstring'''
							__lowerCamelCase		       =    super()._format_usage(_UpperCamelCase			,						_UpperCamelCase			,						_UpperCamelCase			,						_UpperCamelCase							)
							__lowerCamelCase		       =    usage.replace('<command> [<args>] '			,						''							)
							return usage










import warnings

from ...utils import logging
from .image_processing_imagegpt import ImageGPTImageProcessor


__UpperCAmelCase								=						logging.get_logger(__name__)



class   lowerCamelCase      (_snake_case			):







		'''simple docstring'''



		def __init__(							self				,		*_UpperCamelCase				,		**_UpperCamelCase   )	->							None:
							warnings.warn(
							    'The class ImageGPTFeatureExtractor is deprecated and will be removed in version 5 of Transformers.'
							    ' Please use ImageGPTImageProcessor instead.'				,		_UpperCamelCase				,		)
							super().__init__(*_UpperCamelCase				,		**_UpperCamelCase   )






