



"""simple docstring"""
from __future__ import annotations

from functools import lru_cache
from math import ceil

A:     Optional[int]										=				1_0_0

A:     Dict										=				set(range(3, NUM_PRIMES, 2))
primes.add(2)
A:     List[str]										=				4_2

for prime in range(3, ceil(NUM_PRIMES**0.5), 2):
      if prime not in primes:
            continue
      primes.difference_update(set(range(prime * prime, NUM_PRIMES, prime)))

@lru_cache(maxsize=100		)
def    _snake_case		(		UpperCamelCase		:	int		):
 if number_to_partition < 0:
  return set()
 elif number_to_partition == 0:
  return {1}

 UpperCAmelCase			:      Dict			=			set()
 UpperCAmelCase			:      Union[str, Any]			=			42
 UpperCAmelCase			:      Optional[int]			=			42

 for prime in primes:
  if prime > number_to_partition:
   continue
  for sub in partition(number_to_partition - prime		):
   ret.add(sub * prime		)

 return ret

def    _snake_case		(		UpperCamelCase		:	int = 5000		):
 for number_to_partition in range(1    ,	lowerCamelCase_		):
  if len(partition(lowerCamelCase_		)		) > number_unique_partitions:
   return number_to_partition
 return None


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





"""simple docstring"""
import os
import tempfile
import unittest
from pathlib import Path

from transformers import AutoConfig, is_torch_available
from transformers.testing_utils import require_torch, torch_device


if is_torch_available():
      from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments



