File size: 2,296 Bytes
46ce118
 
a58e266
 
46ce118
 
 
 
 
 
a58e266
46ce118
a58e266
 
 
46ce118
a58e266
46ce118
 
a58e266
 
 
46ce118
 
a58e266
 
46ce118
 
 
 
 
 
 
a58e266
46ce118
a58e266
 
 
 
46ce118
a58e266
 
 
46ce118
a58e266
 
 
 
 
 
 
46ce118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
library_name: diffusers
base_model:
- madebyollin/taesd
---





# 🍰 Hybrid-sd-tinyvae for Stable Diffusion

[Hybrid-sd-tinyvae](https://huggingface.co/cqyan/hybrid-sd-tinyvae) is very tiny autoencoder which uses the same "latent API" as [SD](stabilityai/stable-diffusion-2-1-base).
Hybrid-sd-tinyvae is a finetuned model based on the excellent work on [TAESD](https://github.com/madebyollin/taesd). In general, we mainly fix the low-saturation problem encountering in SD1.5 base model, by which we strengthening the saturation and contrast of images to deliver more clarity and colorfulness. 
The model is useful for real-time previewing of the SD1.5 generation process. It saves 11x decoder inference time (16.38ms,fp16,V100) compared to using the SD1.5 decoder (186.6ms,fp16,V100), and you are very welcome to try it !!!!!! 

T2I Comparison using one A100 GPU, The image order from left to right :  [SD1.5](stabilityai/stable-diffusion-2-1-base)  ->  [TAESD](https://github.com/madebyollin/taesd)  ->  [Hybrid-sd-tinyvae](https://huggingface.co/cqyan/hybrid-sd-tinyvae)


![image/png](https://cdn-uploads.huggingface.co/production/uploads/664afcc45fdb7108205a15c3/egu19RWslTCcsnCAjzC1d.png)
![image/png](https://cdn-uploads.huggingface.co/production/uploads/664afcc45fdb7108205a15c3/1angYeWCFudrY34qMdogw.png)
![image/png](https://cdn-uploads.huggingface.co/production/uploads/664afcc45fdb7108205a15c3/-cyqzkeNyjlZ6l3RvtqSz.png)


This repo contains `.safetensors` versions of the Hybrid-sd-tinyvae weights.
For SDXL, use [Hybrid-sd-tinyvae-xl](https://huggingface.co/cqyan/hybrid-sd-tinyvae-xl) instead (the SD and SDXL VAEs are incompatible).







## Using in 🧨 diffusers

```python
import torch
from diffusers.models import AutoencoderTiny
from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-2-1-base", torch_dtype=torch.float16
)

vae = AutoencoderTiny.from_pretrained('cqyan/hybrid-sd-tinyvae', torch_dtype=torch.float16)
pipe.vae = vae
pipe = pipe.to("cuda")
prompt = "A warm and loving family portrait, highly detailed, hyper-realistic, 8k resolution, photorealistic, soft and natural lighting"
image = pipe(prompt, num_inference_steps=25).images[0]
image.save("family.png")
```