vriveras commited on
Commit
e30d4bf
1 Parent(s): b6bf4fb

Initial models

Browse files
LICENSE ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ STABILITY AI NON-COMMERCIAL RESEARCH COMMUNITY LICENSE AGREEMENT
2
+ Dated: November 28, 2023
3
+
4
+
5
+ By using or distributing any portion or element of the Models, Software, Software Products or Derivative Works, you agree to be bound by this Agreement.
6
+
7
+
8
+ "Agreement" means this Stable Non-Commercial Research Community License Agreement.
9
+
10
+
11
+ “AUP” means the Stability AI Acceptable Use Policy available at https://stability.ai/use-policy, as may be updated from time to time.
12
+
13
+
14
+ "Derivative Work(s)” means (a) any derivative work of the Software Products as recognized by U.S. copyright laws and (b) any modifications to a Model, and any other model created which is based on or derived from the Model or the Model’s output. For clarity, Derivative Works do not include the output of any Model.
15
+
16
+
17
+ “Documentation” means any specifications, manuals, documentation, and other written information provided by Stability AI related to the Software.
18
+
19
+
20
+ "Licensee" or "you" means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity's behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
21
+
22
+
23
+ “Model(s)" means, collectively, Stability AI’s proprietary models and algorithms, including machine-learning models, trained model weights and other elements of the foregoing, made available under this Agreement.
24
+
25
+
26
+ “Non-Commercial Uses” means exercising any of the rights granted herein for the purpose of research or non-commercial purposes. Non-Commercial Uses does not include any production use of the Software Products or any Derivative Works.
27
+
28
+
29
+ "Stability AI" or "we" means Stability AI Ltd. and its affiliates.
30
+
31
+ "Software" means Stability AI’s proprietary software made available under this Agreement.
32
+
33
+
34
+ “Software Products” means the Models, Software and Documentation, individually or in any combination.
35
+
36
+
37
+
38
+ 1. License Rights and Redistribution.
39
+
40
+ a. Subject to your compliance with this Agreement, the AUP (which is hereby incorporated herein by reference), and the Documentation, Stability AI grants you a non-exclusive, worldwide, non-transferable, non-sublicensable, revocable, royalty free and limited license under Stability AI’s intellectual property or other rights owned or controlled by Stability AI embodied in the Software Products to use, reproduce, distribute, and create Derivative Works of, the Software Products, in each case for Non-Commercial Uses only.
41
+
42
+ b. You may not use the Software Products or Derivative Works to enable third parties to use the Software Products or Derivative Works as part of your hosted service or via your APIs, whether you are adding substantial additional functionality thereto or not. Merely distributing the Software Products or Derivative Works for download online without offering any related service (ex. by distributing the Models on HuggingFace) is not a violation of this subsection. If you wish to use the Software Products or any Derivative Works for commercial or production use or you wish to make the Software Products or any Derivative Works available to third parties via your hosted service or your APIs, contact Stability AI at https://stability.ai/contact.
43
+
44
+ c. If you distribute or make the Software Products, or any Derivative Works thereof, available to a third party, the Software Products, Derivative Works, or any portion thereof, respectively, will remain subject to this Agreement and you must (i) provide a copy of this Agreement to such third party, and (ii) retain the following attribution notice within a "Notice" text file distributed as a part of such copies: "This Stability AI Model is licensed under the Stability AI Non-Commercial Research Community License, Copyright (c) Stability AI Ltd. All Rights Reserved.” If you create a Derivative Work of a Software Product, you may add your own attribution notices to the Notice file included with the Software Product, provided that you clearly indicate which attributions apply to the Software Product and you must state in the NOTICE file that you changed the Software Product and how it was modified.
45
+
46
+ 2. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE SOFTWARE PRODUCTS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE SOFTWARE PRODUCTS, DERIVATIVE WORKS OR ANY OUTPUT OR RESULTS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE SOFTWARE PRODUCTS, DERIVATIVE WORKS AND ANY OUTPUT AND RESULTS.
47
+
48
+ 3. Limitation of Liability. IN NO EVENT WILL STABILITY AI OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF STABILITY AI OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
49
+
50
+ 4. Intellectual Property.
51
+
52
+ a. No trademark licenses are granted under this Agreement, and in connection with the Software Products or Derivative Works, neither Stability AI nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and redistributing the Software Products or Derivative Works.
53
+
54
+ b. Subject to Stability AI’s ownership of the Software Products and Derivative Works made by or for Stability AI, with respect to any Derivative Works that are made by you, as between you and Stability AI, you are and will be the owner of such Derivative Works
55
+
56
+ c. If you institute litigation or other proceedings against Stability AI (including a cross-claim or counterclaim in a lawsuit) alleging that the Software Products, Derivative Works or associated outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Stability AI from and against any claim by any third party arising out of or related to your use or distribution of the Software Products or Derivative Works in violation of this Agreement.
57
+
58
+ 5. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the Software Products and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Stability AI may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of any Software Products or Derivative Works. Sections 2-4 shall survive the termination of this Agreement.
README.md ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: text-to-image
3
+ inference: false
4
+ ---
5
+
6
+ # Model summary
7
+ This Stable Diffusion Turbo model has been optimized to work with WebNN. This model is licensed under the [STABILITY AI NON-COMMERCIAL RESEARCH COMMUNITY LICENSE AGREEMENT](https://huggingface.co/stabilityai/sd-turbo/blob/main/LICENSE). For terms of use, please visit the [Acceptable Use Policy](https://stability.ai/use-policy). If you comply with the license and terms of use, you have the rights described therin. By using this Model, you accept the terms.
8
+
9
+ SD-Turbo-WebNN is meant to be used with the corresponding sample [here](https://microsoft.github.io/webnn-developer-preview/) for educational or testing purposes only.
10
+
11
+ # WebNN changes
12
+ This original model is [SD-Turbo](https://huggingface.co/stabilityai/sd-turbo). SD-Turbo-WebNN is an ONNX version of the SD-Turbo model that optimizes for WebNN by using static input shapes and eliminates operators that are not in use.
13
+
14
+ # SD-Turbo Model Card
15
+
16
+ <!-- Provide a quick summary of what the model is/does. -->
17
+ SD-Turbo is a fast generative text-to-image model that can synthesize photorealistic images from a text prompt in a single network evaluation.
18
+ We release SD-Turbo as a research artifact, and to study small, distilled text-to-image models. For increased quality and prompt understanding,
19
+ we recommend [SDXL-Turbo](https://huggingface.co/stabilityai/sdxl-turbo/).
20
+
21
+ Please note: For commercial use, please refer to https://stability.ai/membership.
22
+
23
+ ## Model Details
24
+
25
+ ### Model Description
26
+ SD-Turbo is a distilled version of [Stable Diffusion 2.1](https://huggingface.co/stabilityai/stable-diffusion-2-1), trained for real-time synthesis.
27
+ SD-Turbo is based on a novel training method called Adversarial Diffusion Distillation (ADD) (see the [technical report](https://stability.ai/research/adversarial-diffusion-distillation)), which allows sampling large-scale foundational
28
+ image diffusion models in 1 to 4 steps at high image quality.
29
+ This approach uses score distillation to leverage large-scale off-the-shelf image diffusion models as a teacher signal and combines this with an
30
+ adversarial loss to ensure high image fidelity even in the low-step regime of one or two sampling steps.
31
+
32
+ - **Developed by:** Stability AI
33
+ - **Funded by:** Stability AI
34
+ - **Model type:** Generative text-to-image model
35
+ - **Finetuned from model:** [Stable Diffusion 2.1](https://huggingface.co/stabilityai/stable-diffusion-2-1)
36
+
37
+ ### Model Sources
38
+
39
+ For research purposes, we recommend our `generative-models` Github repository (https://github.com/Stability-AI/generative-models),
40
+ which implements the most popular diffusion frameworks (both training and inference).
41
+
42
+ - **Repository:** https://github.com/Stability-AI/generative-models
43
+ - **Paper:** https://stability.ai/research/adversarial-diffusion-distillation
44
+ - **Demo [for the bigger SDXL-Turbo]:** http://clipdrop.co/stable-diffusion-turbo
45
+
46
+
47
+ ## Uses
48
+
49
+ ### Direct Use
50
+
51
+ SD-Turbo is intended for both non-commercial and commercial usage. Possible research areas and tasks include
52
+
53
+ - Research on generative models.
54
+ - Research on real-time applications of generative models.
55
+ - Research on the impact of real-time generative models.
56
+ - Safe deployment of models which have the potential to generate harmful content.
57
+ - Probing and understanding the limitations and biases of generative models.
58
+ - Generation of artworks and use in design and other artistic processes.
59
+ - Applications in educational or creative tools.
60
+
61
+ For commercial use, please refer to https://stability.ai/membership.
62
+
63
+ Excluded uses are described below.
64
+
65
+ ### Diffusers
66
+
67
+ ```
68
+ pip install diffusers transformers accelerate --upgrade
69
+ ```
70
+
71
+ - **Text-to-image**:
72
+
73
+ SD-Turbo does not make use of `guidance_scale` or `negative_prompt`, we disable it with `guidance_scale=0.0`.
74
+ Preferably, the model generates images of size 512x512 but higher image sizes work as well.
75
+ A **single step** is enough to generate high quality images.
76
+
77
+ ```py
78
+ from diffusers import AutoPipelineForText2Image
79
+ import torch
80
+
81
+ pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sd-turbo", torch_dtype=torch.float16, variant="fp16")
82
+ pipe.to("cuda")
83
+
84
+ prompt = "A cinematic shot of a baby racoon wearing an intricate italian priest robe."
85
+ image = pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
86
+ ```
87
+
88
+ - **Image-to-image**:
89
+
90
+ When using SD-Turbo for image-to-image generation, make sure that `num_inference_steps` * `strength` is larger or equal
91
+ to 1. The image-to-image pipeline will run for `int(num_inference_steps * strength)` steps, *e.g.* 0.5 * 2.0 = 1 step in our example
92
+ below.
93
+
94
+ ```py
95
+ from diffusers import AutoPipelineForImage2Image
96
+ from diffusers.utils import load_image
97
+ import torch
98
+
99
+ pipe = AutoPipelineForImage2Image.from_pretrained("stabilityai/sd-turbo", torch_dtype=torch.float16, variant="fp16")
100
+ pipe.to("cuda")
101
+
102
+ init_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png").resize((512, 512))
103
+ prompt = "cat wizard, gandalf, lord of the rings, detailed, fantasy, cute, adorable, Pixar, Disney, 8k"
104
+
105
+ image = pipe(prompt, image=init_image, num_inference_steps=2, strength=0.5, guidance_scale=0.0).images[0]
106
+ ```
107
+
108
+ ### Out-of-Scope Use
109
+
110
+ The model was not trained to be factual or true representations of people or events,
111
+ and therefore using the model to generate such content is out-of-scope for the abilities of this model.
112
+ The model should not be used in any way that violates Stability AI's [Acceptable Use Policy](https://stability.ai/use-policy).
113
+
114
+ ## Limitations and Bias
115
+
116
+ ### Limitations
117
+ - The quality and prompt alignment is lower than that of [SDXL-Turbo](https://huggingface.co/stabilityai/sdxl-turbo/).
118
+ - The generated images are of a fixed resolution (512x512 pix), and the model does not achieve perfect photorealism.
119
+ - The model cannot render legible text.
120
+ - Faces and people in general may not be generated properly.
121
+ - The autoencoding part of the model is lossy.
122
+
123
+
124
+ ### Recommendations
125
+
126
+ The model is intended for both non-commercial and commercial usage.
127
+
128
+ ## How to Get Started with the Model
129
+
130
+ Check out https://github.com/Stability-AI/generative-models
safety_checker/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:523792fe8eac01a724dc42ccd33940bfbdd8b21392c604cf1a15aad2b6f87fc7
3
+ size 608675848
text_encoder/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2188d058ad94d09bca38a68fc6a73dfea02350a875358106305ed0eb31952b3c
3
+ size 681393086
text_encoder/model_layernorm.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62c42954cca21763c2e716f6c3eef91bb32bbcda3fb29b1924e58243c8c43a03
3
+ size 681043453
tokenizer/resolve/main/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer/resolve/main/tokenizer_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "bos_token": {
4
+ "__type": "AddedToken",
5
+ "content": "<|startoftext|>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false
10
+ },
11
+ "clean_up_tokenization_spaces": true,
12
+ "do_lower_case": true,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "<|endoftext|>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "errors": "replace",
22
+ "model_max_length": 77,
23
+ "pad_token": "<|endoftext|>",
24
+ "processor_class": "CLIPProcessor",
25
+ "tokenizer_class": "CLIPTokenizer",
26
+ "unk_token": {
27
+ "__type": "AddedToken",
28
+ "content": "<|endoftext|>",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ }
34
+ }
unet/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b4333f3f0aff615eb26fe9b117bf5c7921db2207a67d18ca3421cc7b2d2c080
3
+ size 1732687681
unet/model_layernorm.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c1b4f76d8fa3aa0f1e22b34998f539260641b640a93616f4447797faf441479
3
+ size 1732497500
vae_decoder/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6312d799b27605c6965454565c58f5bd62dbf881c940aeb4115227302c464cf0
3
+ size 99124482