Downloads · 30 days
201
2% of all-time downloads
etri-vilab/koala-lightning-700m
koala-lightning-700m is a text-to-image model from etri-vilab. Use it when you need an image from a text prompt. It is set up for diffusers.
<img src="https://dl.dropboxusercontent.com/scl/fi/yosvi68jvyarbvymxc4hm/githublogo.png?rlkey=r9ouwcd7cqxjbvio43q9b3djd&dl=1" width="1024px" / </div -- <div align="center" <img src="https://dl.dropbox.com/scl/fi/e2nii…
Downloads · 30 days
201
2% of all-time downloads
All-time downloads
8.3K
Public
Parameters
783M
21.1 GB on disk
Likes
9
Public
Click a slice to open those files.
.safetensors10.3 GB · 49%
From the Hugging Face model README
| Model | link |
|---|---|
| koala-lightning-1b | https://huggingface.co/etri-vilab/koala-lightning-1b |
| koala-lightning-700m | https://huggingface.co/etri-vilab/koala-lightning-700m |
<details><summary>FULL abstract</summary> As text-to-image (T2I) synthesis models increase in size, they demand higher inference costs due to the need for more expensive GPUs with larger memory, which makes it challenging to reproduce these models in addition to the restricted access to training datasets. Our study aims to reduce these inference costs and explores how far the generative capabilities of T2I models can be extended using only publicly available datasets and open-source models. To this end, by using the de facto standard text-to-image model, Stable Diffusion XL (SDXL), we present three key practices in building an efficient T2I model: (1) Knowledge distillation: we explore how to effectively distill the generation capability of SDXL into an efficient U-Net and find that self-attention is the most crucial part. (2) Data: despite fewer samples, high-resolution images with rich captions are more crucial than a larger number of low-resolution images with short captions. (3) Teacher: Step-distilled Teacher allows T2I models to reduce the noising steps. Based on these findings, we build two types of efficient text-to-image models, called KOALA-Turbo &-Lightning, with two compact U-Nets (1B & 700M), reducing the model size up to 54% and 69% of the SDXL U-Net. In particular, the KOALA-Lightning-700M is 4x faster than SDXL while still maintaining satisfactory generation quality. Moreover, unlike SDXL, our KOALA models can generate 1024px high-resolution images on consumer-grade GPUs with 8GB of VRAMs (3060Ti). We believe that our KOALA models will have a significant practical impact, serving as cost-effective alternatives to SDXL for academic researchers and general users in resource-constrained environments. </details> <br>We propose a fast text-to-image model, called KOALA, by compressing SDXL's U-Net and distilling knowledge from SDXL into our model. KOALA-Lightning-700M can generate a 1024x1024 image in 0.66 seconds on an NVIDIA 4090 GPU, which is more than 4x faster than SDXL. KOALA-700M can be used as a cost-effective alternative between SDM and SDXL in limited resources.
These 1024x1024 samples were generated by KOALA-Lightning-700M using 10 denoising steps in 0.66 seconds on an NVIDIA 4090 GPU.
<div align="center"> <img src="https://dl.dropbox.com/scl/fi/fjpw93dbrl8xc8pwljclb/teaser_final.png?rlkey=6kf216quj6am8y20nduhenva2&dl=1" width="1024px" /> </div>There are two two types of compressed U-Net, KOALA-1B and KOALA-700M, which are realized by reducing residual blocks and transformer blocks.
<div align="center"> <img src="https://dl.dropboxusercontent.com/scl/fi/5ydeywgiyt1d3njw63dpk/arch.png?rlkey=1p6imbjs4lkmfpcxy153i1a2t&dl=1" width="1024px" /> </div>| U-Net | SDM-v2.0 | SDXL-Base-1.0 | KOALA-1B | KOALA-700M |
|---|---|---|---|---|
| Param. | 865M | 2,567M | 1,161M | 782M |
| CKPT size | 3.46GB | 10.3GB | 4.4GB | 3.0GB |
| Tx blocks | [1, 1, 1, 1] | [0, 2, 10] | [0, 2, 6] | [0, 2, 5] |
| Mid block | ✓ | ✓ | ✓ | ✗ |
| Latency | 1.131s | 3.133s | 1.604s | 1.257s |
We measured the inference time of SDXL-Turbo and KOALA-Turbo models at a resolution of 512x512, and other models at 1024x1024, using a variety of consumer-grade GPUs: NVIDIA 3060Ti (8GB), 2080Ti (11GB), and 4090 (24GB). 'OOM' indicates Out-of-Memory. Note that SDXL models cannot operate on the 3060Ti with 8GB VRAM, whereas <b>our KOALA models can run on all GPU types.</b>
<div align="center"> <img src="https://dl.dropbox.com/scl/fi/eif4cuazx64chd2ybm32w/latency_memory_labels_anno_wide.png?rlkey=otev2ujcn1jekvqre5jksg2e5&dl=1" width="1024px" /> </div>The inference code with denoising step 25
import torch
from diffusers import StableDiffusionXLPipeline, EulerDiscreteScheduler
pipe = StableDiffusionXLPipeline.from_pretrained("etri-vilab/koala-lightning-700m", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
# Ensure sampler uses "trailing" timesteps and "sample" prediction type.
pipe.scheduler = EulerDiscreteScheduler.from_config(
pipe.scheduler.config, timestep_spacing="trailing"
)
prompt = "A portrait painting of a Golden Retriever like Leonard da Vinci"
negative = "worst quality, low quality, illustration, low resolution"
image = pipe(prompt=prompt, negative_prompt=negative, guidance_scale=3.5, num_inference_steps=10).images[0]
The model is intended for research purposes only. Possible research areas and tasks include
The model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
@misc{Lee@koala,
title={KOALA: Empirical Lessons Toward Memory-Efficient and Fast Diffusion Models for Text-to-Image Synthesis},
author={Youngwan Lee and Kwanyong Park and Yoorhim Cho and Yong-Ju Lee and Sung Ju Hwang},
year={2023},
eprint={2312.04005},
archivePrefix={arXiv},
primaryClass={cs.CV}
}