uoft-cs/cifar10
Viewer • Updated • 60k • 130k • 105
How to use FrankCCCCC/cfm-cifar10-32 with Diffusers:
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("FrankCCCCC/cfm-cifar10-32", dtype=torch.bfloat16, device_map="cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]A flow matching model for unconditional image generation trained on the CIFAR-10 dataset. This model uses continuous normalizing flows with the FlowMatchEulerDiscreteScheduler for efficient sampling.
The model uses FlowMatchEulerDiscreteScheduler with the following key parameters:
from diffusers import DDPMPipeline
# Load the flow matching model
pipeline = DDPMPipeline.from_pretrained("FrankCCCCC/cfm-cifar10-32")
# Generate an image
image = pipeline().images[0]
image.save("generated_cifar10.png")
from diffusers import DDPMPipeline
pipeline = DDPMPipeline.from_pretrained("FrankCCCCC/cfm-cifar10-32")
# Generate with custom number of inference steps
num_inference_steps: int = 1000
pipeline.scheduler.set_timesteps(num_inference_steps)
image = pipeline().images[0]
image.save("fast_generated_cifar10.png")
from diffusers import DDPMPipeline
pipeline = DDPMPipeline.from_pretrained("FrankCCCCC/cfm-cifar10-32")
# Generate multiple images at once
images = pipeline(batch_size=4).images
for i, image in enumerate(images):
image.save(f"generated_cifar10_{i}.png")
This model implements flow matching, which offers several advantages over standard diffusion models:
pip install diffusers torch torchvision
If you use this model, please cite the original flow matching and diffusion literature:
@inproceedings{DDPM,
author = {Ho, Jonathan and Jain, Ajay and Abbeel, Pieter},
booktitle = {Advances in Neural Information Processing Systems},
title = {Denoising Diffusion Probabilistic Models},
url = {https://proceedings.neurips.cc/paper_files/paper/2020/file/4c5bcfec8584af0d967f1ab10179ca4b-Paper.pdf},
year = {2020}
}
@inproceedings{FM,
title={Flow Matching for Generative Modeling},
author={Yaron Lipman and Ricky T. Q. Chen and Heli Ben-Hamu and Maximilian Nickel and Matthew Le},
booktitle={The Eleventh International Conference on Learning Representations },
year={2023},
url={https://openreview.net/forum?id=PqvMRDCJT9t}
}
Base model
google/ddpm-cifar10-32