{"id":24737660,"url":"https://github.com/berlin0308/conditional-ddpm-ddim","last_synced_at":"2026-07-08T04:31:24.436Z","repository":{"id":272886097,"uuid":"918056146","full_name":"berlin0308/Conditional-DDPM-DDIM","owner":"berlin0308","description":"DDPM (Denoising Diffusion Probabilistic Models) and DDIM (Denoising Diffusion Implicit Models) for conditional image generation","archived":false,"fork":false,"pushed_at":"2025-01-17T07:46:28.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T17:45:34.199Z","etag":null,"topics":["classifier-free-guidance","conditional-generation","diffusion-models","digits","human-faces"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/berlin0308.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T06:56:21.000Z","updated_at":"2025-01-17T07:51:36.000Z","dependencies_parsed_at":"2025-01-17T08:33:14.402Z","dependency_job_id":"1ed2770b-bd82-4c69-bae5-700c65f5973f","html_url":"https://github.com/berlin0308/Conditional-DDPM-DDIM","commit_stats":null,"previous_names":["berlin0308/conditional-ddpm-ddim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/berlin0308/Conditional-DDPM-DDIM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlin0308%2FConditional-DDPM-DDIM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlin0308%2FConditional-DDPM-DDIM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlin0308%2FConditional-DDPM-DDIM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlin0308%2FConditional-DDPM-DDIM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berlin0308","download_url":"https://codeload.github.com/berlin0308/Conditional-DDPM-DDIM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlin0308%2FConditional-DDPM-DDIM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271121168,"owners_count":24702723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classifier-free-guidance","conditional-generation","diffusion-models","digits","human-faces"],"created_at":"2025-01-27T22:09:00.295Z","updated_at":"2025-10-25T23:03:51.697Z","avatar_url":"https://github.com/berlin0308.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Conditional Diffusion Models: DDPM and DDIM\n\n## Install Packages\nWith **Python3.8**, run the following command to install all the packages listed in the requirements.txt:\n\n    pip3 install -r requirements.txt\n\n\n## DDPM (Denoising Diffusion Probabilistic Models)\n\n+ All DDPM implementation details are in ```p1_model.py```\n\n+ A modified UNet that supports conditional learning by adding **time embedding** (time steps in the diffusion process) and **context embedding** (labels)\n\n### Train DDPM on MNIST-M / SVHN Dataset\n\n    python3 p1_train.py\n\n### Generate Digit Images\n\nUse the model you just trained **OR** download the pretrained model directly:\n\n    gdown 1uX845gl81kgc-lHqo8SS78DBz8n1DWmS -O combined_ddpm.pth\n\nGenerate images for each digit (0-9) from MNIST-M / SVHN dataset:\n\n    python3 p1_inference.py --output_image_dir \u003cyour_output_dir\u003e --model_path \u003cyour_ddpm_model_path\u003e\n\nFor example:\n\n| MNIST-M | SVHN | \n| -------- | -------- |\n| ![image](https://github.com/user-attachments/assets/b85d71a9-b650-4d5a-ac5b-bfba37b00f18) | ![image](https://github.com/user-attachments/assets/9798dff2-1e7a-4143-aeac-8fd8e5b7059f) |\n\n\n### Evaluation\n\nThe output images can be evaluated by ```digit_classifier.py```\n\n    python3 digit_classifier.py --folder \u003cyour_output_dir\u003e --checkpoint \u003cmnistm_ckpt_path\u003e\n\n|  | MNIST-M | SVHN | Average |\n| -----| -------- | -------- | --- | \n| Acuracy |  99.80%  | 99.20%     | 99.50% |\n\n\n## DDIM (Denoising Diffusion Implicit Models)\n\n+ All DDPM implementation details are in ```p2_model.py```\n\n### Generate Human Face Images\n\n    python3 p2_inference.py --noise_folder \u003cinput_noise_dir\u003e --output_folder \u003cyour_output_dir\u003e --unet_model_path \u003cyour_unet_path\u003e\n\nWith different ETA (Avg. MSE: 1.56):\n\n![image](https://github.com/user-attachments/assets/b557fc0c-60e7-4099-8f81-8e1c858a7a9b)\n\n### Interpolate Two Noises\n\n    python3 p2_interpolate.py\n\n+ Linear interpolation (LERP): Simply linearly mixes the two noise vectors without considering their position on a hypersphere (by setting ```SLERP=False```)\n+ Spherical Linear Interpolation (SLERP): Along the surface of a hypersphere (by setting ```SLERP=True```)\n\n| LERP | SLERP | \n| -------- | -------- |\n| ![image](https://github.com/user-attachments/assets/ae226b9e-ef3e-4eb8-9934-48ea857bea8b) | ![image](https://github.com/user-attachments/assets/b3dcdce6-8ad5-4692-aabe-50f6dc5de5f8) |\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberlin0308%2Fconditional-ddpm-ddim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberlin0308%2Fconditional-ddpm-ddim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberlin0308%2Fconditional-ddpm-ddim/lists"}