dome272 / Diffusion-Models-pytorch

Pytorch implementation of Diffusion Models (https://arxiv.org/pdf/2006.11239.pdf)
Apache License 2.0
1.11k stars 256 forks source link

Big Refactor #1

Open tcapelle opened 1 year ago

tcapelle commented 1 year ago

Hey, this code has made me play and have so much fun =) I refactored the code to do multiple things:

Please take a look, and feel free to contact me.

dome272 commented 1 year ago

Hey this is an awesome addition and thank you so much for the work. The only problem I have is that people might be confused who are coming from the video and suddenly see so much new code. As a result I probably will push your code to a new branch. Im very keen to try all of this out!

tcapelle commented 1 year ago

I know, but this is very cool as it produces a nice wandb.workspace, you can see the logging of the run here: https://wandb.ai/capecape/train_sd?workspace=user-capecape

tcapelle commented 1 year ago

I am writing an article based on your code and video: https://wandb.ai/capecape/train_sd/reports/Training-a-Conditional-Diffusion-model-from-scratch--VmlldzoyODMxNjE3

dome272 commented 1 year ago

Very very cool. Thank you!! I added a reference to your repo and blog in the readme

noushineftekhari commented 11 months ago

I am writing an article based on your code and video: https://wandb.ai/capecape/train_sd/reports/Training-a-Conditional-Diffusion-model-from-scratch--VmlldzoyODMxNjE3

Hello, Can I ask why we have three.PT files after training? Which one is for test and did you used diffusion for feature representation?

tcapelle commented 10 months ago

https://wandb.ai/capecape/train_sd/reports/How-To-Train-a-Conditional-Diffusion-Model-From-Scratch--VmlldzoyNzIzNTQ1

noushineftekhari commented 10 months ago

Hi Thank you for the link.

I have another question. I run the model and I have the following weight: @.***

No I am trying to test the model I used the below script: n = 10 device = "cpu" model = UNet_conditional(num_classes=4).to(device)

ckpt = torch.load(r"models\DDPM_conditional\ckpt.pt")

file_path = r"C:\Users\noueft\Downloads\256x256_classifier.pt" if os.path.exists(file_path): ckpt = torch.load(file_path) else: print("The file does not exist at the specified path.") model.load_state_dict(ckpt) diffusion = Diffusion(img_size=64, device=device) y = torch.Tensor([6] * n).long().to(device) x = diffusion.sample(model, n, y, cfg_scale=3) plot_images(x)

But the following error : n = len(labels) TypeError: object of type 'int' has no len()

I have the classes in separate folder:

@.***

Can you help me with it?

From: Thomas Capelle @.> Sent: Monday, October 23, 2023 8:14 AM To: dome272/Diffusion-Models-pytorch @.> Cc: Eftekhari, Noushin @.>; Comment @.> Subject: Re: [dome272/Diffusion-Models-pytorch] Big Refactor (PR #1)

CAUTION: External email. Ensure this message is from a trusted source before clicking links/attachments.

https://wandb.ai/capecape/train_sd/reports/How-To-Train-a-Conditional-Diffusion-Model-From-Scratch--VmlldzoyNzIzNTQ1

- Reply to this email directly, view it on GitHubhttps://github.com/dome272/Diffusion-Models-pytorch/pull/1#issuecomment-1774566262, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOJFARL7TAF2WBTXKBRCBWLYAYKMTAVCNFSM6AAAAAAQ2LFQHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZUGU3DMMRWGI. You are receiving this because you commented.Message ID: @.***>