Skip to content

jinc7461/ADG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ADG: Angle Domain Guidance: Latent Diffusion Requires Rotation Rather Than Extrapolation

This repository contains the official implementation of ADG (Angle Domain Guidance), as presented in our paper accepted at ICML 2025.

πŸ“„ Paper: Angle Domain Guidance: Latent Diffusion Requires Rotation Rather Than Extrapolation
πŸ“ Conference: International Conference on Machine Learning (ICML), 2025


πŸ”§ Overview

Our method is built upon the diffusers library, offering a plug-and-play interface that requires minimal modification to existing workflows. This repository includes:

  • The implementation of the proposed ADG algorithm.
  • Example code to run ADG with Stable Diffusion 3.5-large.
  • Scripts to reproduce key visualization results from the paper.

πŸš€ Quick Start

1. Set Up Environment

# Create and activate conda environment
conda create -n adg python=3.10 -y
conda activate adg
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install diffusers transformers accelerate

2. Run ADG

Run the ADG-enhanced sampling pipeline using the following example:

from diffusers import StableDiffusion3Pipeline
from method.ADG_SD3 import ADG_SD3
import torch

# Load the base pipeline
pipeline = StableDiffusion3Pipeline.from_pretrained(
    "stabilityai/stable-diffusion-3.5-large", torch_dtype=torch.float16
)

# Inject ADG into the pipeline
setattr(pipeline, 'ADG', ADG_SD3.__get__(pipeline))

# Generate an image using ADG
prompt = "what you want"
image = pipeline.ADG(
    prompt=prompt,
    num_inference_steps=10,
    guidance_scale=4,
    num_images_per_prompt=1
).images[0]

image.save("output.jpg")

πŸ“Š Visualization & Reproducibility

To reproduce the key visualizations from the paper and validate experimental results, please refer to vis.ipynb. This notebook demonstrates how ADG enhances consistency and efficiency in diffusion sampling.


πŸ“Ž Citation

If you find this work helpful, please consider citing:

@inproceedings{jinangle,
  title={Angle Domain Guidance: Latent Diffusion Requires Rotation Rather Than Extrapolation},
  author={Jin, Cheng and Xiao, Zhenyu and Liu, Chutao and Gu, Yuantao},
  booktitle={Forty-second International Conference on Machine Learning}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published