





A_												=     [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
A_												=     [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
A_												=     {
    0: "Sunday",
    1: "Monday",
    2: "Tuesday",
    3: "Wednesday",
    4: "Thursday",
    5: "Friday",
    6: "Saturday",
}





def    __UpperCamelCase      (    a,     a,     a) ->str:
					assert len(str(a)) > 2, "year should be in YYYY format"
					assert 1 <= month <= 12, "month should be between 1 to 12"
					assert 1 <= day <= 31, "day should be between 1 to 31"

					# Doomsday algorithm:
					lowerCamelCase__       =       year // 100
					lowerCamelCase__       =       (5 * (century % 4) + 2) % 7
					lowerCamelCase__       =       year % 100
					lowerCamelCase__       =       centurian % 12
					lowerCamelCase__       =       (
					    (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
					) % 7
					lowerCamelCase__       =       (
					    DOOMSDAY_NOT_LEAP[month - 1]
					    if (year % 4 != 0) or (centurian == 0 and (year % 400) == 0)
					    else DOOMSDAY_LEAP[month - 1]
					)
					lowerCamelCase__       =       (dooms_day + day - day_anchor) % 7
					return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
						import doctest

						doctest.testmod()








import importlib

import torch
import yaml
from omegaconf import OmegaConf
from taming.models.vqgan import VQModel





def    __UpperCamelCase      (    a,     a=False) ->Optional[Any]:
					lowerCamelCase__       =       OmegaConf.load(a)
					if display:
										print(yaml.dump(OmegaConf.to_container(a)))
					return config





def    __UpperCamelCase      (    a,     a=None,     a=None) ->List[Any]:
					if conf_path is None:
										lowerCamelCase__       =       "./model_checkpoints/vqgan_only.yaml"
					lowerCamelCase__       =       load_config(a,     display=a)
					lowerCamelCase__       =       VQModel(**config.model.params)
					if ckpt_path is None:
										lowerCamelCase__       =       "./model_checkpoints/vqgan_only.pt"
					lowerCamelCase__       =       torch.load(a,     map_location=a)
					if ".ckpt" in ckpt_path:
										lowerCamelCase__       =       sd["state_dict"]
					model.load_state_dict(a,     strict=a)
					model.to(a)
					del sd
					return model





def    __UpperCamelCase      (    a,     a) ->int:
					lowerCamelCase__    ,		lowerCamelCase__    ,		lowerCamelCase__       =       model.encode(a)
					print(f"VQGAN --- {model.__class__.__name__}: latent shape: {z.shape[2:]}")
					lowerCamelCase__       =       model.decode(a)
					return xrec





def    __UpperCamelCase      (    a,     a=False) ->Dict:
					lowerCamelCase__    ,		lowerCamelCase__       =       string.rsplit(".",     1)
					if reload:
										lowerCamelCase__       =       importlib.import_module(a)
										importlib.reload(a)
					return getattr(importlib.import_module(a,     package=a),     cls)





def    __UpperCamelCase      (    a) ->int:
					if "target" not in config:
										raise KeyError("Expected key `target` to instantiate.")
					return get_obj_from_str(config["target"])(**config.get("params",     {}))





def    __UpperCamelCase      (    a,     a,     a=True,     a=True) ->Optional[Any]:
					lowerCamelCase__       =       instantiate_from_config(a)
					if sd is not None:
										model.load_state_dict(a)
					if gpu:
										model.cuda()
					if eval_mode:
										model.eval()
					return {"model": model}







def    __UpperCamelCase      (    a,     a,     a,     a) ->Dict:
					# load the specified checkpoint
					if ckpt:
										lowerCamelCase__       =       torch.load(a,     map_location="cpu")
										lowerCamelCase__       =       pl_sd["global_step"]
										print(f"loaded model from global step {global_step}.")
					else:
										lowerCamelCase__       =       {"state_dict": None}
										lowerCamelCase__       =       None
					lowerCamelCase__       =       load_model_from_config(config.model,     pl_sd["state_dict"],     gpu=a,     eval_mode=a)["model"]
					return model, global_step

