def __init__(
        self,
        iterations=10,
        lr=0.01,
        vqgan=None,
        vqgan_config=None,
        vqgan_checkpoint=None,
        clip=None,
        clip_preprocessor=None,
        device=None,
        log=False,
        save_vector=True,
        return_val="image",
        quantize=True,
        save_intermediate=False,
        show_intermediate=False,
        make_grid=False,
    ) -> None:
        """
        Instantiate a VQGAN_CLIP model. If you want to use a custom VQGAN model, pass it as vqgan.
        """
        super().__init__()
        self.latent = None
        self.device = device if device else get_device()
        if vqgan:
            self.vqgan = vqgan
        else:
            self.vqgan = load_vqgan(self.device, conf_path=vqgan_config, ckpt_path=vqgan_checkpoint)
        self.vqgan.eval()
        if clip:
            self.clip = clip
        else:
            self.clip = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
        self.clip.to(self.device)
        self.clip_preprocessor = ProcessorGradientFlow(device=self.device)

        self.iterations = iterations
        self.lr = lr
        self.log = log
        self.make_grid = make_grid
        self.return_val = return_val
        self.quantize = quantize
        self.latent_dim = self.vqgan.decoder.z_shape

        Instantiate a VQGAN_CLIP model. If you want to use a custom VQGAN model, pass it as vqgan.
        
dpkd/transformers/examples/research_projects/vqgan-clip/VQGAN_CLIP.py