




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 __snake_case			(			a		):
   UpperCAmelCase__  :    Dict          =  ComputeEnvironment.AMAZON_SAGEMAKER
   UpperCAmelCase__  :    str          =  True
   UpperCAmelCase__  :    List[Any]          =  '''ml.p3.2xlarge'''
   UpperCAmelCase__  :    str          =  '''accelerate_sagemaker_execution_role'''
   UpperCAmelCase__  :    int          =  '''hf-sm'''
   UpperCAmelCase__  :    List[str]          =  '''us-east-1'''
   UpperCAmelCase__  :    int          =  1
   UpperCAmelCase__  :    List[Any]          =  '''accelerate-sagemaker-1'''
   UpperCAmelCase__  :    int          =  '''1.6'''
   UpperCAmelCase__  :    Tuple          =  '''4.4'''
   UpperCAmelCase__  :    str          =  '''train.py'''
   UpperCAmelCase__  :    Union[str, Any]          =  [
       '''--model_name_or_path''',
       '''bert''',
       '''--do_train''',
       '''False''',
       '''--epochs''',
       '''3''',
       '''--learning_rate''',
       '''5e-5''',
       '''--max_steps''',
       '''50.5''',
   ]
   UpperCAmelCase__  :    Union[str, Any]          =  [
       '''--model_name_or_path''',
       '''bert''',
       '''--do_train''',
       '''--do_test''',
       '''False''',
       '''--do_predict''',
       '''--epochs''',
       '''3''',
       '''--learning_rate''',
       '''5e-5''',
       '''--max_steps''',
       '''50.5''',
   ]







class __snake_case			(			unittest.TestCase		):







   def lowerCamelCase						(      self		:						str):

        """simple docstring"""


        UpperCAmelCase_          =							_convert_nargs_to_dict(MockLaunchConfig.success_training_script_args)
        assert isinstance(converted_args['''model_name_or_path''']					,						_snake_case)
        assert isinstance(converted_args['''do_train''']					,						_snake_case)
        assert isinstance(converted_args['''epochs''']					,						_snake_case)
        assert isinstance(converted_args['''learning_rate''']					,						_snake_case)
        assert isinstance(converted_args['''max_steps''']					,						_snake_case)

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











"""simple docstring"""
def  lowerCamelCase_						(UpperCamelCase__		:		int     ,       UpperCamelCase__		:		int							):
    if a < 0 or b < 0:
        raise ValueError('''the value of both inputs must be positive'''							)
    _UpperCAmelCase							:  List[str]											=    str(bin(UpperCamelCase__							)							)[2:]  # remove the leading "0b"
    _UpperCAmelCase							:  str											=    str(bin(UpperCamelCase__							)							)[2:]
    _UpperCAmelCase							:  List[str]											=    max(len(UpperCamelCase__							)     ,       len(UpperCamelCase__							)							)
    return "0b" + "".join(
        str(int('''1''' in (char_a, char_b)							)							)
        for char_a, char_b in zip(a_binary.zfill(UpperCamelCase__							)     ,       b_binary.zfill(UpperCamelCase__							)							)							)


if __name__ == "__main__":
  import doctest

  doctest.testmod()


