

import json
import logging
import os
import sys
from time import time
from unittest.mock import patch

from transformers.testing_utils import TestCasePlus, require_torch_tpu


logging.basicConfig(level=logging.DEBUG)

a__												=						logging.getLogger()



def   __UpperCAmelCase					(      __a :     List[str]      )     ->	Tuple:

					"""simple docstring"""

					_a      :       List[str]   =						{}
					_a      :       int   =						os.path.join(__a						,'''all_results.json'''      )
					if os.path.exists(__a      ):
										with open(__a						,'''r'''      ) as f:
															_a      :       Any   =						json.load(__a      )
					else:
										raise ValueError(F"""can't find {path}"""      )
					return results


a__												=						logging.StreamHandler(sys.stdout)
logger.addHandler(stream_handler)







@require_torch_tpu
class 							UpperCAmelCase_						(     __lowercase  ):
							"""simple docstring"""







							def 							__lowercase							(     self			)       ->       Optional[Any]:
												import xla_spawn

												_a      :       Union[str, Any]   =						self.get_auto_remove_tmp_dir()
												_a      :       List[Any]   =						F"""
            ./examples/pytorch/text-classification/run_glue.py
            --num_cores=8
            ./examples/pytorch/text-classification/run_glue.py
            --model_name_or_path distilbert-base-uncased
            --output_dir {tmp_dir}
            --overwrite_output_dir
            --train_file ./tests/fixtures/tests_samples/MRPC/train.csv
            --validation_file ./tests/fixtures/tests_samples/MRPC/dev.csv
            --do_train
            --do_eval
            --debug tpu_metrics_debug
            --per_device_train_batch_size=2
            --per_device_eval_batch_size=1
            --learning_rate=1e-4
            --max_steps=10
            --warmup_steps=2
            --seed=42
            --max_seq_length=128
            """.split()

												with patch.object(_a			,				'''argv'''			,				_a			):
																	_a      :       List[str]   =						time()
																	xla_spawn.main()
																	_a      :       Tuple   =						time()

																	_a      :       Tuple   =						get_results(_a			)
																	self.assertGreaterEqual(result['''eval_accuracy''']			,				0.75			)

																	# Assert that the script takes less than 500 seconds to make sure it doesn't hang.
																	self.assertLess(end - start			,				5_0_0			)




							def 							__lowercase							(     self			)       ->       Dict:
												import xla_spawn

												_a      :       str   =						'''
            ./tests/test_trainer_tpu.py
            --num_cores=8
            ./tests/test_trainer_tpu.py
            '''.split()
												with patch.object(_a			,				'''argv'''			,				_a			):
																	xla_spawn.main()






def   __UpperCAmelCase					(      __a :     str      )     ->	list:

					"""simple docstring"""

					if n_term == "":
										return []
					_a      :       list   =						[]
					for temp in range(int(__a      )      ):
										series.append(F"""1/{temp + 1}""" if series else '''1'''      )
					return series


if __name__ == "__main__":
			a__												=						input('''Enter the last number (nth term) of the Harmonic Series''')
			print('''Formula of Harmonic Series => 1+1/2+1/3 ..... 1/n''')
			print(harmonic_series(nth_term))



