





'''simple docstring'''


import argparse

import torch

from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta
from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging


logging.set_verbosity_info()
def 							UpperCAmelCase_  (						__lowerCamelCase					:					Tuple	,__lowerCamelCase					:					List[str]	,__lowerCamelCase					:					List[Any] ):
   # Construct model
   if gpta_config_file == "":
      lowercase_			:Optional[int]    			= GPTaConfig()
   else:
      lowercase_			:List[str]    			= GPTaConfig.from_json_file(__lowerCamelCase )
   lowercase_			:Dict    			= GPTaModel(__lowerCamelCase )

   # Load weights from numpy
   load_tf_weights_in_gpta(__lowerCamelCase	,__lowerCamelCase	,__lowerCamelCase )

   # Save pytorch-model
   lowercase_			:Tuple    			= pytorch_dump_folder_path + "/" + WEIGHTS_NAME
   lowercase_			:int    			= pytorch_dump_folder_path + "/" + CONFIG_NAME
   print(F'Save PyTorch model to {pytorch_weights_dump_path}' )
   torch.save(model.state_dict()	,__lowerCamelCase )
   print(F'Save configuration file to {pytorch_config_dump_path}' )
   with open(__lowerCamelCase	,"w"	,encoding="utf-8" ) as f:
      f.write(config.to_json_string() )


if __name__ == "__main__":
 lowerCAmelCase					:     List[Any]												=argparse.ArgumentParser()
 # Required parameters
 parser.add_argument(
     '''--gpt2_checkpoint_path''', default=None, type=str, required=True, help='''Path to the TensorFlow checkpoint path.'''
 )
 parser.add_argument(
     '''--pytorch_dump_folder_path''', default=None, type=str, required=True, help='''Path to the output PyTorch model.'''
 )
 parser.add_argument(
     '''--gpt2_config_file''',
     default='''''',
     type=str,
     help=(
         '''An optional config json file corresponding to the pre-trained OpenAI model. \n'''
         '''This specifies the model architecture.'''
     ),
 )
 lowerCAmelCase					:     Optional[int]												=parser.parse_args()
 convert_gpta_checkpoint_to_pytorch(args.gpta_checkpoint_path, args.gpta_config_file, args.pytorch_dump_folder_path)









'''simple docstring'''


import math
def 							UpperCAmelCase_  (						__lowerCamelCase					:					int ):
   lowercase_			:Dict    			= []
   lowercase_			:List[Any]    			= 2
   lowercase_			:Optional[Any]    			= int(math.sqrt(__lowerCamelCase ) )  # Size of every segment
   lowercase_			:Optional[Any]    			= [True] * (end + 1)
   lowercase_			:Dict    			= []

   while start <= end:
      if temp[start] is True:
         in_prime.append(__lowerCamelCase )
         for i in range(start * start	,end + 1	,__lowerCamelCase ):
            lowercase_			:List[str]    			= False
      start += 1
   prime += in_prime

   lowercase_			:Dict    			= end + 1
   lowercase_			:Dict    			= min(2 * end	,__lowerCamelCase )

   while low <= n:
      lowercase_			:Any    			= [True] * (high - low + 1)
      for each in in_prime:
         lowercase_			:List[Any]    			= math.floor(low / each ) * each
         if t < low:
            t += each

         for j in range(__lowerCamelCase	,high + 1	,__lowerCamelCase ):
            lowercase_			:str    			= False

      for j in range(len(__lowerCamelCase ) ):
         if temp[j] is True:
            prime.append(j + low )

      lowercase_			:Dict    			= high + 1
      lowercase_			:Dict    			= min(high + end	,__lowerCamelCase )

   return prime


print(sieve(10**6))


