ThisisBillhe / tiny-stable-diffusion

Tiny optimized Stable-diffusion that can run on GPUs with just 1GB of VRAM. (Beta)
Other
148 stars 13 forks source link

This repo is based on the official Stable Diffusion repo and its variants, enabling running stable-diffusion on GPU with only 1GB VRAM.

To reduce the VRAM usage, the following opimizations are used:

Installation

Establish a virtual environment and install dependencies as referred to the official repo. The quantized model checkpoint can be downloaded from Google drive

Usage

Only txt2img is supported now.

txt2img

python3 tiny_optimizedSD/tiny_txt2img.py --prompt "A peaceful lakeside cabin with a dock, surrounded by tall pine trees and a clear blue sky" --H 512 --W 512 --seed 27

Arguments

--seed

Seed for image generation, can be used to reproduce previously generated images. Defaults to a random seed if unspecified.

--n_samples

Batch size/amount of images to generate at once.

--n_iter

Run x amount of times

--H & --W

Height & width of the generated image.

--turbo

Increases inference speed at the cost of extra VRAM usage.

--precision autocast or --precision full

Whether to use full or mixed precision

--format png or --format jpg

Output image format

--unet_bs

Batch size for the unet model

Weighted Prompts

Troubleshooting

Green colored output images