Skip to content

mohame54/DDIM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an Implementation for Denoising Diffusion Implicit Models (DDIM)

DDIM is one of the denoising diffusion probabilistic models family but the key difference here it doesn't require a large reverse diffusion time steps to produce the samples or images as you can see from above this gif was created with 25 reverse diffusion time steps.


if you want to train your own model for a specific dataset this colab is for you.

Open In Colab

if you want to try the pretrained model this colab is for you

Open In Colab

Content:


Code to try the pretrained model:

from Diffusion import DiffusionModel, DiffUnet 
import matplotlib.pyplot as plt

net = DiffUnet(block_depth=2) # the Unet model for the diffusion module
model = DiffusionModel(net, num_steps=1000, input_res=[64,64])  # initialize the module with 1000 training steps and img size (64, 64)

model.load("Pretrained") # load the pretrained weights from the weights directory
sample = model.generate(num_samples=1, num_infer_steps=25).cpu().numpy().squeeze() # generate one sample with 25 reverse diffusion steps

sample = model.inverse_transform(sample) # reverse the transformation to better visualize the image

# visualize the image
plt.imshow(sample)
plt.axis("off");

About

This is an Implementation for DDIM paper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages