ywlee88 commited on
Commit
6e2fc7c
•
1 Parent(s): a7e78f6

update README

Browse files
Files changed (1) hide show
  1. README.md +155 -1
README.md CHANGED
@@ -1 +1,155 @@
1
- # KOALA-700M-LLaVA-Caption Model Card
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - text-to-image
4
+ - KOALA
5
+ ---
6
+
7
+ <div align="center">
8
+ <img src="https://dl.dropboxusercontent.com/scl/fi/yosvi68jvyarbvymxc4hm/github_logo.png?rlkey=r9ouwcd7cqxjbvio43q9b3djd&dl=1" width="1024px" />
9
+ </div>
10
+
11
+
12
+
13
+ <div style="display:flex;justify-content: center">
14
+ <a href="https://youngwanlee.github.io/KOALA/"><img src="https://img.shields.io/static/v1?label=Project%20Page&message=Github&color=blue&logo=github-pages"></a> &ensp;
15
+ <a href="https://github.com/youngwanLEE/sdxl-koala"><img src="https://img.shields.io/static/v1?label=Code&message=Github&color=blue&logo=github"></a> &ensp;
16
+ <a href="https://arxiv.org/abs/2312.04005"><img src="https://img.shields.io/static/v1?label=Paper&message=Arxiv:KOALA&color=red&logo=arxiv"></a> &ensp;
17
+ </div>
18
+
19
+
20
+
21
+ # KOALA-700M-LLaVA-Caption Model Card
22
+
23
+ KOALA-700M and -1B models originally were trained on [LAION-aesthetics-V2 6+](https://laion.ai/blog/laion-aesthetics/) which has some noisy or very short texts.
24
+ So we construct synthesized captions of LAION-aesthetics-V2 6+ by using a large multimodal model, [LLaVA](https://llava-vl.github.io/).
25
+ KOALA-700M-LLaVA-Caption and KOALA-1B-LLaVA-Caption is trained on the synthesized caption-image pairs of LAION-aesthetics-V2 6+.
26
+
27
+
28
+ ## Abstract
29
+ ### TL;DR
30
+ > 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-700M can generate a 1024x1024 image in less than 1.5 seconds on an NVIDIA 4090 GPU, which is more than 2x faster than SDXL.
31
+
32
+ <details><summary>FULL abstract</summary>
33
+ Stable diffusion is the mainstay of the text-to-image (T2I) synthesis in the community due to its generation performance and open-source nature.
34
+ Recently, Stable Diffusion XL (SDXL), the successor of stable diffusion, has received a lot of attention due to its significant performance improvements with a higher resolution of 1024x1024 and a larger model.
35
+ However, its increased computation cost and model size require higher-end hardware (e.g., bigger VRAM GPU) for end-users, incurring higher costs of operation.
36
+ To address this problem, in this work, we propose an efficient latent diffusion model for text-to-image synthesis obtained by distilling the knowledge of SDXL.
37
+ To this end, we first perform an in-depth analysis of the denoising U-Net in SDXL, which is the main bottleneck of the model, and then design a more efficient U-Net based on the analysis.
38
+ Secondly, we explore how to effectively distill the generation capability of SDXL into an efficient U-Net and eventually identify four essential factors, the core of which is that self-attention is the most important part.
39
+ With our efficient U-Net and self-attention-based knowledge distillation strategy, we build our efficient T2I models, called KOALA-1B &-700M, while reducing the model size up to 54% and 69% of the original SDXL model.
40
+ In particular, the KOALA-700M is more than twice as fast as SDXL while still retaining a decent generation quality.
41
+ We hope that due to its balanced speed-performance tradeoff, our KOALA models can serve as a cost-effective alternative to SDXL in resource-constrained environments.
42
+ </details>
43
+
44
+ <br>
45
+
46
+
47
+ These 1024x1024 samples are generated by KOALA-700M with 25 denoising steps.
48
+
49
+ <div align="center">
50
+ <img src="https://dl.dropboxusercontent.com/scl/fi/rjsqqgfney7be069y2yr7/teaser.png?rlkey=7lq0m90xpjcoqclzl4tieajpo&dl=1" width="1024px" />
51
+ </div>
52
+
53
+
54
+ ## Architecture
55
+ There are two two types of compressed U-Net, KOALA-1B and KOALA-700M, which are realized by reducing residual blocks and transformer blocks.
56
+
57
+ <div align="center">
58
+ <img src="https://dl.dropboxusercontent.com/scl/fi/5ydeywgiyt1d3njw63dpk/arch.png?rlkey=1p6imbjs4lkmfpcxy153i1a2t&dl=1" width="1024px" />
59
+ </div>
60
+
61
+ ### U-Net comparison
62
+
63
+ | U-Net | SDM-v2.0 | SDXL-Base-1.0 | KOALA-1B | KOALA-700M |
64
+ |-------|:----------:|:-----------:|:-----------:|:-------------:|
65
+ | Param. | 865M | 2,567M | 1,161M | 782M |
66
+ | CKPT size | 3.46GB | 10.3GB | 4.4GB | 3.0GB |
67
+ | Tx blocks | [1, 1, 1, 1] | [0, 2, 10] | [0, 2, 6] | [0, 2, 5] |
68
+ | Mid block | ✓ | ✓ | ✓ | ✗ |
69
+ | Latency | 1.131s | 3.133s | 1.604s | 1.257s |
70
+
71
+ - Tx menans transformer block and CKPT means the trained checkpoint file.
72
+ - We measured latency with FP16-precision, and 25 denoising steps in NVIDIA 4090 GPU (24GB).
73
+ - SDM-v2.0 uses 768x768 resolution, while SDXL and KOALA models uses 1024x1024 resolution.
74
+
75
+
76
+ ## Latency and memory usage comparison on different GPUs
77
+
78
+ We measure the inference time of SDM-v2.0 with 768x768 resolution and the other models with 1024x1024 using a variety of consumer-grade GPUs: NVIDIA 3060Ti (8GB), 2080Ti (11GB), and 4090 (24GB). We use 25 denoising steps and FP16/FP32 precisions. OOM means Out-of-Memory. Note that SDXL-Base cannot operate in the 8GB-GPU.
79
+
80
+
81
+ <div align="center">
82
+ <img src="https://dl.dropboxusercontent.com/scl/fi/u1az20y0zfww1l5lhbcyd/latency_gpu.svg?rlkey=vjn3gpkmywmp7jpilar4km7sd&dl=1" width="1024px" />
83
+ </div>
84
+
85
+
86
+
87
+
88
+
89
+ ## Key Features
90
+ - **Efficient U-Net Architecture**: KOALA models use a simplified U-Net architecture that reduces the model size by up to 54% and 69% respectively compared to its predecessor, Stable Diffusion XL (SDXL).
91
+ - **Self-Attention-Based Knowledge Distillation**: The core technique in KOALA focuses on the distillation of self-attention features, which proves crucial for maintaining image generation quality.
92
+
93
+
94
+
95
+ ## Model Description
96
+
97
+ - Developed by [ETRI Visual Intelligence Lab](https://huggingface.co/etri-vilab)
98
+ - Developer: [Youngwan Lee](https://youngwanlee.github.io/), [Kwanyong Park](https://pkyong95.github.io/), [Yoorhim Cho](https://ofzlo.github.io/), [Young-Ju Lee](https://scholar.google.com/citations?user=6goOQh8AAAAJ&hl=en), [Sung Ju Hwang](http://www.sungjuhwang.com/)
99
+ - Model Description: Latent Diffusion based text-to-image generative model. KOALA models uses the same text encoders as [SDXL-Base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) and only replace the denoising U-Net with the compressed U-Nets.
100
+ - Training data: [LAION-aesthetics-V2 6+](https://laion.ai/blog/laion-aesthetics/)
101
+ - Resources for more information: Check out [KOALA report on arXiv](https://arxiv.org/abs/2312.04005) and [project page](https://youngwanlee.github.io/KOALA/).
102
+
103
+
104
+
105
+
106
+ ## Usage with 🤗[Diffusers library](https://github.com/huggingface/diffusers)
107
+ The inference code with denoising step 25
108
+ ```python
109
+ import torch
110
+ from diffusers import StableDiffusionXLPipeline
111
+
112
+ pipe = StableDiffusionXLPipeline.from_pretrained("etri-vilab/koala-700m", torch_dtype=torch.float16)
113
+ pipe = pipe.to("cuda")
114
+
115
+ prompt = "A portrait painting of a Golden Retriever like Leonard da Vinci"
116
+ negative = "worst quality, low quality, illustration, low resolution"
117
+ image = pipe(prompt=prompt, negative_prompt=negative).images[0]
118
+ ```
119
+
120
+
121
+
122
+ ## Uses
123
+ ### Direct Use
124
+ The model is intended for research purposes only. Possible research areas and tasks include
125
+
126
+ - Generation of artworks and use in design and other artistic processes.
127
+ - Applications in educational or creative tools.
128
+ - Research on generative models.
129
+ - Safe deployment of models which have the potential to generate harmful content.
130
+ - Probing and understanding the limitations and biases of generative models.
131
+ - Excluded uses are described below.
132
+
133
+ ### Out-of-Scope Use
134
+
135
+ 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.
136
+
137
+
138
+ ## Limitations and Bias
139
+ - Text Rendering: The models face challenges in rendering long, legible text within images.
140
+ - Complex Prompts: KOALA sometimes struggles with complex prompts involving multiple attributes.
141
+ - Dataset Dependencies: The current limitations are partially attributed to the characteristics of the training dataset (LAION-aesthetics-V2 6+).
142
+
143
+
144
+
145
+ ## Citation
146
+ ```bibtex
147
+ @misc{Lee@koala,
148
+ title={KOALA: Self-Attention Matters in Knowledge Distillation of Latent Diffusion Models for Memory-Efficient and Fast Image Synthesis},
149
+ author={Youngwan Lee and Kwanyong Park and Yoorhim Cho and Yong-Ju Lee and Sung Ju Hwang},
150
+ year={2023},
151
+ eprint={2312.04005},
152
+ archivePrefix={arXiv},
153
+ primaryClass={cs.CV}
154
+ }
155
+ ```