




"""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 				snake_case_			(					lowerCamelCase_			):







   """simple docstring"""




   A_				      =       ComputeEnvironment.AMAZON_SAGEMAKER
   A_				      =       True
   A_				      =       '''ml.p3.2xlarge'''
   A_				      =       '''accelerate_sagemaker_execution_role'''
   A_				      =       '''hf-sm'''
   A_				      =       '''us-east-1'''
   A_				      =       1
   A_				      =       '''accelerate-sagemaker-1'''
   A_				      =       '''1.6'''
   A_				      =       '''4.4'''
   A_				      =       '''train.py'''
   A_				      =       [
       '''--model_name_or_path''',
       '''bert''',
       '''--do_train''',
       '''False''',
       '''--epochs''',
       '''3''',
       '''--learning_rate''',
       '''5e-5''',
       '''--max_steps''',
       '''50.5''',
   ]
   A_				      =       [
       '''--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			):







   """simple docstring"""




   def   UpperCAmelCase__			(		self)				->   List[Any]:
       # If no defaults are changed, `to_kwargs` returns an empty dict.
       UpperCamelCase              =	_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"""

from math import asin, atan, cos, radians, sin, sqrt, tan

SCREAMING_SNAKE_CASE_            =    6_3_7_8_1_3_7.0
SCREAMING_SNAKE_CASE_            =    6_3_5_6_7_5_2.3_1_4_2_4_5
SCREAMING_SNAKE_CASE_            =    637_8137




def      lowercase__    (       lowerCAmelCase					:       float			,					lowerCAmelCase					:       float			,					lowerCAmelCase					:       float			,					lowerCAmelCase					:       float			)			->   float:






    """simple docstring"""




    UpperCAmelCase          =       (AXIS_A - AXIS_B) / AXIS_A
    UpperCAmelCase          =       atan((1 - flattening) * tan(radians(lowerCAmelCase			)			)			)
    UpperCAmelCase          =       atan((1 - flattening) * tan(radians(lowerCAmelCase			)			)			)
    UpperCAmelCase          =       radians(lowerCAmelCase			)
    UpperCAmelCase          =       radians(lowerCAmelCase			)
    # Equation
    UpperCAmelCase          =       sin((phi_a - phi_a) / 2			)
    UpperCAmelCase          =       sin((lambda_a - lambda_a) / 2			)
    # Square both values
    sin_sq_phi *= sin_sq_phi
    sin_sq_lambda *= sin_sq_lambda
    UpperCAmelCase          =       sqrt(sin_sq_phi + (cos(lowerCAmelCase			) * cos(lowerCAmelCase			) * sin_sq_lambda)			)
    return 2 * RADIUS * asin(lowerCAmelCase			)


if __name__ == "__main__":
   import doctest

   doctest.testmod()



