examples/research_projects/vqgan-clip/loaders.py/instantiate_from_config
def instantiate_from_config(config):
    if "target" not in config:
        raise KeyError("Expected key `target` to instantiate.")
    return get_obj_from_str(config["target"])(**config.get("params", {}))