@require_torch
class    SCREAMING_SNAKE_CASE__						(      unittest.TestCase				):

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE		)						->   List[Any]:





    '''simple docstring'''




    for model_result in results.values():
     for batch_size, sequence_length in zip(model_result["""bs"""]   ,  model_result["""ss"""]		):
      UpperCAmelCase			:      List[str]			=			model_result["""result"""][batch_size][sequence_length]
      self.assertIsNotNone(_SCREAMING_SNAKE_CASE		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Optional[int]:





    '''simple docstring'''




    UpperCAmelCase			:      Union[str, Any]			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      Any			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      Tuple			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Tuple			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_inference_result		)
    self.check_results_dict_not_empty(results.memory_inference_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Dict:





    '''simple docstring'''




    UpperCAmelCase			:      Any			=			"""sgugger/tiny-distilbert-classification"""
    UpperCAmelCase			:      Any			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  only_pretrain_model=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      List[str]			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      List[Any]			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_inference_result		)
    self.check_results_dict_not_empty(results.memory_inference_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   List[Any]:





    '''simple docstring'''




    UpperCAmelCase			:      Any			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      Optional[Any]			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  torchscript=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      Dict			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      List[str]			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_inference_result		)
    self.check_results_dict_not_empty(results.memory_inference_result		)

   @unittest.skipIf(torch_device == """cpu"""   ,  """Cant do half precision"""		)
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   List[str]:





    '''simple docstring'''




    UpperCAmelCase			:      List[str]			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      Optional[int]			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  fpaa=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      Any			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      int			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_inference_result		)
    self.check_results_dict_not_empty(results.memory_inference_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Optional[Any]:





    '''simple docstring'''




    UpperCAmelCase			:      List[str]			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      str			=			AutoConfig.from_pretrained(_SCREAMING_SNAKE_CASE		)
    # set architectures equal to `None`
    UpperCAmelCase			:      str			=			None
    UpperCAmelCase			:      Tuple			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      Any			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE   ,  configs=[config]		)
    UpperCAmelCase			:      Dict			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_inference_result		)
    self.check_results_dict_not_empty(results.memory_inference_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Tuple:





    '''simple docstring'''




    UpperCAmelCase			:      Tuple			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      Union[str, Any]			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      Dict			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Union[str, Any]			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_train_result		)
    self.check_results_dict_not_empty(results.memory_train_result		)

   @unittest.skipIf(torch_device == """cpu"""   ,  """Can't do half precision"""		)
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   int:





    '''simple docstring'''




    UpperCAmelCase			:      Optional[int]			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      int			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  fpaa=_SCREAMING_SNAKE_CASE   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      str			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Optional[Any]			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_train_result		)
    self.check_results_dict_not_empty(results.memory_train_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Dict:





    '''simple docstring'''




    UpperCAmelCase			:      Union[str, Any]			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      str			=			AutoConfig.from_pretrained(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Dict			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      Union[str, Any]			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE   ,  configs=[config]		)
    UpperCAmelCase			:      int			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_inference_result		)
    self.check_results_dict_not_empty(results.memory_inference_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   str:





    '''simple docstring'''




    UpperCAmelCase			:      Union[str, Any]			=			"""sshleifer/tinier_bart"""
    UpperCAmelCase			:      Tuple			=			AutoConfig.from_pretrained(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      int			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      str			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE   ,  configs=[config]		)
    UpperCAmelCase			:      str			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_inference_result		)
    self.check_results_dict_not_empty(results.memory_inference_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			:      Any			=			"""sshleifer/tiny-gpt2"""
    UpperCAmelCase			:      List[str]			=			AutoConfig.from_pretrained(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      List[str]			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      Any			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE   ,  configs=[config]		)
    UpperCAmelCase			:      Optional[int]			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_train_result		)
    self.check_results_dict_not_empty(results.memory_train_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			:      List[Any]			=			"""sshleifer/tinier_bart"""
    UpperCAmelCase			:      Optional[Any]			=			AutoConfig.from_pretrained(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Any			=			PyTorchBenchmarkArguments(
        models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
    UpperCAmelCase			:      int			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE   ,  configs=[config]		)
    UpperCAmelCase			:      str			=			benchmark.run()
    self.check_results_dict_not_empty(results.time_train_result		)
    self.check_results_dict_not_empty(results.memory_train_result		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			:      str			=			"""sshleifer/tiny-gpt2"""
    with tempfile.TemporaryDirectory() as tmp_dir:
     UpperCAmelCase			:      Any			=			PyTorchBenchmarkArguments(
         models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  save_to_csv=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  inference_time_csv_file=os.path.join(_SCREAMING_SNAKE_CASE   ,  """inf_time.csv"""		)   ,  train_memory_csv_file=os.path.join(_SCREAMING_SNAKE_CASE   ,  """train_mem.csv"""		)   ,  inference_memory_csv_file=os.path.join(_SCREAMING_SNAKE_CASE   ,  """inf_mem.csv"""		)   ,  train_time_csv_file=os.path.join(_SCREAMING_SNAKE_CASE   ,  """train_time.csv"""		)   ,  env_info_csv_file=os.path.join(_SCREAMING_SNAKE_CASE   ,  """env.csv"""		)   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
     UpperCAmelCase			:      Union[str, Any]			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
     benchmark.run()
     self.assertTrue(Path(os.path.join(_SCREAMING_SNAKE_CASE   ,  """inf_time.csv"""		)		).exists()		)
     self.assertTrue(Path(os.path.join(_SCREAMING_SNAKE_CASE   ,  """train_time.csv"""		)		).exists()		)
     self.assertTrue(Path(os.path.join(_SCREAMING_SNAKE_CASE   ,  """inf_mem.csv"""		)		).exists()		)
     self.assertTrue(Path(os.path.join(_SCREAMING_SNAKE_CASE   ,  """train_mem.csv"""		)		).exists()		)
     self.assertTrue(Path(os.path.join(_SCREAMING_SNAKE_CASE   ,  """env.csv"""		)		).exists()		)




   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			:      Tuple			=			"""sshleifer/tiny-gpt2"""

    def _check_summary_is_not_empty(_SCREAMING_SNAKE_CASE		):
     self.assertTrue(hasattr(_SCREAMING_SNAKE_CASE   ,  """sequential"""		)		)
     self.assertTrue(hasattr(_SCREAMING_SNAKE_CASE   ,  """cumulative"""		)		)
     self.assertTrue(hasattr(_SCREAMING_SNAKE_CASE   ,  """current"""		)		)
     self.assertTrue(hasattr(_SCREAMING_SNAKE_CASE   ,  """total"""		)		)

    with tempfile.TemporaryDirectory() as tmp_dir:
     UpperCAmelCase			:      List[str]			=			PyTorchBenchmarkArguments(
         models=[MODEL_ID]   ,  training=_SCREAMING_SNAKE_CASE   ,  inference=_SCREAMING_SNAKE_CASE   ,  sequence_lengths=[8]   ,  batch_sizes=[1]   ,  log_filename=os.path.join(_SCREAMING_SNAKE_CASE   ,  """log.txt"""		)   ,  log_print=_SCREAMING_SNAKE_CASE   ,  trace_memory_line_by_line=_SCREAMING_SNAKE_CASE   ,  multi_process=_SCREAMING_SNAKE_CASE   ,  )
     UpperCAmelCase			:      Any			=			PyTorchBenchmark(_SCREAMING_SNAKE_CASE		)
     UpperCAmelCase			:      List[Any]			=			benchmark.run()
     _check_summary_is_not_empty(result.inference_summary		)
     _check_summary_is_not_empty(result.train_summary		)
     self.assertTrue(Path(os.path.join(_SCREAMING_SNAKE_CASE   ,  """log.txt"""		)		).exists()		)
