
import argparse
import json

import numpy
import torch

from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES
from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging


logging.set_verbosity_info()







def 						_snake_case(  SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__    )			->   Tuple:
       # Load checkpoint
       lowercase							:					Optional[int]	     =				torch.load(SCREAMING_SNAKE_CASE__ ,     map_location="""cpu"""    )

       lowercase							:					str	     =				chkpt["""model"""]

       # We have the base model one level deeper than the original XLM repository
       lowercase							:					Tuple	     =				{}
       for k, v in state_dict.items():
              if "pred_layer" in k:
                     lowercase							:					str	     =				v
              else:
                     lowercase							:					int	     =				v

       lowercase							:					Tuple	     =				chkpt["""params"""]
       lowercase							:					Optional[Any]	     =				{n: v for n, v in config.items() if not isinstance(SCREAMING_SNAKE_CASE__ ,     (torch.FloatTensor, numpy.ndarray)    )}

       lowercase							:					Union[str, Any]	     =				chkpt["""dico_word2id"""]
       lowercase							:					Union[str, Any]	     =				{s + """</w>""" if s.find("""@@"""    ) == -1 and i > 13 else s.replace("""@@""" ,     """"""    ): i for s, i in vocab.items()}

       # Save pytorch-model
       lowercase							:					Tuple	     =				pytorch_dump_folder_path + """/""" + WEIGHTS_NAME
       lowercase							:					Union[str, Any]	     =				pytorch_dump_folder_path + """/""" + CONFIG_NAME
       lowercase							:					int	     =				pytorch_dump_folder_path + """/""" + VOCAB_FILES_NAMES["""vocab_file"""]

       print(f"Save PyTorch model to {pytorch_weights_dump_path}"    )
       torch.save(SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__    )

       print(f"Save configuration file to {pytorch_config_dump_path}"    )
       with open(SCREAMING_SNAKE_CASE__ ,     """w""" ,     encoding="""utf-8"""    ) as f:
              f.write(json.dumps(SCREAMING_SNAKE_CASE__ ,     indent=2    ) + """\n"""    )

       print(f"Save vocab file to {pytorch_config_dump_path}"    )
       with open(SCREAMING_SNAKE_CASE__ ,     """w""" ,     encoding="""utf-8"""    ) as f:
              f.write(json.dumps(SCREAMING_SNAKE_CASE__ ,     indent=2    ) + """\n"""    )


if __name__ == "__main__":
  lowercase  : Optional[Any]						   =							argparse.ArgumentParser()
  # Required parameters
  parser.add_argument(
      """--xlm_checkpoint_path""", default=None, type=str, required=True, help="""Path the official PyTorch dump."""
  )
  parser.add_argument(
      """--pytorch_dump_folder_path""", default=None, type=str, required=True, help="""Path to the output PyTorch model."""
  )
  lowercase  : Union[str, Any]						   =							parser.parse_args()
  convert_xlm_checkpoint_to_pytorch(args.xlm_checkpoint_path, args.pytorch_dump_folder_path)


import math
from datetime import datetime, timedelta







def 						_snake_case(  SCREAMING_SNAKE_CASE__    )			->   datetime:
       lowercase							:					Any	     =				year % 19
       lowercase							:					Optional[int]	     =				year % 4
       lowercase							:					Any	     =				year % 7
       lowercase							:					str	     =				math.floor(year / 100    )
       lowercase							:					List[str]	     =				math.floor((13 + 8 * leap_day_inhibits) / 25    )
       lowercase							:					Tuple	     =				leap_day_inhibits / 4
       lowercase							:					Any	     =				(
           15 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
       ) % 30
       lowercase							:					Union[str, Any]	     =				(4 + leap_day_inhibits - leap_day_reinstall_number) % 7

       # days to be added to March 21
       lowercase							:					str	     =				(19 * metonic_cycle + secular_moon_shift) % 30

       # PHM -> Paschal Full Moon
       lowercase							:					List[Any]	     =				(
           2 * julian_leap_year
           + 4 * non_leap_year
           + 6 * days_to_add
           + century_starting_point
       ) % 7

       if days_to_add == 29 and days_from_phm_to_sunday == 6:
              return datetime(SCREAMING_SNAKE_CASE__ ,     4 ,     19    )
       elif days_to_add == 28 and days_from_phm_to_sunday == 6:
              return datetime(SCREAMING_SNAKE_CASE__ ,     4 ,     18    )
       else:
              return datetime(SCREAMING_SNAKE_CASE__ ,     3 ,     22    ) + timedelta(
                  days=int(days_to_add + days_from_phm_to_sunday    )    )


if __name__ == "__main__":
  for year in (1994, 2000, 2010, 2021, 2023):
    lowercase  : List[str]						   =							"""will be""" if year > datetime.now().year else """was"""
    print(F'''Easter in {year} {tense} {gauss_easter(year)}''')
