swookey-thinky/xdiffusion

A unified media (Image, Video, Audio, Text) diffusion repository, for education and learning.

Python

47

249 commits

updated Apr 5, 2025

See the code

README

xdiffusion

A unified media (Image, Video, Audio, Text) diffusion repository, for education and learning.

If you are looking for just the lessons on image diffusion models, checkout mindiffusion for more image diffusion model paper implementations.

Requirements

This package built using PyTorch and written in Python 3. Due to package dependencies, this repo requires python 3.10 or greater. To setup an environment to run all of the lessons, we suggest using conda or venv:

> python3 -m venv xdiffusion_env
> source xdiffusion_env/bin/activate
> pip install --upgrade pip
> pip install -r requirements.txt

I find pyenv-virtualenv to be very helpful as well, in managing both the virtual environment as well as the python version dependencies.

> pyenv install 3.10.15
> pyenv virtualenv 3.10.15 xdiffusion_env
> pyvenv activate xdiffusion_env     
> pip install --upgrade pip
> pip install -r requirements.txt

All lessons are designed to be run from the root of the repository, and you should set your python path to include the repository root:

> export PYTHONPATH=$(pwd)

If you have issues with PyTorch and different CUDA versions on your instance, make sure to install the correct version of PyTorch for the CUDA version on your machine. For example, if you have CUDA 11.8 installed, you can install PyTorch using:

> pip install torch==2.1.0 torchvision --index-url https://download.pytorch.org/whl/cu118

Image Diffusion

Training Datasets

In this repository, we will be working with the MNIST dataset because it is simple and can be trained in real time with minimal GPU power and memory. The main difference between MNIST and other datasets is the single channel of the imagery, versus 3 channels in most other datasets. We will make sure that the models we build can easily accomodate 1- or 3-channel data, so that you can test the models we build on other datasets.

Image Models

The following is a list of the supported image models, their current results, and a link to their configuration files and documentation.

DateNamePaperConfigResultsInstructions
June 2020DDPMDenoising Diffusion Probabilistic ModelsconfigDDPMinstructions
November 2020Score-SDEScore-Based Generative Modeling through Stochastic Differential EquationsconfigSub-VPE SDEinstructions
July 2021D3PMStructured Denoising Diffusion Models in Discrete State-Spaces
May 2022ImagenPhotorealistic Text-to-Image Diffusion Models with Deep Language UnderstandingconfigImageninstructions
June 2022EDMElucidating the Design Space of Diffusion-Based Generative ModelsconfigEDMinstructions
September 2022Rectified FlowFlow Straight and Fast: Learning to Generate and Transfer Data with Rectified FlowconfigRectified Flowinstructions
December 2022LoRALoRA: Low-Rank Adaptation of Large Language Models-LoRAinstructions
December 2022DiTScalable Diffusion Models with TransformersconfigDiTinstructions
March 2023Consistency ModelsConsistency ModelsconfigConsistency Modelinstructions
September 2023PixArt-αPixArt-α: Fast Training of Diffusion Transformer for Photorealistic Text-to-Image SynthesisconfigPixart-Alphainstructions
November 2023DiffuSSMDiffusion Models Without AttentionconfigDiffuSSMinstructions
March 2024Stable Diffusion 3Scaling Rectified Flow Transformers for High-Resolution Image SynthesisconfigSD3instructions
July 2024AuraFlowIntroducing AuraFlow v0.1, an Open Exploration of Large Rectified Flow ModelsconfigAuraFlowinstructions
August 2024FluxFlux AnnouncementconfigFluxinstructions
October 2024SanaSANA: Efficient High-Resolution Image Synthesis with Linear Diffusion TransformersconfigSanainstructions
October 2024Stable Diffusion 3.5Introducing Stable Diffusion 3.5configSD 3.5instructions
November 2024Training-free Regional Prompting for Diffusion Transformers
November 2024JanusFlowJanusFlow: Harmonizing Autoregression and Rectified Flow for Unified Multimodal Understanding and Generation
March 2025Dynamic TanhTransformers Without NormalizationconfigFluxinstructions

