thxCode commited on
Commit
422151f
0 Parent(s):

feat: first commit

Browse files

Signed-off-by: thxCode <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.npy filter=lfs diff=lfs merge=lfs -text
14
+ *.npz filter=lfs diff=lfs merge=lfs -text
15
+ *.onnx filter=lfs diff=lfs merge=lfs -text
16
+ *.ot filter=lfs diff=lfs merge=lfs -text
17
+ *.parquet filter=lfs diff=lfs merge=lfs -text
18
+ *.pb filter=lfs diff=lfs merge=lfs -text
19
+ *.pickle filter=lfs diff=lfs merge=lfs -text
20
+ *.pkl filter=lfs diff=lfs merge=lfs -text
21
+ *.pt filter=lfs diff=lfs merge=lfs -text
22
+ *.pth filter=lfs diff=lfs merge=lfs -text
23
+ *.rar filter=lfs diff=lfs merge=lfs -text
24
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
25
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
26
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
27
+ *.tflite filter=lfs diff=lfs merge=lfs -text
28
+ *.tgz filter=lfs diff=lfs merge=lfs -text
29
+ *.wasm filter=lfs diff=lfs merge=lfs -text
30
+ *.xz filter=lfs diff=lfs merge=lfs -text
31
+ *.zip filter=lfs diff=lfs merge=lfs -text
32
+ *.zst filter=lfs diff=lfs merge=lfs -text
33
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
34
+ v1-5-pruned-emaonly.ckpt filter=lfs diff=lfs merge=lfs -text
35
+ v1-5-pruned.ckpt filter=lfs diff=lfs merge=lfs -text
36
+ *.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: creativeml-openrail-m
3
+ tags:
4
+ - stable-diffusion
5
+ - stable-diffusion-diffusers
6
+ - text-to-image
7
+ inference: true
8
+ ---
9
+
10
+ # stable-diffusion-v1-5-GGUF
11
+
12
+ **!!! Experimental supported by [gpustack/llama-box v0.0.75+](https://github.com/gpustack/llama-box) only !!!**<br/>
13
+
14
+ **Model creator**: [Runway ML](https://huggingface.co/ruwnay)<br/>
15
+ **Original model**: [stable-diffusion-v1-5](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5)<br/>
16
+ **GGUF quantization**: based on stable-diffusion.cpp [ac54e](https://github.com/leejet/stable-diffusion.cpp/commit/ac54e0076052a196b7df961eb1f792c9ff4d7f22) that patched by llama-box.
17
+
18
+ # Stable Diffusion v1-5 Model Card
19
+
20
+ ### ⚠️ This repository is a mirror of the now deprecated `ruwnayml/stable-diffusion-v1-5`, this repository or oganization are not affiliated in any way with RunwayML.
21
+ Modifications to the original model card are in <span style="color:crimson">red</span> or <span style="color:darkgreen">green</span>
22
+
23
+ Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input.
24
+ For more information about how Stable Diffusion functions, please have a look at [🤗's Stable Diffusion blog](https://huggingface.co/blog/stable_diffusion).
25
+
26
+ The **Stable-Diffusion-v1-5** checkpoint was initialized with the weights of the [Stable-Diffusion-v1-2](https:/steps/huggingface.co/CompVis/stable-diffusion-v1-2)
27
+ checkpoint and subsequently fine-tuned on 595k steps at resolution 512x512 on "laion-aesthetics v2 5+" and 10% dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
28
+
29
+ You can use this both with the [🧨Diffusers library](https://github.com/huggingface/diffusers) and [RunwayML GitHub repository](https://github.com/runwayml/stable-diffusion) (<span style="color:crimson">now deprecated</span>), <span style="color:darkgreen">ComfyUI, Automatic1111, SD.Next, InvokeAI</span>.
30
+
31
+ ### Use with Diffusers
32
+ ```py
33
+ from diffusers import StableDiffusionPipeline
34
+ import torch
35
+
36
+ model_id = "sd-legacy/stable-diffusion-v1-5"
37
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
38
+ pipe = pipe.to("cuda")
39
+
40
+ prompt = "a photo of an astronaut riding a horse on mars"
41
+ image = pipe(prompt).images[0]
42
+
43
+ image.save("astronaut_rides_horse.png")
44
+ ```
45
+ For more detailed instructions, use-cases and examples in JAX follow the instructions [here](https://github.com/huggingface/diffusers#text-to-image-generation-with-stable-diffusion)
46
+
47
+ ### Use with GitHub Repository <span style="color:crimson">(now deprecated)</span>, <span style="color:darkgreen">ComfyUI or Automatic1111</span>
48
+
49
+ 1. Download the weights
50
+ - [v1-5-pruned-emaonly.safetensors](https://huggingface.co/sd-legacy/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors) - ema-only weight. uses less VRAM - suitable for inference
51
+ - [v1-5-pruned.safetensors](https://huggingface.co/sd-legacy/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors) - ema+non-ema weights. uses more VRAM - suitable for fine-tuning
52
+
53
+ 2. Follow instructions [here](https://github.com/runwayml/stable-diffusion). <span style="color:crimson">(now deprecated)</span>
54
+
55
+ 3. <span style="color:darkgreen">Use locally with <a href="https://github.com/comfyanonymous/ComfyUI">ComfyUI</a>, <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui">AUTOMATIC1111</a>, <a href="https://github.com/vladmandic/automatic">SD.Next</a>, <a href="https://github.com/invoke-ai/InvokeAI">InvokeAI</a></span>
56
+
57
+ ## Model Details
58
+ - **Developed by:** Robin Rombach, Patrick Esser
59
+ - **Model type:** Diffusion-based text-to-image generation model
60
+ - **Language(s):** English
61
+ - **License:** [The CreativeML OpenRAIL M license](https://huggingface.co/spaces/CompVis/stable-diffusion-license) is an [Open RAIL M license](https://www.licenses.ai/blog/2022/8/18/naming-convention-of-responsible-ai-licenses), adapted from the work that [BigScience](https://bigscience.huggingface.co/) and [the RAIL Initiative](https://www.licenses.ai/) are jointly carrying in the area of responsible AI licensing. See also [the article about the BLOOM Open RAIL license](https://bigscience.huggingface.co/blog/the-bigscience-rail-license) on which our license is based.
62
+ - **Model Description:** This is a model that can be used to generate and modify images based on text prompts. It is a [Latent Diffusion Model](https://arxiv.org/abs/2112.10752) that uses a fixed, pretrained text encoder ([CLIP ViT-L/14](https://arxiv.org/abs/2103.00020)) as suggested in the [Imagen paper](https://arxiv.org/abs/2205.11487).
63
+ - **Resources for more information:** [GitHub Repository](https://github.com/CompVis/stable-diffusion), [Paper](https://arxiv.org/abs/2112.10752).
64
+ - **Cite as:**
65
+
66
+ @InProceedings{Rombach_2022_CVPR,
67
+ author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
68
+ title = {High-Resolution Image Synthesis With Latent Diffusion Models},
69
+ booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
70
+ month = {June},
71
+ year = {2022},
72
+ pages = {10684-10695}
73
+ }
74
+
75
+ # Uses
76
+
77
+ ## Direct Use
78
+ The model is intended for research purposes only. Possible research areas and
79
+ tasks include
80
+
81
+ - Safe deployment of models which have the potential to generate harmful content.
82
+ - Probing and understanding the limitations and biases of generative models.
83
+ - Generation of artworks and use in design and other artistic processes.
84
+ - Applications in educational or creative tools.
85
+ - Research on generative models.
86
+
87
+ Excluded uses are described below.
88
+
89
+ ### Misuse, Malicious Use, and Out-of-Scope Use
90
+ _Note: This section is taken from the [DALLE-MINI model card](https://huggingface.co/dalle-mini/dalle-mini), but applies in the same way to Stable Diffusion v1_.
91
+
92
+
93
+ The model should not be used to intentionally create or disseminate images that create hostile or alienating environments for people. This includes generating images that people would foreseeably find disturbing, distressing, or offensive; or content that propagates historical or current stereotypes.
94
+
95
+ #### Out-of-Scope Use
96
+ 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.
97
+
98
+ #### Misuse and Malicious Use
99
+ Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
100
+
101
+ - Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
102
+ - Intentionally promoting or propagating discriminatory content or harmful stereotypes.
103
+ - Impersonating individuals without their consent.
104
+ - Sexual content without consent of the people who might see it.
105
+ - Mis- and disinformation
106
+ - Representations of egregious violence and gore
107
+ - Sharing of copyrighted or licensed material in violation of its terms of use.
108
+ - Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
109
+
110
+ ## Limitations and Bias
111
+
112
+ ### Limitations
113
+
114
+ - The model does not achieve perfect photorealism
115
+ - The model cannot render legible text
116
+ - The model does not perform well on more difficult tasks which involve compositionality, such as rendering an image corresponding to “A red cube on top of a blue sphere”
117
+ - Faces and people in general may not be generated properly.
118
+ - The model was trained mainly with English captions and will not work as well in other languages.
119
+ - The autoencoding part of the model is lossy
120
+ - The model was trained on a large-scale dataset
121
+ [LAION-5B](https://laion.ai/blog/laion-5b/) which contains adult material
122
+ and is not fit for product use without additional safety mechanisms and
123
+ considerations.
124
+ - No additional measures were used to deduplicate the dataset. As a result, we observe some degree of memorization for images that are duplicated in the training data.
125
+ The training data can be searched at [https://rom1504.github.io/clip-retrieval/](https://rom1504.github.io/clip-retrieval/) to possibly assist in the detection of memorized images.
126
+
127
+ ### Bias
128
+
129
+ While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
130
+ Stable Diffusion v1 was trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),
131
+ which consists of images that are primarily limited to English descriptions.
132
+ Texts and images from communities and cultures that use other languages are likely to be insufficiently accounted for.
133
+ This affects the overall output of the model, as white and western cultures are often set as the default. Further, the
134
+ ability of the model to generate content with non-English prompts is significantly worse than with English-language prompts.
135
+
136
+ ### Safety Module
137
+
138
+ The intended use of this model is with the [Safety Checker](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/safety_checker.py) in Diffusers.
139
+ This checker works by checking model outputs against known hard-coded NSFW concepts.
140
+ The concepts are intentionally hidden to reduce the likelihood of reverse-engineering this filter.
141
+ Specifically, the checker compares the class probability of harmful concepts in the embedding space of the `CLIPTextModel` *after generation* of the images.
142
+ The concepts are passed into the model with the generated image and compared to a hand-engineered weight for each NSFW concept.
143
+
144
+
145
+ ## Training
146
+
147
+ **Training Data**
148
+ The model developers used the following dataset for training the model:
149
+
150
+ - LAION-2B (en) and subsets thereof (see next section)
151
+
152
+ **Training Procedure**
153
+ Stable Diffusion v1-5 is a latent diffusion model which combines an autoencoder with a diffusion model that is trained in the latent space of the autoencoder. During training,
154
+
155
+ - Images are encoded through an encoder, which turns images into latent representations. The autoencoder uses a relative downsampling factor of 8 and maps images of shape H x W x 3 to latents of shape H/f x W/f x 4
156
+ - Text prompts are encoded through a ViT-L/14 text-encoder.
157
+ - The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
158
+ - The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
159
+
160
+ Currently six Stable Diffusion checkpoints are provided, which were trained as follows.
161
+ - [`stable-diffusion-v1-1`](https://huggingface.co/CompVis/stable-diffusion-v1-1): 237,000 steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
162
+ 194,000 steps at resolution `512x512` on [laion-high-resolution](https://huggingface.co/datasets/laion/laion-high-resolution) (170M examples from LAION-5B with resolution `>= 1024x1024`).
163
+ - [`stable-diffusion-v1-2`](https://huggingface.co/CompVis/stable-diffusion-v1-2): Resumed from `stable-diffusion-v1-1`.
164
+ 515,000 steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
165
+ filtered to images with an original size `>= 512x512`, estimated aesthetics score `> 5.0`, and an estimated watermark probability `< 0.5`. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using an [improved aesthetics estimator](https://github.com/christophschuhmann/improved-aesthetic-predictor)).
166
+ - [`stable-diffusion-v1-3`](https://huggingface.co/CompVis/stable-diffusion-v1-3): Resumed from `stable-diffusion-v1-2` - 195,000 steps at resolution `512x512` on "laion-improved-aesthetics" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
167
+ - [`stable-diffusion-v1-4`](https://huggingface.co/CompVis/stable-diffusion-v1-4) Resumed from `stable-diffusion-v1-2` - 225,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
168
+ - [`stable-diffusion-v1-5`](https://huggingface.co/sd-legacy/stable-diffusion-v1-5) Resumed from `stable-diffusion-v1-2` - 595,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
169
+ - [`stable-diffusion-inpainting`](https://huggingface.co/sd-legacy/stable-diffusion-inpainting) Resumed from `stable-diffusion-v1-5` - then 440,000 steps of inpainting training at resolution 512x512 on “laion-aesthetics v2 5+” and 10% dropping of the text-conditioning. For inpainting, the UNet has 5 additional input channels (4 for the encoded masked-image and 1 for the mask itself) whose weights were zero-initialized after restoring the non-inpainting checkpoint. During training, we generate synthetic masks and in 25% mask everything.
170
+
171
+ - **Hardware:** 32 x 8 x A100 GPUs
172
+ - **Optimizer:** AdamW
173
+ - **Gradient Accumulations**: 2
174
+ - **Batch:** 32 x 8 x 2 x 4 = 2048
175
+ - **Learning rate:** warmup to 0.0001 for 10,000 steps and then kept constant
176
+
177
+ ## Evaluation Results
178
+ Evaluations with different classifier-free guidance scales (1.5, 2.0, 3.0, 4.0,
179
+ 5.0, 6.0, 7.0, 8.0) and 50 PNDM/PLMS sampling
180
+ steps show the relative improvements of the checkpoints:
181
+
182
+ ![pareto](https://huggingface.co/CompVis/stable-diffusion/resolve/main/v1-1-to-v1-5.png)
183
+
184
+ Evaluated using 50 PLMS steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.
185
+ ## Environmental Impact
186
+
187
+ **Stable Diffusion v1** **Estimated Emissions**
188
+ Based on that information, we estimate the following CO2 emissions using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). The hardware, runtime, cloud provider, and compute region were utilized to estimate the carbon impact.
189
+
190
+ - **Hardware Type:** A100 PCIe 40GB
191
+ - **Hours used:** 150000
192
+ - **Cloud Provider:** AWS
193
+ - **Compute Region:** US-east
194
+ - **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
195
+
196
+
197
+ ## Citation
198
+
199
+ ```bibtex
200
+ @InProceedings{Rombach_2022_CVPR,
201
+ author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
202
+ title = {High-Resolution Image Synthesis With Latent Diffusion Models},
203
+ booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
204
+ month = {June},
205
+ year = {2022},
206
+ pages = {10684-10695}
207
+ }
208
+ ```
209
+
210
+ *This model card was written by: Robin Rombach and Patrick Esser and is based on the [DALL-E Mini model card](https://huggingface.co/dalle-mini/dalle-mini).*
stable-diffusion-v1-5-FP16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30a85c4cd39aaac08e5ddc51edc22a1ba923f2f8ba131e898cf15ae415ee5524
3
+ size 2132584864
stable-diffusion-v1-5-Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8277631427b91c9674c9ab12e72a5d523d5ad3ac8773ffbd75f66947fffc748b
3
+ size 1570410496
stable-diffusion-v1-5-Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4cbfac8437f780418e0d906d9b4aada43adc828644c2f2978e32985b908e86c
3
+ size 1765950304