


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					(    lowerCAmelCase_ )    ->str:
   UpperCAmelCase      					=  {}
   UpperCAmelCase      					=  os.path.join(lowerCAmelCase_	,    """all_results.json""" )
   if os.path.exists(lowerCAmelCase_ ):
      with open(lowerCAmelCase_	,    """r""" ) as f:
         UpperCAmelCase      					=  json.load(lowerCAmelCase_ )
   else:
      raise ValueError(F"""can't find {path}""" )
   return results


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







@require_torch_tpu
class 	__lowercase					(	__snake_case	):





      def 							_lowercase					(		self    :       Any							)     -> Dict:






         """simple docstring"""







         import xla_spawn

         UpperCAmelCase      					=  self.get_auto_remove_tmp_dir()
         UpperCAmelCase      					=  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(__lowerCamelCase       ,							"""argv"""       ,							__lowerCamelCase							):
            UpperCAmelCase      					=  time()
            xla_spawn.main()
            UpperCAmelCase      					=  time()

            UpperCAmelCase      					=  get_results(__lowerCamelCase							)
            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    :       Any							)     -> Optional[Any]:






         """simple docstring"""







         import xla_spawn

         UpperCAmelCase      					=  """
            ./tests/test_trainer_tpu.py
            --num_cores=8
            ./tests/test_trainer_tpu.py
            """.split()
         with patch.object(__lowerCamelCase       ,							"""argv"""       ,							__lowerCamelCase							):
            xla_spawn.main()







from __future__ import annotations

import math
def 	_UpperCamelCase					(    lowerCAmelCase_ )    ->bool:

   if 1 < number < 4:
      # 2 and 3 are primes
      return True
   elif number < 2 or number % 2 == 0 or number % 3 == 0:
      # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
      return False

   # All primes number are in format of 6k +/- 1
   for i in range(5	,    int(math.sqrt(lowerCAmelCase_ ) + 1 )	,    6 ):
      if number % i == 0 or number % (i + 2) == 0:
         return False
   return True


__a	 =      [num for num in range(3, 10_0001, 2) if not is_prime(num)]
def 	_UpperCamelCase					(    lowerCAmelCase_ )    ->list[int]:
   if not isinstance(lowerCAmelCase_	,    lowerCAmelCase_ ):
      raise ValueError("""n must be an integer""" )
   if n <= 0:
      raise ValueError("""n must be >= 0""" )

   UpperCAmelCase      					=  []
   for num in range(len(lowerCAmelCase_ ) ):
      UpperCAmelCase      					=  0
      while 2 * i * i <= odd_composites[num]:
         UpperCAmelCase      					=  odd_composites[num] - 2 * i * i
         if is_prime(lowerCAmelCase_ ):
            break
         i += 1
      else:
         list_nums.append(odd_composites[num] )
         if len(lowerCAmelCase_ ) == n:
            return list_nums

   return []
def 	_UpperCamelCase					(    )    ->int:
   return compute_nums(1 )[0]


if __name__ == "__main__":
 print(F"""{solution() = }""")



