Skip to content
/ CAF Public

Official Implementation (Pytorch) of "Constant Acceleration Flow", NeurIPS 2024

Notifications You must be signed in to change notification settings

mlvlab/CAF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Constant Acceleration Flow

Dogyun Park, Sojin Lee, Sihyeon Kim, Taehoon Lee, Youngjoon Hong†, Hyunwoo J. Kim†.

NeurIPS 2024


This repository is an official implementation of "Constant Acceleration Flow" accepted at NeurIPS 2024.

Constant Acceleration Flow (CAF) introduces a novel ODE framework that models the transformation between two distributions using constant acceleration. This approach enables high-quality image generation in a single step. Notably, CAF also achieves high-accuracy single-step inversion, demonstrating its capability to learn precise forward and reverse flows.

✅ TODO

  • Release training code.
  • Release inference (sampling and inversion) code.
  • Release the pre-trained model.

⭐ Results of CAF

Single-step ImageNet 64x64 generation

FID=1.69

Single-step ImageNet 64x64 reconstruction using inversion

Ground Truth

Reconstruction

N=1


⚙️ Enviroment

To install requirements, run:

git clone https://github.com/mlvlab/CAF.git
cd CAF
conda create -n caf python==3.9
conda activate caf
conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=11.8 -c pytorch -c nvidia
pip install -e .

(RECOMMENDED, linux) Install PyTorch 2.2.0 with CUDA 11.8 for xformers, recommended for memory-efficient computation.


🌄 Data Preparation

We have utilized pre-trained EDM models to generate deterministic couplings for training our models. To construct deterministic couplings for CIFAR-10 and ImageNet, we selected $N=18$ and $N=40$, respectively, employing deterministic sampling following the protocol outlined in the EDM repository. For CIFAR-10 and ImageNet, we generated 1M and 3M pairs, respectively, and saved them in NumPy (.npy) format. Each dataset should be organized in the following directory structure:

Data
|-- cifar10_npy
    |-- z0
        |-- data1.npy
        |-- data2.npy
        |-- ...
    |-- z1
        |-- data1.npy
        |-- data2.npy
        |-- ...
    |-- class
        |-- data1.npy
        |-- data2.npy
        |-- ...

It is important to ensure that the z0, z1, and class files correspond to each other by sharing the same filenames. Each triplet (data1.npy in z0, z1, and class) should be aligned to represent a single data pair.


🔥🔥 Training

🔮 Inference

Acknowledgements

This repo is built upon Consistency Models.

About

Official Implementation (Pytorch) of "Constant Acceleration Flow", NeurIPS 2024

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages