
import os
import string
import sys


_UpperCAmelCase					: Tuple      =       1 << 8

_UpperCAmelCase					: str      =       {
    """tab""": ord("\t"),
    """newline""": ord("\r"),
    """esc""": 27,
    """up""": 65 + ARROW_KEY_FLAG,
    """down""": 66 + ARROW_KEY_FLAG,
    """right""": 67 + ARROW_KEY_FLAG,
    """left""": 68 + ARROW_KEY_FLAG,
    """mod_int""": 91,
    """undefined""": sys.maxsize,
    """interrupt""": 3,
    """insert""": 50,
    """delete""": 51,
    """pg_up""": 53,
    """pg_down""": 54,
}

_UpperCAmelCase					: int      =       KEYMAP["""up"""]
_UpperCAmelCase					: Dict      =       KEYMAP["""left"""]

if sys.platform == "win32":
					_UpperCAmelCase					: Union[str, Any]      =       []
					_UpperCAmelCase					: List[str]      =       {
					    b"""\xe0H""": KEYMAP["""up"""] - ARROW_KEY_FLAG,
					    b"""\x00H""": KEYMAP["""up"""] - ARROW_KEY_FLAG,
					    b"""\xe0P""": KEYMAP["""down"""] - ARROW_KEY_FLAG,
					    b"""\x00P""": KEYMAP["""down"""] - ARROW_KEY_FLAG,
					    b"""\xe0M""": KEYMAP["""right"""] - ARROW_KEY_FLAG,
					    b"""\x00M""": KEYMAP["""right"""] - ARROW_KEY_FLAG,
					    b"""\xe0K""": KEYMAP["""left"""] - ARROW_KEY_FLAG,
					    b"""\x00K""": KEYMAP["""left"""] - ARROW_KEY_FLAG,
					}

for i in range(10):
					_UpperCAmelCase					: Dict      =       ord(str(i))


def       A       (					)   ->  Tuple:
		'''simple docstring'''

		if os.name == "nt":
				import msvcrt

				UpperCamelCase		=     'mbcs'
				# Flush the keyboard buffer
				while msvcrt.kbhit():
						msvcrt.getch()
				if len(snake_case__ ) == 0:
						# Read the keystroke
						UpperCamelCase		=     msvcrt.getch()

						# If it is a prefix char, get second part
						if ch in (b"\x00", b"\xe0"):
								UpperCamelCase		=     ch + msvcrt.getch()
								# Translate actual Win chars to bullet char types
								try:
										UpperCamelCase		=     chr(WIN_KEYMAP[cha] )
										WIN_CH_BUFFER.append(chr(KEYMAP['mod_int'] ) )
										WIN_CH_BUFFER.append(snake_case__ )
										if ord(snake_case__ ) in (
										    KEYMAP["insert"] - 1 << 9,
										    KEYMAP["delete"] - 1 << 9,
										    KEYMAP["pg_up"] - 1 << 9,
										    KEYMAP["pg_down"] - 1 << 9,
										):
												WIN_CH_BUFFER.append(chr(126 ) )
										UpperCamelCase		=     chr(KEYMAP['esc'] )
								except KeyError:
										UpperCamelCase		=     cha[1]
						else:
								UpperCamelCase		=     ch.decode(snake_case__ )
				else:
						UpperCamelCase		=     WIN_CH_BUFFER.pop(0 )
		elif os.name == "posix":
				import termios
				import tty

				UpperCamelCase		=     sys.stdin.fileno()
				UpperCamelCase		=     termios.tcgetattr(snake_case__ )
				try:
						tty.setraw(snake_case__ )
						UpperCamelCase		=     sys.stdin.read(1 )
				finally:
						termios.tcsetattr(snake_case__    ,       termios.TCSADRAIN    ,       snake_case__ )
		return ch


