





"""simple docstring"""





import argparse

import OmegaConf
import torch

from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel



def 				lowerCAmelCase_			(      SCREAMING_SNAKE_CASE       :							Tuple    ,						SCREAMING_SNAKE_CASE       :							Any    ,						SCREAMING_SNAKE_CASE       :							Tuple   ):


							'''simple docstring'''







							__lowerCamelCase      :      int         =OmegaConf.load(SCREAMING_SNAKE_CASE   )
							__lowerCamelCase      :      Dict         =torch.load(SCREAMING_SNAKE_CASE    ,						map_location='''cpu'''   )['''model''']
							__lowerCamelCase      :      Union[str, Any]         =list(state_dict.keys()   )

							# extract state_dict for VQVAE
							__lowerCamelCase      :      Any         ={}
							__lowerCamelCase      :      Any         ='''first_stage_model.'''
							for key in keys:
														if key.startswith(SCREAMING_SNAKE_CASE   ):
																					__lowerCamelCase      :      List[Any]         =state_dict[key]

    # extract state_dict for UNetLDM
							__lowerCamelCase      :      str         ={}
							__lowerCamelCase      :      Union[str, Any]         ='''model.diffusion_model.'''
							for key in keys:
														if key.startswith(SCREAMING_SNAKE_CASE   ):
																					__lowerCamelCase      :      Optional[Any]         =state_dict[key]

							__lowerCamelCase      :      int         =config.model.params.first_stage_config.params
							__lowerCamelCase      :      List[Any]         =config.model.params.unet_config.params

							__lowerCamelCase      :      Tuple         =VQModel(**SCREAMING_SNAKE_CASE   ).eval()
							vqvae.load_state_dict(SCREAMING_SNAKE_CASE   )

							__lowerCamelCase      :      List[str]         =UNetLDMModel(**SCREAMING_SNAKE_CASE   ).eval()
							unet.load_state_dict(SCREAMING_SNAKE_CASE   )

							__lowerCamelCase      :      Dict         =DDIMScheduler(
							    timesteps=config.model.params.timesteps    ,						beta_schedule='''scaled_linear'''    ,						beta_start=config.model.params.linear_start    ,						beta_end=config.model.params.linear_end    ,						clip_sample=SCREAMING_SNAKE_CASE    ,						)

							__lowerCamelCase      :      str         =LDMPipeline(SCREAMING_SNAKE_CASE    ,						SCREAMING_SNAKE_CASE    ,						SCREAMING_SNAKE_CASE   )
							pipeline.save_pretrained(SCREAMING_SNAKE_CASE   )


if __name__ == "__main__":
							_UpperCamelCase							=      argparse.ArgumentParser()
							parser.add_argument('--checkpoint_path', type=str, required=True)
							parser.add_argument('--config_path', type=str, required=True)
							parser.add_argument('--output_path', type=str, required=True)
							_UpperCamelCase							=      parser.parse_args()

							convert_ldm_original(args.checkpoint_path, args.config_path, args.output_path)











"""simple docstring"""





import math
from datetime import datetime, timedelta



def 				lowerCAmelCase_			(      SCREAMING_SNAKE_CASE       :							int   ):


							'''simple docstring'''







							__lowerCamelCase      :      Any         =year % 19
							__lowerCamelCase      :      Optional[Any]         =year % 4
							__lowerCamelCase      :      Tuple         =year % 7
							__lowerCamelCase      :      Optional[int]         =math.floor(year / 100   )
							__lowerCamelCase      :      List[str]         =math.floor((13 + 8 * leap_day_inhibits) / 25   )
							__lowerCamelCase      :      Any         =leap_day_inhibits / 4
							__lowerCamelCase      :      Optional[Any]         =(
							    15 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
							) % 30
							__lowerCamelCase      :      Optional[Any]         =(4 + leap_day_inhibits - leap_day_reinstall_number) % 7

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

							# PHM -> Paschal Full Moon
							__lowerCamelCase      :      str         =(
							    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):
														_UpperCamelCase							=      'will be' if year > datetime.now().year else 'was'
														print(f'''Easter in {year} {tense} {gauss_easter(year)}''')