Video Diffusion

Training Datasets

Due to the resource constraints of most models, we have decided to use the Moving MNIST dataset to train on. Moving MNIST is a simple dataset similar to MNIST, of digits which move around the screen. It is an unlabeled dataset, so we do not have access to text labels to determine which digits are moving around the screen, but we will address that deficiency as well. We train at a reduced resolution of 32x32, due to the resource constraints that most models require. This allows us to train most diffusion models on a T4 instance, which is free to run on Google Colab. We limit training and sample generation to 16 frames, even though the source dataset contains 20 frames.

Sample from the original dataset:

Moving MNIST

Video Diffusion Models

The following is a list of the supported video models, their current results, and a link to their configuration files and documentation.

DateNamePaperConfigResultsInstructions
April 2022Video Diffusion ModelsVideo Diffusion ModelsconfigVideo Diffusion Modelsinstructions
May 2022CogVideoCogVideo: Large-scale Pretraining for Text-to-Video Generation via Transformers
May 2022FDMFlexible Diffusion Modeling of Long VideosconfigFlexible Diffusion Modelsinstructions
September 2022Make-A-VideoMake-A-Video: Text-to-Video Generation without Text-Video DataconfigMake-A-Videoinstructions
October 2022Imagen VideoImagen Video: High Definition Video Generation with Diffusion ModelsconfigImagen Videoinstructions
October 2022PhenakiPhenaki: Variable Length Video Generation From Open Domain Textual Description
December 2022Tune-A-VideoTune-A-Video: One-Shot Tuning of Image Diffusion Models for Text-to-Video Generation
February 2023Gen-1Structure and Content-Guided Video Synthesis with Diffusion Models
March 2023Text2Video-ZeroText2Video-Zero: Text-to-Image Diffusion Models are Zero-Shot Video Generators
April 2023Video LDMAlign your Latents: High-Resolution Video Synthesis with Latent Diffusion ModelsconfigVideo LDMinstructions
May 2023Control-VideoControlVideo: Training-free Controllable Text-to-Video Generation
May 2023PYoCoPreserve Your Own Correlation: A Noise Prior for Video Diffusion Models
July 2023AnimateDiffAnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific TuningconfigAnimate Diffinstructions
August 2023ModelScopeT2VModelScope Text-to-Video Technical Report
September 2023Show-1Show-1: Marrying Pixel and Latent Diffusion Models for Text-to-Video Generation
September 2023LaVieLAVIE: High-Quality Video Generation with Cascaded Latent Diffusion Models
October 2023VideoCrafter 1VideoCrafter1: Open Diffusion Models for High-Quality Video Generation
November 2023Emu VideoEmu Video: Factorizing Text-to-Video Generation by Explicit Image Conditioning
November 2023Decouple Content and Motion for Conditional Image-to-Video Generation
November 2023Stable Video DiffusionStable Video Diffusion: Scaling Latent Video Diffusion Models to Large Datasets
December 2023VideoBoothVideoBooth: Diffusion-based Video Generation with Image Prompts
December 2023LivePhotoLivePhoto: Real Image Animation with Text-guided Motion Control
December 2023HiGenHierarchical Spatio-temporal Decoupling for Text-to-Video Generation
December 2023AnimateZeroAnimateZero: Video Diffusion Models are Zero-Shot Image Animators
December 2023W.A.L.TPhotorealistic Video Generation with Diffusion Models
December 2023VideoLCMVideoLCM: Video Latent Consistency Model
December 2023GenTronGenTron: Diffusion Transformers for Image and Video Generation
January 2024LatteLatte: Latent Diffusion Transformer for Video Generation
January 2024VideoCrafter 2VideoCrafter2: Overcoming Data Limitations for High-Quality Video Diffusion Models
January 2024LumiereLumiere: A Space-Time Diffusion Model for Video Generation
February 2024AnimateLCMAnimateLCM: Accelerating the Animation of Personalized Diffusion Models and Adapters with Decoupled Consistency Learning
February 2024Video-LaVITVideo-LaVIT: Unified Video-Language Pre-training with Decoupled Visual-Motional Tokenization
February 2024Snap VideoSnap Video: Scaled Spatiotemporal Transformers for Text-to-Video Synthesis
February 2024SORAVideo generation models as world simulators alternativeconfigSORAinstructions
April 2024TI2V-ZeroTI2V-Zero: Zero-Shot Image Conditioning for Text-to-Video Diffusion Models
May 2024ViduVidu: a Highly Consistent, Dynamic and Skilled Text-to-Video Generator with Diffusion Models
May 2024FIFO-DiffusionFIFO-Diffusion: Generating Infinite Videos from Text without Training
May 2024MOFA-VIdeoMOFA-Video: Controllable Image Animation via Generative Motion Field Adaptions in Frozen Image-to-Video Diffusion Model
May 2024T2V-TurboT2V-Turbo: Breaking the Quality Bottleneck of Video Consistency Model with Mixed Reward Feedback
July 2024Diffusion ForcingDiffusion Forcing: Next-token Prediction Meets Full-Sequence Diffusion
August 2024GameNGenDiffusion Models Are Real-Time Game Engines
August 2024CogVideoXCogVideoX: Text-to-Video Diffusion Models with An Expert Transformer
October 2024Movie-GenMovie Gen: A Cast of Media Foundation Models
October 2024Pyramid FlowPyramidal Flow Matching for Efficient Video Generative Modeling
October 2024T2V-Turbo-v2T2V-Turbo-v2: Enhancing Video Generation Model Post-Training through Data, Reward, and Conditional Guidance Design
December 2024LTX VideoLTX-Video: Realtime Video Latent DiffusionconfigLTX Videoinstructions

