def make_animation(self, input_path=None, output_path=None, total_duration=5, extend_frames=True):
        """
        Make an animation from the intermediate images saved during generation.
        By default, uses the images from the most recent generation created by the generate function.
        If you want to use images from a different generation, pass the path to the folder containing the images as input_path.
        """
        images = []
        if output_path is None:
            output_path = "./animation.gif"
        if input_path is None:
            input_path = self.save_path
        paths = sorted(glob(input_path + "/*"))
        if not len(paths):
            raise ValueError(
                "No images found in save path, aborting (did you pass save_intermediate=True to the generate"
                " function?)"
            )
        if len(paths) == 1:
            print("Only one image found in save path, (did you pass save_intermediate=True to the generate function?)")
        frame_duration = total_duration / len(paths)
        durations = [frame_duration] * len(paths)
        if extend_frames:
            durations[0] = 1.5
            durations[-1] = 3
        for file_name in paths:
            if file_name.endswith(".png"):
                images.append(imageio.imread(file_name))
        imageio.mimsave(output_path, images, duration=durations)
        print(f"gif saved to {output_path}")

        Make an animation from the intermediate images saved during generation.
        By default, uses the images from the most recent generation created by the generate function.
        If you want to use images from a different generation, pass the path to the folder containing the images as input_path.
        
dpkd/transformers/examples/research_projects/vqgan-clip/VQGAN_CLIP.py