denoising diffusion implicit models

Providerkeras-io
Categoryspeech-enhancement
LicenseApache-2.0
Downloads40
Stars0

Overview

Denoising Diffusion Implicit Models (DDIMs) offer a significant optimization over traditional diffusion probabilistic models by introducing a non-Markovian forward process. For developers, the primary advantage is sampling speed: DDIMs can generate high-quality outputs in far fewer steps without sacrificing sample quality, effectively bypassing the slow iterative nature of standard DDPMs. In the context of speech enhancement, this allows for faster noise reduction and signal reconstruction during inference. The model is available via keras-io under the Apache-2.0 license, ensuring easy integration into existing Python pipelines and commercial flexibility. It serves as a deterministic alternative to stochastic sampling, making results more reproducible and computationally efficient for real-time audio processing applications.

Highlights

  • Faster inference via accelerated non-Markovian sampling
  • Deterministic generation improves output reproducibility
  • Optimized for high-fidelity speech enhancement tasks
  • Permissive Apache-2.0 license for commercial deployment
  • Seamless integration through the Keras ecosystem

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("keras-io/denoising-diffusion-implicit-models")
tokenizer = AutoTokenizer.from_pretrained("keras-io/denoising-diffusion-implicit-models")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download keras-io/denoising-diffusion-implicit-models

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download keras-io/denoising-diffusion-implicit-models config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('keras-io/denoising-diffusion-implicit-models')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/keras-io/denoising-diffusion-implicit-models

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/keras-io/denoising-diffusion-implicit-models

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('keras-io/denoising-diffusion-implicit-models')
tokenizer = AutoTokenizer.from_pretrained('keras-io/denoising-diffusion-implicit-models')

Full Documentation

来源: HuggingFace

---
library_name: tf-keras
tags:

  • generative

  • denoising

  • diffusion

  • ddim

  • ddpm

  • unconditional-image-generation

---

This model was created for the Keras code example on denoising diffusion implicit models (DDIM).

Model description

The model uses a U-Net with identical input and output dimensions. It progressively downsamples and upsamples its input image, adding skip connections between layers having the same resolution. The architecture is a simplified version of the architecture of DDPM. It consists of convolutional residual blocks and lacks attention layers. The network takes two inputs, the noisy images and the variances of their noise components, which it encodes using sinusoidal embeddings.

Intended uses & limitations

The model is intended for educational purposes, as a simple example of denoising diffusion generative models. It has modest compute requirements with reasonable natural image generation performance.

Training and evaluation data

The model is trained on the Oxford Flowers 102 dataset for generating images, which is a diverse natural dataset containing around 8,000 images of flowers. Since the official splits are imbalanced (most of the images are contained in the test splite), new random splits were created (80% train, 20% validation) for training the model. Center crops were used for preprocessing.

Training procedure

The model is trained to denoise noisy images, and can generate images by iteratively denoising pure Gaussian noise.

For more details check out the Keras code example, or the companion code repository, with additional features..

Training hyperparameters

| Hyperparameters | Value |
| :-- | :-- |
| num epochs | 80 |
| dataset repetitions per epoch| 5 |
| image resolution | 64 |
| min signal rate | 0.02 |
| max signal rate | 0.95 |
| embedding dimensions | 32 |
| embedding max frequency | 1000.0 |
| block widths | 32, 64, 96, 128 |
| block depth | 2 |
| batch size | 64 |
| exponential moving average | 0.999 |
| optimizer | AdamW |
| learning rate | 1e-3 |
| weight decay | 1e-4 |

## Model plot

<details>
<summary>View model plot</summary>

!network architecture residual unet

</details>

Join our Telegram