Audio Diffusion

Audio Diffusion Models

The following is a list of the supported audio diffusion models, their current results, and a link to their configuration files and documentation.

TODO

  • Port the image diffusion repository
  • Port the video diffusion respository
  • Unify all of the different attention mechanisms under Transformer based (B, L, D) and pixel based (B, C, H, W).

Contributors

swookey-thinky

238 commits

hlnull

3 commits

swookey-thinky/xdiffusion

A unified media (Image, Video, Audio, Text) diffusion repository, for education and learning.

Python

47

249 commits

updated Apr 5, 2025

See the code

README

xdiffusion

A unified media (Image, Video, Audio, Text) diffusion repository, for education and learning.

If you are looking for just the lessons on image diffusion models, checkout mindiffusion for more image diffusion model paper implementations.

Requirements

This package built using PyTorch and written in Python 3. Due to package dependencies, this repo requires python 3.10 or greater. To setup an environment to run all of the lessons, we suggest using conda or venv:

> python3 -m venv xdiffusion_env
> source xdiffusion_env/bin/activate
> pip install --upgrade pip
> pip install -r requirements.txt

I find pyenv-virtualenv to be very helpful as well, in managing both the virtual environment as well as the python version dependencies.

> pyenv install 3.10.15
> pyenv virtualenv 3.10.15 xdiffusion_env
> pyvenv activate xdiffusion_env     
> pip install --upgrade pip
> pip install -r requirements.txt

All lessons are designed to be run from the root of the repository, and you should set your python path to include the repository root:

> export PYTHONPATH=$(pwd)

If you have issues with PyTorch and different CUDA versions on your instance, make sure to install the correct version of PyTorch for the CUDA version on your machine. For example, if you have CUDA 11.8 installed, you can install PyTorch using:

> pip install torch==2.1.0 torchvision --index-url https://download.pytorch.org/whl/cu118

Image Diffusion

Training Datasets

In this repository, we will be working with the MNIST dataset because it is simple and can be trained in real time with minimal GPU power and memory. The main difference between MNIST and other datasets is the single channel of the imagery, versus 3 channels in most other datasets. We will make sure that the models we build can easily accomodate 1- or 3-channel data, so that you can test the models we build on other datasets.

Image Models

The following is a list of the supported image models, their current results, and a link to their configuration files and documentation.

