'''simple docstring'''

import importlib

import torch
import yaml
from omegaconf import OmegaConf
from taming.models.vqgan import VQModel
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase=False     ):
 lowercase__				:    List[Any]  =					OmegaConf.load(__UpperCamelCase     )
 if display:
  print(yaml.dump(OmegaConf.to_container(__UpperCamelCase     )     )     )
 return config
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase=None		,     UpperCAmelCase=None     ):
 if conf_path is None:
  lowercase__				:    List[str]  =					'''./model_checkpoints/vqgan_only.yaml'''
 lowercase__				:    Optional[Any]  =					load_config(__UpperCamelCase		,     display=__UpperCamelCase     )
 lowercase__				:    int  =					VQModel(**config.model.params     )
 if ckpt_path is None:
  lowercase__				:    List[str]  =					'''./model_checkpoints/vqgan_only.pt'''
 lowercase__				:    str  =					torch.load(__UpperCamelCase		,     map_location=__UpperCamelCase     )
 if ".ckpt" in ckpt_path:
  lowercase__				:    str  =					sd['''state_dict''']
 model.load_state_dict(__UpperCamelCase		,     strict=__UpperCamelCase     )
 model.to(__UpperCamelCase     )
 del sd
 return model
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase     ):
 lowercase__ ,							lowercase__ ,							lowercase__				:    List[Any]  =					model.encode(__UpperCamelCase     )
 print(F"""VQGAN --- {model.__class__.__name__}: latent shape: {z.shape[2:]}"""     )
 lowercase__				:    List[str]  =					model.decode(__UpperCamelCase     )
 return xrec
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase=False     ):
 lowercase__ ,							lowercase__				:    int  =					string.rsplit('''.'''		,     1     )
 if reload:
  lowercase__				:    int  =					importlib.import_module(__UpperCamelCase     )
  importlib.reload(__UpperCamelCase     )
 return getattr(importlib.import_module(__UpperCamelCase		,     package=__UpperCamelCase     )		,     cls     )
def 			__UpperCamelCase       (   UpperCAmelCase     ):
 if "target" not in config:
  raise KeyError('''Expected key `target` to instantiate.'''     )
 return get_obj_from_str(config['''target''']     )(**config.get('''params'''		,     {}     )     )
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase=True		,     UpperCAmelCase=True     ):
 lowercase__				:    int  =					instantiate_from_config(__UpperCamelCase     )
 if sd is not None:
  model.load_state_dict(__UpperCamelCase     )
 if gpu:
  model.cuda()
 if eval_mode:
  model.eval()
 return {"model": model}





def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     ):
 # load the specified checkpoint
 if ckpt:
  lowercase__				:    Dict  =					torch.load(__UpperCamelCase		,     map_location='''cpu'''     )
  lowercase__				:    Union[str, Any]  =					pl_sd['''global_step''']
  print(F"""loaded model from global step {global_step}."""     )
 else:
  lowercase__				:    List[str]  =					{'''state_dict''': None}
  lowercase__				:    Optional[Any]  =					None
 lowercase__				:    Optional[int]  =					load_model_from_config(config.model		,     pl_sd['''state_dict''']		,     gpu=__UpperCamelCase		,     eval_mode=__UpperCamelCase     )['''model''']
 return model, global_step


import math
from datetime import datetime, timedelta


def    a__       (						__UpperCamelCase ):
      SCREAMING_SNAKE_CASE_      =     year % 1_9
      SCREAMING_SNAKE_CASE_      =     year % 4
      SCREAMING_SNAKE_CASE_      =     year % 7
      SCREAMING_SNAKE_CASE_      =     math.floor(year / 1_0_0 )
      SCREAMING_SNAKE_CASE_      =     math.floor((1_3 + 8 * leap_day_inhibits) / 2_5 )
      SCREAMING_SNAKE_CASE_      =     leap_day_inhibits / 4
      SCREAMING_SNAKE_CASE_      =     (
          1_5 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
      ) % 3_0
      SCREAMING_SNAKE_CASE_      =     (4 + leap_day_inhibits - leap_day_reinstall_number) % 7

      # days to be added to March 21
      SCREAMING_SNAKE_CASE_      =     (1_9 * metonic_cycle + secular_moon_shift) % 3_0

      # PHM -> Paschal Full Moon
      SCREAMING_SNAKE_CASE_      =     (
          2 * julian_leap_year
          + 4 * non_leap_year
          + 6 * days_to_add
          + century_starting_point
      ) % 7

      if days_to_add == 2_9 and days_from_phm_to_sunday == 6:
            return datetime(__UpperCamelCase   ,					4   ,					1_9 )
      elif days_to_add == 2_8 and days_from_phm_to_sunday == 6:
            return datetime(__UpperCamelCase   ,					4   ,					1_8 )
      else:
            return datetime(__UpperCamelCase   ,					3   ,					2_2 ) + timedelta(
                days=int(days_to_add + days_from_phm_to_sunday ) )


if __name__ == "__main__":
      for year in (19_94, 20_00, 20_10, 20_21, 20_23):
            A   :     Dict       =				"will be" if year > datetime.now().year else "was"
            print(f"Easter in {year} {tense} {gauss_easter(year)}")


