


import inspect
import os
import unittest
from pathlib import Path

import torch

import accelerate
from accelerate.test_utils import execute_subprocess_async
from accelerate.test_utils.testing import run_command






class      UpperCamelCase(	unittest.TestCase ):
					snake_case_		:					List[Any]    					=						inspect.getfile(accelerate.test_utils )
					snake_case_		:					Optional[Any]    					=						os.path.sep.join(mod_file.split(os.path.sep )[:-1] + ["""scripts""", """test_cli.py"""] )

					snake_case_		:					int    					=						["""accelerate""", """launch"""]
					snake_case_		:					List[Any]    					=						Path.home() / """.cache/huggingface/accelerate"""
					snake_case_		:					int    					=						"""default_config.yaml"""
					snake_case_		:					int    					=						config_folder / config_file
					snake_case_		:					str    					=						config_folder / """_default_config.yaml"""

					snake_case_		:					Union[str, Any]    					=						Path("""tests/test_configs""" )


					@classmethod
					def 				SCREAMING_SNAKE_CASE_	(    cls						:		List[str]    )      ->						str:




											'''simple docstring'''

											if cls.config_path.is_file():
																	cls.config_path.rename(cls.changed_path    )


					@classmethod
					def 				SCREAMING_SNAKE_CASE_	(    cls						:		Optional[int]    )      ->						List[str]:




											'''simple docstring'''

											if cls.changed_path.is_file():
																	cls.changed_path.rename(cls.config_path    )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]    )      ->						Union[str, Any]:




											'''simple docstring'''

											__snake_case				=		self.base_cmd
											if torch.cuda.is_available() and (torch.cuda.device_count() > 1):
																	cmd += ["--multi_gpu"]
											execute_subprocess_async(cmd + [self.test_file_path]  ,     env=os.environ.copy()    )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[int]    )      ->						Optional[int]:




											'''simple docstring'''

											for config in sorted(self.test_config_path.glob("**/*.yaml"    )    ):
																	with self.subTest(config_file=SCREAMING_SNAKE_CASE    ):
																							execute_subprocess_async(
																							    self.base_cmd + ["--config_file", str(SCREAMING_SNAKE_CASE    ), self.test_file_path]  ,     env=os.environ.copy()    )






					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]    )      ->						Any:




											'''simple docstring'''

											execute_subprocess_async(["accelerate", "test"]  ,     env=os.environ.copy()    )






class      UpperCamelCase(	unittest.TestCase ):
					snake_case_		:					str    					=						"""test-tpu"""
					snake_case_		:					Tuple    					=						"""us-central1-a"""
					snake_case_		:					Tuple    					=						"""ls"""
					snake_case_		:					int    					=						["""accelerate""", """tpu-config"""]
					snake_case_		:					List[str]    					=						"""cd /usr/share"""
					snake_case_		:					List[str]    					=						"""tests/test_samples/test_command_file.sh"""
					snake_case_		:					List[Any]    					=						"""Running gcloud compute tpus tpu-vm ssh"""


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[int]    )      ->						Any:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd
											    + ["--command", self.command, "--tpu_zone", self.tpu_zone, "--tpu_name", self.tpu_name, "--debug"]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		List[Any]    )      ->						int:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd
											    + [
											        "--config_file",
											        "tests/test_configs/0_12_0.yaml",
											        "--command",
											        self.command,
											        "--tpu_zone",
											        self.tpu_zone,
											        "--tpu_name",
											        self.tpu_name,
											        "--debug",
											    ]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		str    )      ->						Dict:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd + ["--config_file", "tests/test_configs/latest.yaml", "--debug"]  ,     return_stdout=SCREAMING_SNAKE_CASE    )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo "hello world"; echo "this is a second command" --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[int]    )      ->						int:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd + ["--config_file", "tests/test_configs/latest.yaml", "--command", self.command, "--debug"]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		List[str]    )      ->						int:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd
											    + [
											        "--config_file",
											        "tests/test_configs/latest.yaml",
											        "--command",
											        self.command,
											        "--command",
											        "echo \"Hello World\"",
											        "--debug",
											    ]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls; echo "Hello World" --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[int]    )      ->						Tuple:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd
											    + ["--config_file", "tests/test_configs/latest.yaml", "--command_file", self.command_file, "--debug"]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo "hello world"; echo "this is a second command" --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Dict    )      ->						int:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd
											    + [
											        "--config_file",
											        "tests/test_configs/0_12_0.yaml",
											        "--command_file",
											        self.command_file,
											        "--tpu_zone",
											        self.tpu_zone,
											        "--tpu_name",
											        self.tpu_name,
											        "--debug",
											    ]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo "hello world"; echo "this is a second command" --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Tuple    )      ->						List[Any]:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd + ["--config_file", "tests/test_configs/latest.yaml", "--install_accelerate", "--debug"]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; pip install accelerate -U; echo "hello world"; echo "this is a second command" --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )






					def 				SCREAMING_SNAKE_CASE_	(    self						:		List[Any]    )      ->						Optional[Any]:




											'''simple docstring'''

											__snake_case				=		run_command(
											    self.cmd
											    + [
											        "--config_file",
											        "tests/test_configs/latest.yaml",
											        "--install_accelerate",
											        "--accelerate_version",
											        "12.0.0",
											        "--debug",
											    ]  ,     return_stdout=SCREAMING_SNAKE_CASE  ,     )
											self.assertIn(
											    f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; pip install accelerate==12.0.0; echo "hello world"; echo "this is a second command" --worker all'''  ,     SCREAMING_SNAKE_CASE  ,     )









def 						_lowerCAmelCase							(     _lowerCAmelCase = 1000			)    ->						int:


						'''simple docstring'''






						__snake_case				=		2**power
						__snake_case				=		str(_lowerCAmelCase			)
						__snake_case				=		list(_lowerCAmelCase			)
						__snake_case				=		0

						for i in list_num:
												sum_of_num += int(_lowerCAmelCase			)

						return sum_of_num


if __name__ == "__main__":
	A				:       Optional[Any]      =  int(input('Enter the power of 2: ').strip())
	print('2 ^ ', power, ' = ', 2**power)
	A				:       List[Any]      =  solution(power)
	print('Sum of the digits is: ', result)





