






# 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__			:    Optional[int]         =				[
    'EAGER',
    'AOT_EAGER',
    'INDUCTOR',
    'NVFUSER',
    'AOT_NVFUSER',
    'AOT_CUDAGRAPHS',
    'OFI',
    'FX2TRT',
    'ONNXRT',
    'IPEX',
]






def 						a    (		lowerCamelCase_	,     lowerCamelCase_=None	,     lowerCamelCase_=None	,     lowerCamelCase_=None       ):






				'''simple docstring'''
				lowercase__     				=    True
				while ask_again:
								lowercase__     				=    input(lowerCamelCase_       )
								try:
												if default is not None and len(lowerCamelCase_       ) == 0:
																return default
												return convert_value(lowerCamelCase_       ) if convert_value is not None else result
								except Exception:
												if error_message is not None:
																print(lowerCamelCase_       )






def 						a    (		lowerCamelCase_	,     lowerCamelCase_=[]	,     lowerCamelCase_=None	,     lowerCamelCase_=0       ):






				'''simple docstring'''
				lowercase__     				=    BulletMenu(lowerCamelCase_	,     lowerCamelCase_       )
				lowercase__     				=    menu.run(default_choice=lowerCamelCase_       )
				return convert_value(lowerCamelCase_       ) if convert_value is not None else result






def 						a    (		lowerCamelCase_       ):






				'''simple docstring'''
				lowercase__     				=    int(lowerCamelCase_       )
				return ComputeEnvironment(['''LOCAL_MACHINE''', '''AMAZON_SAGEMAKER'''][value]       )






def 						a    (		lowerCamelCase_       ):






				'''simple docstring'''
				lowercase__     				=    int(lowerCamelCase_       )
				return DistributedType(['''NO''', '''MULTI_CPU''', '''MULTI_XPU''', '''MULTI_GPU''', '''MULTI_NPU''', '''TPU'''][value]       )






def 						a    (		lowerCamelCase_       ):






				'''simple docstring'''
				lowercase__     				=    int(lowerCamelCase_       )
				return DynamoBackend(DYNAMO_BACKENDS[value]       ).value






def 						a    (		lowerCamelCase_       ):






				'''simple docstring'''
				lowercase__     				=    int(lowerCamelCase_       )
				return PrecisionType(['''no''', '''fp16''', '''bf16''', '''fp8'''][value]       )






def 						a    (		lowerCamelCase_       ):






				'''simple docstring'''
				lowercase__     				=    int(lowerCamelCase_       )
				return SageMakerDistributedType(['''NO''', '''DATA_PARALLEL''', '''MODEL_PARALLEL'''][value]       )






def 						a    (		lowerCamelCase_       ):






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




class    _UpperCAmelCase      ( argparse.RawDescriptionHelpFormatter			):

				"""simple docstring"""




				def        lowercase__     (  self		:					str,						lowerCamelCase		:					Union[str, Any],						lowerCamelCase		:					Any,						lowerCamelCase		:					Dict,						lowerCamelCase		:					int						):

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












from itertools import count






def 						a    (		lowerCamelCase_ = 50       ):






				'''simple docstring'''
				lowercase__     				=    [1] * min_block_length

				for n in count(lowerCamelCase_       ):
								fill_count_functions.append(1       )

								for block_length in range(lowerCamelCase_	,     n + 1       ):
												for block_start in range(n - block_length       ):
																fill_count_functions[n] += fill_count_functions[
																    n - block_start - block_length - 1
																]

												fill_count_functions[n] += 1

								if fill_count_functions[n] > 100_0000:
												break

				return n


if __name__ == "__main__":
							print(F"{solution() = }")