def       A       (					)   ->  List[str]:
		'''simple docstring'''

		UpperCamelCase		=     get_raw_chars()
		if ord(snake_case__ ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
				return char

		elif ord(snake_case__ ) == KEYMAP["esc"]:
				UpperCamelCase		=     get_raw_chars()
				if ord(snake_case__ ) == KEYMAP["mod_int"]:
						UpperCamelCase		=     get_raw_chars()
						if ord(snake_case__ ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(snake_case__ ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
								return chr(ord(snake_case__ ) + ARROW_KEY_FLAG )
						else:
								return KEYMAP["undefined"]
				else:
						return get_raw_chars()

		else:
				if char in string.printable:
						return char
				else:
						return KEYMAP["undefined"]






"""simple docstring"""




import operator as op


lowerCAmelCase							:			Dict     							=							"""scaler.pt"""
lowerCAmelCase							:			Tuple     							=							"""pytorch_model"""
lowerCAmelCase							:			Union[str, Any]     							=							"""random_states"""
lowerCAmelCase							:			Union[str, Any]     							=							"""optimizer"""
lowerCAmelCase							:			Dict     							=							"""scheduler"""
lowerCAmelCase							:			int     							=							"""pytorch_model.bin"""
lowerCAmelCase							:			str     							=							"""pytorch_model.bin.index.json"""
lowerCAmelCase							:			Union[str, Any]     							=							"""model.safetensors"""
lowerCAmelCase							:			List[Any]     							=							"""model.safetensors.index.json"""
lowerCAmelCase							:			List[Any]     							=							"""1.10.2"""
lowerCAmelCase							:			Any     							=							"""py38"""
lowerCAmelCase							:			Optional[int]     							=							"""4.17.0"""
lowerCAmelCase							:			str     							=							["""ml.p3.16xlarge""", """ml.p3dn.24xlarge""", """ml.p4dn.24xlarge"""]
lowerCAmelCase							:			Tuple     							=							["""FULL_SHARD""", """SHARD_GRAD_OP""", """NO_SHARD""", """HYBRID_SHARD""", """HYBRID_SHARD_ZERO2"""]
lowerCAmelCase							:			List[Any]     							=							["""TRANSFORMER_BASED_WRAP""", """SIZE_BASED_WRAP""", """NO_WRAP"""]
lowerCAmelCase							:			List[str]     							=							["""BACKWARD_PRE""", """BACKWARD_POST""", """NO_PREFETCH"""]
lowerCAmelCase							:			List[str]     							=							["""FULL_STATE_DICT""", """LOCAL_STATE_DICT""", """SHARDED_STATE_DICT"""]
lowerCAmelCase							:			Any     							=							"""2.0.1"""
lowerCAmelCase							:			List[Any]     							=							["""pdsh""", """standard""", """openmpi""", """mvapich"""]
lowerCAmelCase							:			Union[str, Any]     							=							["""default""", """reduce-overhead""", """max-autotune"""]

lowerCAmelCase							:			Optional[int]     							=							{""">""": op.gt, """>=""": op.ge, """==""": op.eq, """!=""": op.ne, """<=""": op.le, """<""": op.lt}

# These are the args for `torch.distributed.launch` for pytorch < 1.9
lowerCAmelCase							:			Union[str, Any]     							=							[
    """nnodes""",
    """nproc_per_node""",
    """rdzv_backend""",
    """rdzv_endpoint""",
    """rdzv_id""",
    """rdzv_conf""",
    """standalone""",
    """max_restarts""",
    """monitor_interval""",
    """start_method""",
    """role""",
    """module""",
    """m""",
    """no_python""",
    """run_path""",
    """log_dir""",
    """r""",
    """redirects""",
    """t""",
    """tee""",
    """node_rank""",
    """master_addr""",
    """master_port""",
]

lowerCAmelCase							:			List[str]     							=							["""DEEPSPEED""", """MULTI_GPU""", """FSDP""", """MEGATRON_LM"""]
lowerCAmelCase							:			Optional[Any]     							=							["""DEEPSPEED""", """MULTI_XPU""", """FSDP"""]



