Skip to content

Latest commit

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

MosaicML Benchmark for Stable Diffusion

This repo provides code for benchmarking Stable Diffusion using Streaming, Composer, and MosaicML Cloud. The benchmarking results are presented in this blog post, but the table is duplicated below.

Number of A100sThroughput (images / second)Days to Train on MosaicML CloudA100-hoursApprox. Cost on MosaicML Cloud
8128.2258.8349,696$99,000
16254.0130.6350,166$100,000
32485.768.3352,470$105,000
64912.236.3855,875$110,000
1281618.420.562,987$125,000
2562,589.412.8378,735$160,000

In this repo, you will find:

  • benchmark.py - defines the Stable Diffusion ComposerModel and the Composer Trainer.
  • data.py - defines the MosaicML Stremaing LAION dataset and a synthetic dataset as an alternative to streaming data.
  • ema.py - a memory-efficient version of Composer's EMA algorithm
  • mcloud.yaml - examples of how to use MosaicML Cloud to launch a training run.

If you are interested in using the MosaicML Cloud, sign up for a demo here!

Prerequistes

Install required dependencies using pip install -r requirements.txt

If you would like to use xFormers install it using (we specify a commit we know will work):

pip install -v -U git+https://github.com/facebookresearch/xformers.git@3df785ce54114630155621e2be1c2fa5037efa27#egg=xformers

Benchmarking

To benchmark without using a streaming dataset:

composer benchmark.py --use_ema --use_synth_data --device_train_microbatch_size 4

device_train_microbatch_size should be 4 when using a NVIDIA 40GB A100 GPUs and xFormers. If you are not using xFormers, device_train_microbatch_size should be 2. If using a smaller GPU, adjust device_train_microbatch_size as needed

To log benchmark results, set up a Weights and Biases account, then specify the --wandb_name and --wandb_project arguments.

If you want to benchmark using a streaming dataset, specify the --remote argument:

composer benchmark.py --use_ema --device_train_microbatch_size 4 --remote s3://my-bucket/laion/mds

Contact Us

If you run into any problems with the code, please file Github issues directly to this repo.

If you want train diffusion models on MosaicML Cloud, schedule a demo online or email us at demo@mosaicml.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages