Revanthraja commited on
Commit
b184a3d
1 Parent(s): e85a5a4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -233
README.md CHANGED
@@ -3,236 +3,3 @@ license: apache-2.0
3
  tags:
4
  - text-to-image
5
  - ultra-realistic
6
- - text-to-image
7
- - stable-diffusion
8
- - distilled-model
9
- - knowledge-distillation
10
- pinned: true
11
- datasets:
12
- - zzliang/GRIT
13
- - wanng/midjourney-v5-202304-clean
14
- library_name: diffusers
15
- ---
16
-
17
- # Segmind Stable Diffusion 1B (SSD-1B) Model Card
18
-
19
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62039c2d91d53938a643317d/WveKcu7q5PyZEwNezyyMC.png)
20
-
21
- ## 🔥🔥Join our [Discord](https://discord.gg/rF44ueRG) to give feedback on our smaller v2 version and early access🔥🔥
22
-
23
- ## 📣 AUTOMATIC1111 compatibility added. Supporting file [here](https://huggingface.co/segmind/SSD-1B/blob/main/SSD-1B-A1111.safetensors)
24
-
25
- ## Demo
26
-
27
- Try out the model at [Segmind SSD-1B](https://www.segmind.com/models/ssd-1b?utm_source=hf) for ⚡ fastest inference. You can also try it on [🤗 Spaces](https://huggingface.co/spaces/segmind/Segmind-Stable-Diffusion)
28
-
29
- ## Model Description
30
-
31
- The Segmind Stable Diffusion Model (SSD-1B) is a **distilled 50% smaller** version of the Stable Diffusion XL (SDXL), offering a **60% speedup** while maintaining high-quality text-to-image generation capabilities. It has been trained on diverse datasets, including Grit and Midjourney scrape data, to enhance its ability to create a wide range of visual content based on textual prompts.
32
-
33
- This model employs a knowledge distillation strategy, where it leverages the teachings of several expert models in succession, including SDXL, ZavyChromaXL, and JuggernautXL, to combine their strengths and produce impressive visual outputs.
34
-
35
- Special thanks to the HF team 🤗 especially [Sayak](https://huggingface.co/sayakpaul), [Patrick](https://github.com/patrickvonplaten) and [Poli](https://huggingface.co/multimodalart) for their collaboration and guidance on this work.
36
-
37
- ## Image Comparision (SDXL-1.0 vs SSD-1B)
38
-
39
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62039c2d91d53938a643317d/mOM_OMxbivVBELad1QQYj.png)
40
-
41
- ## Usage:
42
- This model can be used via the 🧨 Diffusers library.
43
-
44
- Make sure to install diffusers from source by running
45
- ```
46
- pip install git+https://github.com/huggingface/diffusers
47
- ```
48
-
49
- In addition, please install `transformers`, `safetensors` and `accelerate`:
50
- ```
51
- pip install transformers accelerate safetensors
52
- ```
53
-
54
- To use the model, you can run the following:
55
-
56
- ```py
57
- from diffusers import StableDiffusionXLPipeline
58
- import torch
59
- pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
60
- pipe.to("cuda")
61
- # if using torch < 2.0
62
- # pipe.enable_xformers_memory_efficient_attention()
63
- prompt = "An astronaut riding a green horse" # Your prompt here
64
- neg_prompt = "ugly, blurry, poor quality" # Negative prompt here
65
- image = pipe(prompt=prompt, negative_prompt=neg_prompt).images[0]
66
- ```
67
- ### Update: Our model should now be usable in ComfyUI.
68
- ### Please do use negative prompting, and a CFG around 9.0 for the best quality!
69
- ### Model Description
70
-
71
- - **Developed by:** [Segmind](https://www.segmind.com/)
72
- - **Developers:** [Yatharth Gupta](https://huggingface.co/Warlord-K) and [Vishnu Jaddipal](https://huggingface.co/Icar).
73
- - **Model type:** Diffusion-based text-to-image generative model
74
- - **License:** Apache 2.0
75
- - **Distilled From** [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)
76
-
77
-
78
- ### Key Features
79
-
80
- - **Text-to-Image Generation:** The model excels at generating images from text prompts, enabling a wide range of creative applications.
81
-
82
- - **Distilled for Speed:** Designed for efficiency, this model offers a 60% speedup, making it a practical choice for real-time applications and scenarios where rapid image generation is essential.
83
-
84
- - **Diverse Training Data:** Trained on diverse datasets, the model can handle a variety of textual prompts and generate corresponding images effectively.
85
-
86
- - **Knowledge Distillation:** By distilling knowledge from multiple expert models, the Segmind Stable Diffusion Model combines their strengths and minimizes their limitations, resulting in improved performance.
87
-
88
- ### Model Architecture
89
-
90
- The SSD-1B Model is a 1.3B Parameter Model which has several layers removed from the Base SDXL Model
91
-
92
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62039c2d91d53938a643317d/Qa8Ow-moLQhOvzp-5kGt4.png)
93
-
94
- ### Training info
95
-
96
- These are the key hyperparameters used during training:
97
-
98
- * Steps: 251000
99
- * Learning rate: 1e-5
100
- * Batch size: 32
101
- * Gradient accumulation steps: 4
102
- * Image resolution: 1024
103
- * Mixed-precision: fp16
104
-
105
- ### Multi-Resolution Support
106
-
107
- ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/62039c2d91d53938a643317d/IwIaIB4nBdMx6Vs5q82cL.jpeg)
108
-
109
- SSD-1B can support the following output resolutions.
110
-
111
- * 1024 x 1024 (1:1 Square)
112
- * 1152 x 896 (9:7)
113
- * 896 x 1152 (7:9)
114
- * 1216 x 832 (19:13)
115
- * 832 x 1216 (13:19)
116
- * 1344 x 768 (7:4 Horizontal)
117
- * 768 x 1344 (4:7 Vertical)
118
- * 1536 x 640 (12:5 Horizontal)
119
- * 640 x 1536 (5:12 Vertical)
120
-
121
-
122
- ### Speed Comparision
123
-
124
- We have observed that SSD-1B is upto 60% faster than the Base SDXL Model. Below is a comparision on an A100 80GB.
125
-
126
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62039c2d91d53938a643317d/TyymF1OkUjXLrHUp1XF0t.png)
127
-
128
- Below are the speed up metrics on a RTX 4090 GPU.
129
-
130
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62039c2d91d53938a643317d/moMZrlDr-HTFkZlqWHUjQ.png)
131
-
132
- ### Model Sources
133
-
134
- For research and development purposes, the SSD-1B Model can be accessed via the Segmind AI platform. For more information and access details, please visit [Segmind](https://www.segmind.com/models/ssd-1b).
135
-
136
- ## Uses
137
-
138
-
139
- ### Direct Use
140
-
141
- The Segmind Stable Diffusion Model is suitable for research and practical applications in various domains, including:
142
-
143
- - **Art and Design:** It can be used to generate artworks, designs, and other creative content, providing inspiration and enhancing the creative process.
144
-
145
- - **Education:** The model can be applied in educational tools to create visual content for teaching and learning purposes.
146
-
147
- - **Research:** Researchers can use the model to explore generative models, evaluate its performance, and push the boundaries of text-to-image generation.
148
-
149
- - **Safe Content Generation:** It offers a safe and controlled way to generate content, reducing the risk of harmful or inappropriate outputs.
150
-
151
- - **Bias and Limitation Analysis:** Researchers and developers can use the model to probe its limitations and biases, contributing to a better understanding of generative models' behavior.
152
-
153
- ### Downstream Use
154
-
155
- The Segmind Stable Diffusion Model can also be used directly with the 🧨 Diffusers library training scripts for further training, including:
156
-
157
- - **[LoRA](https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora_sdxl.py):**
158
- ```bash
159
- export MODEL_NAME="segmind/SSD-1B"
160
- export VAE_NAME="madebyollin/sdxl-vae-fp16-fix"
161
- export DATASET_NAME="lambdalabs/pokemon-blip-captions"
162
-
163
- accelerate launch train_text_to_image_lora_sdxl.py \
164
- --pretrained_model_name_or_path=$MODEL_NAME \
165
- --pretrained_vae_model_name_or_path=$VAE_NAME \
166
- --dataset_name=$DATASET_NAME --caption_column="text" \
167
- --resolution=1024 --random_flip \
168
- --train_batch_size=1 \
169
- --num_train_epochs=2 --checkpointing_steps=500 \
170
- --learning_rate=1e-04 --lr_scheduler="constant" --lr_warmup_steps=0 \
171
- --mixed_precision="fp16" \
172
- --seed=42 \
173
- --output_dir="sd-pokemon-model-lora-ssd" \
174
- --validation_prompt="cute dragon creature" --report_to="wandb" \
175
- --push_to_hub
176
- ```
177
-
178
- - **[Fine-Tune](https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_sdxl.py):**
179
- ```bash
180
- export MODEL_NAME="segmind/SSD-1B"
181
- export VAE_NAME="madebyollin/sdxl-vae-fp16-fix"
182
- export DATASET_NAME="lambdalabs/pokemon-blip-captions"
183
-
184
- accelerate launch train_text_to_image_sdxl.py \
185
- --pretrained_model_name_or_path=$MODEL_NAME \
186
- --pretrained_vae_model_name_or_path=$VAE_NAME \
187
- --dataset_name=$DATASET_NAME \
188
- --enable_xformers_memory_efficient_attention \
189
- --resolution=512 --center_crop --random_flip \
190
- --proportion_empty_prompts=0.2 \
191
- --train_batch_size=1 \
192
- --gradient_accumulation_steps=4 --gradient_checkpointing \
193
- --max_train_steps=10000 \
194
- --use_8bit_adam \
195
- --learning_rate=1e-06 --lr_scheduler="constant" --lr_warmup_steps=0 \
196
- --mixed_precision="fp16" \
197
- --report_to="wandb" \
198
- --validation_prompt="a cute Sundar Pichai creature" --validation_epochs 5 \
199
- --checkpointing_steps=5000 \
200
- --output_dir="ssd-pokemon-model" \
201
- --push_to_hub
202
- ```
203
- - **[Dreambooth LoRA](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora_sdxl.py):**
204
- ```bash
205
- export MODEL_NAME="segmind/SSD-1B"
206
- export INSTANCE_DIR="dog"
207
- export OUTPUT_DIR="lora-trained-xl"
208
- export VAE_PATH="madebyollin/sdxl-vae-fp16-fix"
209
-
210
- accelerate launch train_dreambooth_lora_sdxl.py \
211
- --pretrained_model_name_or_path=$MODEL_NAME \
212
- --instance_data_dir=$INSTANCE_DIR \
213
- --pretrained_vae_model_name_or_path=$VAE_PATH \
214
- --output_dir=$OUTPUT_DIR \
215
- --mixed_precision="fp16" \
216
- --instance_prompt="a photo of sks dog" \
217
- --resolution=1024 \
218
- --train_batch_size=1 \
219
- --gradient_accumulation_steps=4 \
220
- --learning_rate=1e-5 \
221
- --report_to="wandb" \
222
- --lr_scheduler="constant" \
223
- --lr_warmup_steps=0 \
224
- --max_train_steps=500 \
225
- --validation_prompt="A photo of sks dog in a bucket" \
226
- --validation_epochs=25 \
227
- --seed="0" \
228
- --push_to_hub
229
- ```
230
-
231
- ### Out-of-Scope Use
232
-
233
- The SSD-1B Model is not suitable for creating factual or accurate representations of people, events, or real-world information. It is not intended for tasks requiring high precision and accuracy.
234
-
235
- ## Limitations and Bias
236
-
237
- Limitations & Bias
238
- The SSD-1B Model has some challenges in embodying absolute photorealism, especially in human depictions. While it grapples with incorporating clear text and maintaining the fidelity of complex compositions due to its autoencoding approach, these hurdles pave the way for future enhancements. Importantly, the model's exposure to a diverse dataset, though not a panacea for ingrained societal and digital biases, represents a foundational step towards more equitable technology. Users are encouraged to interact with this pioneering tool with an understanding of its current limitations, fostering an environment of conscious engagement and anticipation for its continued evolution.
 
3
  tags:
4
  - text-to-image
5
  - ultra-realistic