"""simple docstring"""







import unittest
from dataclasses import dataclass

import pytest

from accelerate.commands.config.config_args import SageMakerConfig
from accelerate.utils import ComputeEnvironment
from accelerate.utils.launch import _convert_nargs_to_dict



@dataclass
class  _lowerCamelCase			(__lowerCamelCase     ):
				_snake_case     =  ComputeEnvironment.AMAZON_SAGEMAKER
				_snake_case     =  True
				_snake_case     =  "ml.p3.2xlarge"
				_snake_case     =  "accelerate_sagemaker_execution_role"
				_snake_case     =  "hf-sm"
				_snake_case     =  "us-east-1"
				_snake_case     =  1
				_snake_case     =  "accelerate-sagemaker-1"
				_snake_case     =  "1.6"
				_snake_case     =  "4.4"
				_snake_case     =  "train.py"
				_snake_case     =  [
				    "--model_name_or_path",
				    "bert",
				    "--do_train",
				    "False",
				    "--epochs",
				    "3",
				    "--learning_rate",
				    "5e-5",
				    "--max_steps",
				    "50.5",
				]
				_snake_case     =  [
				    "--model_name_or_path",
				    "bert",
				    "--do_train",
				    "--do_test",
				    "False",
				    "--do_predict",
				    "--epochs",
				    "3",
				    "--learning_rate",
				    "5e-5",
				    "--max_steps",
				    "50.5",
				]



class  _lowerCamelCase			(unittest.TestCase     ):







				def 							__UpperCAmelCase					( self    :       Union[str, Any]						):

					"""simple docstring"""






					_lowercase :    List[Any]							=							_convert_nargs_to_dict(MockLaunchConfig.success_training_script_args						)
					assert isinstance(converted_args['model_name_or_path']			,					lowerCamelCase_						)
					assert isinstance(converted_args['do_train']			,					lowerCamelCase_						)
					assert isinstance(converted_args['epochs']			,					lowerCamelCase_						)
					assert isinstance(converted_args['learning_rate']			,					lowerCamelCase_						)
					assert isinstance(converted_args['max_steps']			,					lowerCamelCase_						)

					with pytest.raises(lowerCamelCase_						):
						_convert_nargs_to_dict(MockLaunchConfig.fail_training_script_args						)




"""simple docstring"""







import math


def      __lowerCAmelCase(		__UpperCAmelCase			):






	"""simple docstring"""





	if not isinstance(__UpperCAmelCase     ,__UpperCAmelCase			):
		_lowercase :    List[Any]							=							F'''Input value of [number={number}] must be an integer'''
		raise TypeError(__UpperCAmelCase			)

	if number < 1:
		_lowercase :    List[Any]							=							F'''Input value of [number={number}] must be > 0'''
		raise ValueError(__UpperCAmelCase			)
	elif number == 1:
		return 3
	elif number == 2:
		return 5
	else:
		_lowercase :    str							=							int(math.log(number // 3     ,2			)			) + 2

		_lowercase :    Union[str, Any]							=							[3, 5]
		_lowercase :    Optional[int]							=							2
		_lowercase :    List[Any]							=							3
		for block in range(1     ,__UpperCAmelCase			):
			for _ in range(__UpperCAmelCase			):
				proth_list.append(2 ** (block + 1) + proth_list[proth_index - 1]			)
				proth_index += 1
			increment *= 2

	return proth_list[number - 1]


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						for number in range(11):
												SCREAMING_SNAKE_CASE									=						0
												try:
																		SCREAMING_SNAKE_CASE									=						proth(number)
												except ValueError:
																		print(f"""ValueError: there is no {number}th Proth number""")
																		continue

												print(f"""The {number}th Proth number: {value}""")



