export MODEL_NAME="CompVis/stable-diffusion-v1-4"
export DATASET_NAME="lambdalabs/pokemon-blip-captions"
accelerate launch --mixed_precision="fp16" train_text_to_image.py \
--pretrained_model_name_or_path=$MODEL_NAME --dataset_name=$DATASET_NAME \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Examples: | |
(1) python benchmark_distilled_sd.py --pipeline_id CompVis/stable-diffusion-v1-4 | |
(2) python benchmark_distilled_sd.py --pipeline_id CompVis/stable-diffusion-v1-4 --vae_path sayakpaul/taesd-diffusers | |
(3) python benchmark_distilled_sd.py --pipeline_id nota-ai/bk-sdm-small | |
(4) python benchmark_distilled_sd.py --pipeline_id nota-ai/bk-sdm-small --vae_path sayakpaul/taesd-diffusers | |
""" | |
import argparse | |
import time |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run the script, first install `diffusers` like so: | |
# pip install git+https://github.com/huggingface/diffusers@temp/lora-debug | |
# Then grab the LoRA file: | |
# wget https://huggingface.co/datasets/sayakpaul/sample-datasets/resolve/main/vividWatercolors_10.safetensors | |
import torch | |
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://github.com/borisdayma/dalle-mini/blob/main/tools/train/train.py | |
import random | |
from dataclasses import dataclass, field | |
from functools import partial | |
import jax | |
import jax.numpy as jnp | |
import numpy as np | |
from datasets import Dataset, load_dataset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
from optimum.onnxruntime import ORTStableDiffusionPipeline | |
from diffusers import StableDiffusionPipeline | |
import numpy as np | |
model_id = "runwayml/stable-diffusion-v1-5" | |
onnx_model_id = "sayakpaul/onnx-stable-diffusion-v1-5" | |
prompt = "a photo of an astronaut riding a horse on mars" |