DateNamePaperConfigResultsInstructions
June 2020DDPMDenoising Diffusion Probabilistic ModelsconfigDDPMinstructions
November 2020Score-SDEScore-Based Generative Modeling through Stochastic Differential EquationsconfigSub-VPE SDEinstructions
July 2021D3PMStructured Denoising Diffusion Models in Discrete State-Spaces
May 2022ImagenPhotorealistic Text-to-Image Diffusion Models with Deep Language UnderstandingconfigImageninstructions
June 2022EDMElucidating the Design Space of Diffusion-Based Generative ModelsconfigEDMinstructions
September 2022Rectified FlowFlow Straight and Fast: Learning to Generate and Transfer Data with Rectified FlowconfigRectified Flowinstructions
December 2022LoRALoRA: Low-Rank Adaptation of Large Language Models-LoRAinstructions
December 2022DiTScalable Diffusion Models with TransformersconfigDiTinstructions
March 2023Consistency ModelsConsistency ModelsconfigConsistency Modelinstructions
September 2023PixArt-αPixArt-α: Fast Training of Diffusion Transformer for Photorealistic Text-to-Image SynthesisconfigPixart-Alphainstructions
November 2023DiffuSSMDiffusion Models Without AttentionconfigDiffuSSMinstructions
March 2024Stable Diffusion 3Scaling Rectified Flow Transformers for High-Resolution Image SynthesisconfigSD3instructions
July 2024AuraFlowIntroducing AuraFlow v0.1, an Open Exploration of Large Rectified Flow ModelsconfigAuraFlowinstructions
August 2024FluxFlux AnnouncementconfigFluxinstructions
October 2024SanaSANA: Efficient High-Resolution Image Synthesis with Linear Diffusion TransformersconfigSanainstructions
October 2024Stable Diffusion 3.5Introducing Stable Diffusion 3.5configSD 3.5instructions
November 2024Training-free Regional Prompting for Diffusion Transformers
November 2024JanusFlowJanusFlow: Harmonizing Autoregression and Rectified Flow for Unified Multimodal Understanding and Generation
March 2025Dynamic TanhTransformers Without NormalizationconfigFluxinstructions

Video Diffusion

Training Datasets

Due to the resource constraints of most models, we have decided to use the Moving MNIST dataset to train on. Moving MNIST is a simple dataset similar to MNIST, of digits which move around the screen. It is an unlabeled dataset, so we do not have access to text labels to determine which digits are moving around the screen, but we will address that deficiency as well. We train at a reduced resolution of 32x32, due to the resource constraints that most models require. This allows us to train most diffusion models on a T4 instance, which is free to run on Google Colab. We limit training and sample generation to 16 frames, even though the source dataset contains 20 frames.

Sample from the original dataset:

Moving MNIST

Video Diffusion Models

The following is a list of the supported video models, their current results, and a link to their configuration files and documentation.

