code: 
  
  
  '''simple docstring'''
  
  import argparse
  
  import torch
  
  from transformers import NystromformerConfig, NystromformerForMaskedLM
  
  def _SCREAMING_SNAKE_CASE   (A ) -> Union[str, Any]:
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         if "model" in orig_key:
                lowercase__       =				orig_key.replace('''model.'''						,				'''''' )
         if "norm1" in orig_key:
                lowercase__       =				orig_key.replace('''norm1'''						,				'''attention.output.LayerNorm''' )
         if "norm2" in orig_key:
                lowercase__       =				orig_key.replace('''norm2'''						,				'''output.LayerNorm''' )
         if "norm" in orig_key:
                lowercase__       =				orig_key.replace('''norm'''						,				'''LayerNorm''' )
         if "transformer" in orig_key:
                lowercase__       =				orig_key.split('''.''' )[0].split('''_''' )[-1]
                lowercase__       =				orig_key.replace(f"transformer_{layer_num}"						,				f"encoder.layer.{layer_num}" )
         if "mha.attn" in orig_key:
                lowercase__       =				orig_key.replace('''mha.attn'''						,				'''attention.self''' )
         if "mha" in orig_key:
                lowercase__       =				orig_key.replace('''mha'''						,				'''attention''' )
         if "W_q" in orig_key:
                lowercase__       =				orig_key.replace('''W_q'''						,				'''self.query''' )
         if "W_k" in orig_key:
                lowercase__       =				orig_key.replace('''W_k'''						,				'''self.key''' )
         if "W_v" in orig_key:
                lowercase__       =				orig_key.replace('''W_v'''						,				'''self.value''' )
         if "ff1" in orig_key:
                lowercase__       =				orig_key.replace('''ff1'''						,				'''intermediate.dense''' )
         if "ff2" in orig_key:
                lowercase__       =				orig_key.replace('''ff2'''						,				'''output.dense''' )
         if "ff" in orig_key:
                lowercase__       =				orig_key.replace('''ff'''						,				'''output.dense''' )
         if "mlm_class" in orig_key:
                lowercase__       =				orig_key.replace('''mlm.mlm_class'''						,				'''cls.predictions.decoder''' )
         if "mlm" in orig_key:
                lowercase__       =				orig_key.replace('''mlm'''						,				'''cls.predictions.transform''' )
         if "cls" not in orig_key:
                lowercase__       =				'nystromformer.' + orig_key
  
         return orig_key
  
  def _SCREAMING_SNAKE_CASE   (A						,				A ) -> Optional[int]:
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         for key in orig_state_dict.copy().keys():
                lowercase__       =				orig_state_dict.pop(_SCREAMING_SNAKE_CASE )
  
                if ("pooler" in key) or ("sen_class" in key) or ("conv.bias" in key):
                       continue
                else:
                       lowercase__       =				val
  
         lowercase__       =				orig_state_dict['cls.predictions.decoder.bias']
         lowercase__       =				(
             torch.arange(config.max_position_embeddings ).expand((1, -1) ) + 2
         )
  
         return orig_state_dict
  
  def _SCREAMING_SNAKE_CASE   (A						,				A						,				A ) -> Tuple:
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         lowercase__       =				torch.load(_SCREAMING_SNAKE_CASE						,				map_location='''cpu''' )['model_state_dict']
         lowercase__       =				NystromformerConfig.from_json_file(_SCREAMING_SNAKE_CASE )
         lowercase__       =				NystromformerForMaskedLM(_SCREAMING_SNAKE_CASE )
  
         lowercase__       =				convert_checkpoint_helper(_SCREAMING_SNAKE_CASE						,				_SCREAMING_SNAKE_CASE )
  
         model.load_state_dict(_SCREAMING_SNAKE_CASE )
         model.eval()
         model.save_pretrained(_SCREAMING_SNAKE_CASE )
  
         print(f"Checkpoint successfuly converted. Model saved at {pytorch_dump_path}" )
  
  
  if __name__ == "__main__":
   lowerCamelCase							:     List[str]								=			argparse.ArgumentParser()
   # Required parameters
   parser.add_argument(
       '--pytorch_model_path', default=None, type=str, required=True, help='Path to Nystromformer pytorch checkpoint.'
   )
   parser.add_argument(
       '--config_file',
       default=None,
       type=str,
       required=True,
       help='The json file for Nystromformer model config.',
   )
   parser.add_argument(
       '--pytorch_dump_path', default=None, type=str, required=True, help='Path to the output PyTorch model.'
   )
   lowerCamelCase							:     List[str]								=			parser.parse_args()
   convert_nystromformer_checkpoint(args.pytorch_model_path, args.config_file, args.pytorch_dump_path)
  
  
  
  
  
style_context: 
  
  
  '''simple docstring'''
  
  from __future__ import annotations
  
  from collections import Counter
  
  def _SCREAMING_SNAKE_CASE   (A ) -> list[int]:
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         lowercase__       =				[True] * n
         lowercase__       =				False
         lowercase__       =				False
         lowercase__       =				True
  
         for i in range(3						,				int(n**0.5 + 1 )						,				2 ):
                lowercase__       =				i * 2
                while index < n:
                       lowercase__       =				False
                       lowercase__       =				index + i
  
         lowercase__       =				[2]
  
         for i in range(3						,				A						,				2 ):
                if is_prime[i]:
                       primes.append(A )
  
         return primes
  
  def _SCREAMING_SNAKE_CASE   (A ) -> list[list[int]]:
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         lowercase__       =				str(A )
         lowercase__       =				[]
         lowercase__       =				['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']
  
         for duplicate in Counter(A ) - Counter(set(A ) ):
                lowercase__       =				[int(number_str.replace(A						,				A ) ) for digit in digits]
                replacements.append(A )
  
         return replacements
  
  def _SCREAMING_SNAKE_CASE   (A = 8 ) -> int:
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         lowercase__       =				set()
  
         # Filter primes with less than 3 replaceable digits
         lowercase__       =				{
             x for x in set(prime_sieve(1_000_000 ) ) if len(str(A ) ) - len(set(str(A ) ) ) >= 3
         }
  
         for prime in primes:
                if prime in numbers_checked:
                       continue
  
                lowercase__       =				digit_replacements(A )
  
                for family in replacements:
                       numbers_checked.update(A )
                       lowercase__       =				primes.intersection(A )
  
                       if len(A ) != family_length:
                              continue
  
                       return min(A )
  
         return -1
  
  
  if __name__ == "__main__":
   print(solution())
  
  
  
  
  