DateNamePaperConfigResultsInstructions
April 2022Video Diffusion ModelsVideo Diffusion ModelsconfigVideo Diffusion Modelsinstructions
May 2022CogVideoCogVideo: Large-scale Pretraining for Text-to-Video Generation via Transformers
May 2022FDMFlexible Diffusion Modeling of Long VideosconfigFlexible Diffusion Modelsinstructions
September 2022Make-A-VideoMake-A-Video: Text-to-Video Generation without Text-Video DataconfigMake-A-Videoinstructions
October 2022Imagen VideoImagen Video: High Definition Video Generation with Diffusion ModelsconfigImagen Videoinstructions
October 2022PhenakiPhenaki: Variable Length Video Generation From Open Domain Textual Description
December 2022Tune-A-VideoTune-A-Video: One-Shot Tuning of Image Diffusion Models for Text-to-Video Generation
February 2023Gen-1Structure and Content-Guided Video Synthesis with Diffusion Models
March 2023Text2Video-ZeroText2Video-Zero: Text-to-Image Diffusion Models are Zero-Shot Video Generators
April 2023Video LDMAlign your Latents: High-Resolution Video Synthesis with Latent Diffusion ModelsconfigVideo LDMinstructions
May 2023Control-VideoControlVideo: Training-free Controllable Text-to-Video Generation
May 2023PYoCoPreserve Your Own Correlation: A Noise Prior for Video Diffusion Models
July 2023AnimateDiffAnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific TuningconfigAnimate Diffinstructions
August 2023ModelScopeT2VModelScope Text-to-Video Technical Report
September 2023Show-1Show-1: Marrying Pixel and Latent Diffusion Models for Text-to-Video Generation
September 2023LaVieLAVIE: High-Quality Video Generation with Cascaded Latent Diffusion Models
October 2023VideoCrafter 1VideoCrafter1: Open Diffusion Models for High-Quality Video Generation
November 2023Emu VideoEmu Video: Factorizing Text-to-Video Generation by Explicit Image Conditioning
November 2023Decouple Content and Motion for Conditional Image-to-Video Generation
November 2023Stable Video DiffusionStable Video Diffusion: Scaling Latent Video Diffusion Models to Large Datasets
December 2023VideoBoothVideoBooth: Diffusion-based Video Generation with Image Prompts
December 2023LivePhotoLivePhoto: Real Image Animation with Text-guided Motion Control
December 2023HiGenHierarchical Spatio-temporal Decoupling for Text-to-Video Generation
December 2023AnimateZeroAnimateZero: Video Diffusion Models are Zero-Shot Image Animators
December 2023W.A.L.TPhotorealistic Video Generation with Diffusion Models
December 2023VideoLCMVideoLCM: Video Latent Consistency Model
December 2023GenTronGenTron: Diffusion Transformers for Image and Video Generation
January 2024LatteLatte: Latent Diffusion Transformer for Video Generation
January 2024VideoCrafter 2VideoCrafter2: Overcoming Data Limitations for High-Quality Video Diffusion Models
January 2024LumiereLumiere: A Space-Time Diffusion Model for Video Generation
February 2024AnimateLCMAnimateLCM: Accelerating the Animation of Personalized Diffusion Models and Adapters with Decoupled Consistency Learning
February 2024Video-LaVITVideo-LaVIT: Unified Video-Language Pre-training with Decoupled Visual-Motional Tokenization
February 2024Snap VideoSnap Video: Scaled Spatiotemporal Transformers for Text-to-Video Synthesis
February 2024SORAVideo generation models as world simulators alternativeconfigSORAinstructions
April 2024TI2V-ZeroTI2V-Zero: Zero-Shot Image Conditioning for Text-to-Video Diffusion Models
May 2024ViduVidu: a Highly Consistent, Dynamic and Skilled Text-to-Video Generator with Diffusion Models
May 2024FIFO-DiffusionFIFO-Diffusion: Generating Infinite Videos from Text without Training
May 2024MOFA-VIdeoMOFA-Video: Controllable Image Animation via Generative Motion Field Adaptions in Frozen Image-to-Video Diffusion Model
May 2024T2V-TurboT2V-Turbo: Breaking the Quality Bottleneck of Video Consistency Model with Mixed Reward Feedback
July 2024Diffusion ForcingDiffusion Forcing: Next-token Prediction Meets Full-Sequence Diffusion
August 2024GameNGenDiffusion Models Are Real-Time Game Engines
August 2024CogVideoXCogVideoX: Text-to-Video Diffusion Models with An Expert Transformer
October 2024Movie-GenMovie Gen: A Cast of Media Foundation Models
October 2024Pyramid FlowPyramidal Flow Matching for Efficient Video Generative Modeling
October 2024T2V-Turbo-v2T2V-Turbo-v2: Enhancing Video Generation Model Post-Training through Data, Reward, and Conditional Guidance Design
December 2024LTX VideoLTX-Video: Realtime Video Latent DiffusionconfigLTX Videoinstructions

Audio Diffusion

Audio Diffusion Models

The following is a list of the supported audio diffusion models, their current results, and a link to their configuration files and documentation.

TODO

  • Port the image diffusion repository
  • Port the video diffusion respository
  • Unify all of the different attention mechanisms under Transformer based (B, L, D) and pixel based (B, C, H, W).

Contributors

swookey-thinky

238 commits

hlnull

3 commits

Languages

Python

99.6%