Upload 8 files
Browse files- .gitattributes +1 -0
- 01.png +3 -0
- LICENSE.md +60 -0
- README.md +213 -1
- comparison.png +0 -0
- gitattributes.txt +36 -0
- model_index.json +34 -0
- pipeline.png +0 -0
- sd_xl_offset_example-lora_1.0.safetensors +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
01.png filter=lfs diff=lfs merge=lfs -text
|
01.png
ADDED
Git LFS Details
|
LICENSE.md
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2023 Stability AI
|
2 |
+
CreativeML Open RAIL++-M License dated July 26, 2023
|
3 |
+
|
4 |
+
Section I: PREAMBLE
|
5 |
+
Multimodal generative models are being widely adopted and used, and have the potential to transform the way artists, among other individuals, conceive and benefit from AI or ML technologies as a tool for content creation.
|
6 |
+
Notwithstanding the current and potential benefits that these artifacts can bring to society at large, there are also concerns about potential misuses of them, either due to their technical limitations or ethical considerations.
|
7 |
+
In short, this license strives for both the open and responsible downstream use of the accompanying model. When it comes to the open character, we took inspiration from open source permissive licenses regarding the grant of IP rights. Referring to the downstream responsible use, we added use-based restrictions not permitting the use of the model in very specific scenarios, in order for the licensor to be able to enforce the license in case potential misuses of the Model may occur. At the same time, we strive to promote open and responsible research on generative models for art and content generation.
|
8 |
+
Even though downstream derivative versions of the model could be released under different licensing terms, the latter will always have to include - at minimum - the same use-based restrictions as the ones in the original license (this license). We believe in the intersection between open and responsible AI development; thus, this agreement aims to strike a balance between both in order to enable responsible open-science in the field of AI.
|
9 |
+
This CreativeML Open RAIL++-M License governs the use of the model (and its derivatives) and is informed by the model card associated with the model.
|
10 |
+
NOW THEREFORE, You and Licensor agree as follows:
|
11 |
+
Definitions
|
12 |
+
"License" means the terms and conditions for use, reproduction, and Distribution as defined in this document.
|
13 |
+
"Data" means a collection of information and/or content extracted from the dataset used with the Model, including to train, pretrain, or otherwise evaluate the Model. The Data is not licensed under this License.
|
14 |
+
"Output" means the results of operating a Model as embodied in informational content resulting therefrom.
|
15 |
+
"Model" means any accompanying machine-learning based assemblies (including checkpoints), consisting of learnt weights, parameters (including optimizer states), corresponding to the model architecture as embodied in the Complementary Material, that have been trained or tuned, in whole or in part on the Data, using the Complementary Material.
|
16 |
+
"Derivatives of the Model" means all modifications to the Model, works based on the Model, or any other model which is created or initialized by transfer of patterns of the weights, parameters, activations or output of the Model, to the other model, in order to cause the other model to perform similarly to the Model, including - but not limited to - distillation methods entailing the use of intermediate data representations or methods based on the generation of synthetic data by the Model for training the other model.
|
17 |
+
"Complementary Material" means the accompanying source code and scripts used to define, run, load, benchmark or evaluate the Model, and used to prepare data for training or evaluation, if any. This includes any accompanying documentation, tutorials, examples, etc, if any.
|
18 |
+
"Distribution" means any transmission, reproduction, publication or other sharing of the Model or Derivatives of the Model to a third party, including providing the Model as a hosted service made available by electronic or other remote means - e.g. API-based or web access.
|
19 |
+
"Licensor" means the copyright owner or entity authorized by the copyright owner that is granting the License, including the persons or entities that may have rights in the Model and/or distributing the Model.
|
20 |
+
"You" (or "Your") means an individual or Legal Entity exercising permissions granted by this License and/or making use of the Model for whichever purpose and in any field of use, including usage of the Model in an end-use application - e.g. chatbot, translator, image generator.
|
21 |
+
"Third Parties" means individuals or legal entities that are not under common control with Licensor or You.
|
22 |
+
"Contribution" means any work of authorship, including the original version of the Model and any modifications or additions to that Model or Derivatives of the Model thereof, that is intentionally submitted to Licensor for inclusion in the Model by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Model, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
23 |
+
"Contributor" means Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Model.
|
24 |
+
|
25 |
+
Section II: INTELLECTUAL PROPERTY RIGHTS
|
26 |
+
Both copyright and patent grants apply to the Model, Derivatives of the Model and Complementary Material. The Model and Derivatives of the Model are subject to additional terms as described in
|
27 |
+
|
28 |
+
Section III.
|
29 |
+
Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare, publicly display, publicly perform, sublicense, and distribute the Complementary Material, the Model, and Derivatives of the Model.
|
30 |
+
Grant of Patent License. Subject to the terms and conditions of this License and where and as applicable, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this paragraph) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Model and the Complementary Material, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Model to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Model and/or Complementary Material or a Contribution incorporated within the Model and/or Complementary Material constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for the Model and/or Work shall terminate as of the date such litigation is asserted or filed.
|
31 |
+
Section III: CONDITIONS OF USAGE, DISTRIBUTION AND REDISTRIBUTION
|
32 |
+
Distribution and Redistribution. You may host for Third Party remote access purposes (e.g. software-as-a-service), reproduce and distribute copies of the Model or Derivatives of the Model thereof in any medium, with or without modifications, provided that You meet the following conditions: Use-based restrictions as referenced in paragraph 5 MUST be included as an enforceable provision by You in any type of legal agreement (e.g. a license) governing the use and/or distribution of the Model or Derivatives of the Model, and You shall give notice to subsequent users You Distribute to, that the Model or Derivatives of the Model are subject to paragraph 5. This provision does not apply to the use of Complementary Material. You must give any Third Party recipients of the Model or Derivatives of the Model a copy of this License; You must cause any modified files to carry prominent notices stating that You changed the files; You must retain all copyright, patent, trademark, and attribution notices excluding those notices that do not pertain to any part of the Model, Derivatives of the Model. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions - respecting paragraph 4.a. - for use, reproduction, or Distribution of Your modifications, or for any such Derivatives of the Model as a whole, provided Your use, reproduction, and Distribution of the Model otherwise complies with the conditions stated in this License.
|
33 |
+
Use-based restrictions. The restrictions set forth in Attachment A are considered Use-based restrictions. Therefore You cannot use the Model and the Derivatives of the Model for the specified restricted uses. You may use the Model subject to this License, including only for lawful purposes and in accordance with the License. Use may include creating any content with, finetuning, updating, running, training, evaluating and/or reparametrizing the Model. You shall require all of Your users who use the Model or a Derivative of the Model to comply with the terms of this paragraph (paragraph 5).
|
34 |
+
The Output You Generate. Except as set forth herein, Licensor claims no rights in the Output You generate using the Model. You are accountable for the Output you generate and its subsequent uses. No use of the output can contravene any provision as stated in the License.
|
35 |
+
|
36 |
+
Section IV: OTHER PROVISIONS
|
37 |
+
Updates and Runtime Restrictions. To the maximum extent permitted by law, Licensor reserves the right to restrict (remotely or otherwise) usage of the Model in violation of this License.
|
38 |
+
Trademarks and related. Nothing in this License permits You to make use of Licensors’ trademarks, trade names, logos or to otherwise suggest endorsement or misrepresent the relationship between the parties; and any rights not expressly granted herein are reserved by the Licensors.
|
39 |
+
Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Model and the Complementary Material (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Model, Derivatives of the Model, and the Complementary Material and assume any risks associated with Your exercise of permissions under this License.
|
40 |
+
Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Model and the Complementary Material (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
41 |
+
Accepting Warranty or Additional Liability. While redistributing the Model, Derivatives of the Model and the Complementary Material thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
42 |
+
If any provision of this License is held to be invalid, illegal or unenforceable, the remaining provisions shall be unaffected thereby and remain valid as if such provision had not been set forth herein.
|
43 |
+
|
44 |
+
END OF TERMS AND CONDITIONS
|
45 |
+
|
46 |
+
Attachment A
|
47 |
+
Use Restrictions
|
48 |
+
You agree not to use the Model or Derivatives of the Model:
|
49 |
+
In any way that violates any applicable national, federal, state, local or international law or regulation;
|
50 |
+
For the purpose of exploiting, harming or attempting to exploit or harm minors in any way;
|
51 |
+
To generate or disseminate verifiably false information and/or content with the purpose of harming others;
|
52 |
+
To generate or disseminate personal identifiable information that can be used to harm an individual;
|
53 |
+
To defame, disparage or otherwise harass others;
|
54 |
+
For fully automated decision making that adversely impacts an individual’s legal rights or otherwise creates or modifies a binding, enforceable obligation;
|
55 |
+
For any use intended to or which has the effect of discriminating against or harming individuals or groups based on online or offline social behavior or known or predicted personal or personality characteristics;
|
56 |
+
To exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm;
|
57 |
+
For any use intended to or which has the effect of discriminating against individuals or groups based on legally protected characteristics or categories;
|
58 |
+
To provide medical advice and medical results interpretation;
|
59 |
+
To generate or disseminate information for the purpose to be used for administration of justice, law enforcement, immigration or asylum processes, such as predicting an individual will commit fraud/crime commitment (e.g. by text profiling, drawing causal relationships between assertions made in documents, indiscriminate and arbitrarily-targeted use).
|
60 |
+
|
README.md
CHANGED
@@ -1,3 +1,215 @@
|
|
1 |
---
|
2 |
-
license: openrail
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: openrail++
|
3 |
+
tags:
|
4 |
+
- text-to-image
|
5 |
+
- stable-diffusion
|
6 |
---
|
7 |
+
# SD-XL 1.0-base Model Card
|
8 |
+
![row01](01.png)
|
9 |
+
|
10 |
+
## Model
|
11 |
+
|
12 |
+
![pipeline](pipeline.png)
|
13 |
+
|
14 |
+
[SDXL](https://arxiv.org/abs/2307.01952) consists of an [ensemble of experts](https://arxiv.org/abs/2211.01324) pipeline for latent diffusion:
|
15 |
+
In a first step, the base model is used to generate (noisy) latents,
|
16 |
+
which are then further processed with a refinement model (available here: https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/) specialized for the final denoising steps.
|
17 |
+
Note that the base model can be used as a standalone module.
|
18 |
+
|
19 |
+
Alternatively, we can use a two-stage pipeline as follows:
|
20 |
+
First, the base model is used to generate latents of the desired output size.
|
21 |
+
In the second step, we use a specialized high-resolution model and apply a technique called SDEdit (https://arxiv.org/abs/2108.01073, also known as "img2img")
|
22 |
+
to the latents generated in the first step, using the same prompt. This technique is slightly slower than the first one, as it requires more function evaluations.
|
23 |
+
|
24 |
+
Source code is available at https://github.com/Stability-AI/generative-models .
|
25 |
+
|
26 |
+
### Model Description
|
27 |
+
|
28 |
+
- **Developed by:** Stability AI
|
29 |
+
- **Model type:** Diffusion-based text-to-image generative model
|
30 |
+
- **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENSE.md)
|
31 |
+
- **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 two fixed, pretrained text encoders ([OpenCLIP-ViT/G](https://github.com/mlfoundations/open_clip) and [CLIP-ViT/L](https://github.com/openai/CLIP/tree/main)).
|
32 |
+
- **Resources for more information:** Check out our [GitHub Repository](https://github.com/Stability-AI/generative-models) and the [SDXL report on arXiv](https://arxiv.org/abs/2307.01952).
|
33 |
+
|
34 |
+
### Model Sources
|
35 |
+
|
36 |
+
For research purposes, we recommned our `generative-models` Github repository (https://github.com/Stability-AI/generative-models), which implements the most popoular diffusion frameworks (both training and inference) and for which new functionalities like distillation will be added over time.
|
37 |
+
[Clipdrop](https://clipdrop.co/stable-diffusion) provides free SDXL inference.
|
38 |
+
|
39 |
+
- **Repository:** https://github.com/Stability-AI/generative-models
|
40 |
+
- **Demo:** https://clipdrop.co/stable-diffusion
|
41 |
+
|
42 |
+
|
43 |
+
## Evaluation
|
44 |
+
![comparison](comparison.png)
|
45 |
+
The chart above evaluates user preference for SDXL (with and without refinement) over SDXL 0.9 and Stable Diffusion 1.5 and 2.1.
|
46 |
+
The SDXL base model performs significantly better than the previous variants, and the model combined with the refinement module achieves the best overall performance.
|
47 |
+
|
48 |
+
|
49 |
+
### 🧨 Diffusers
|
50 |
+
|
51 |
+
Make sure to upgrade diffusers to >= 0.19.0:
|
52 |
+
```
|
53 |
+
pip install diffusers --upgrade
|
54 |
+
```
|
55 |
+
|
56 |
+
In addition make sure to install `transformers`, `safetensors`, `accelerate` as well as the invisible watermark:
|
57 |
+
```
|
58 |
+
pip install invisible_watermark transformers accelerate safetensors
|
59 |
+
```
|
60 |
+
|
61 |
+
To just use the base model, you can run:
|
62 |
+
|
63 |
+
```py
|
64 |
+
from diffusers import DiffusionPipeline
|
65 |
+
import torch
|
66 |
+
|
67 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
|
68 |
+
pipe.to("cuda")
|
69 |
+
|
70 |
+
# if using torch < 2.0
|
71 |
+
# pipe.enable_xformers_memory_efficient_attention()
|
72 |
+
|
73 |
+
prompt = "An astronaut riding a green horse"
|
74 |
+
|
75 |
+
images = pipe(prompt=prompt).images[0]
|
76 |
+
```
|
77 |
+
|
78 |
+
To use the whole base + refiner pipeline as an ensemble of experts you can run:
|
79 |
+
|
80 |
+
```py
|
81 |
+
from diffusers import DiffusionPipeline
|
82 |
+
import torch
|
83 |
+
|
84 |
+
# load both base & refiner
|
85 |
+
base = DiffusionPipeline.from_pretrained(
|
86 |
+
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
87 |
+
)
|
88 |
+
base.to("cuda")
|
89 |
+
refiner = DiffusionPipeline.from_pretrained(
|
90 |
+
"stabilityai/stable-diffusion-xl-refiner-1.0",
|
91 |
+
text_encoder_2=base.text_encoder_2,
|
92 |
+
vae=base.vae,
|
93 |
+
torch_dtype=torch.float16,
|
94 |
+
use_safetensors=True,
|
95 |
+
variant="fp16",
|
96 |
+
)
|
97 |
+
refiner.to("cuda")
|
98 |
+
|
99 |
+
# Define how many steps and what % of steps to be run on each experts (80/20) here
|
100 |
+
n_steps = 40
|
101 |
+
high_noise_frac = 0.8
|
102 |
+
|
103 |
+
prompt = "A majestic lion jumping from a big stone at night"
|
104 |
+
|
105 |
+
# run both experts
|
106 |
+
image = base(
|
107 |
+
prompt=prompt,
|
108 |
+
num_inference_steps=n_steps,
|
109 |
+
denoising_end=high_noise_frac,
|
110 |
+
output_type="latent",
|
111 |
+
).images
|
112 |
+
image = refiner(
|
113 |
+
prompt=prompt,
|
114 |
+
num_inference_steps=n_steps,
|
115 |
+
denoising_start=high_noise_frac,
|
116 |
+
image=image,
|
117 |
+
).images[0]
|
118 |
+
```
|
119 |
+
|
120 |
+
When using `torch >= 2.0`, you can improve the inference speed by 20-30% with torch.compile. Simple wrap the unet with torch compile before running the pipeline:
|
121 |
+
```py
|
122 |
+
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
123 |
+
```
|
124 |
+
|
125 |
+
If you are limited by GPU VRAM, you can enable *cpu offloading* by calling `pipe.enable_model_cpu_offload`
|
126 |
+
instead of `.to("cuda")`:
|
127 |
+
|
128 |
+
```diff
|
129 |
+
- pipe.to("cuda")
|
130 |
+
+ pipe.enable_model_cpu_offload()
|
131 |
+
```
|
132 |
+
|
133 |
+
For more information on how to use Stable Diffusion XL with `diffusers`, please have a look at [the Stable Diffusion XL Docs](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl).
|
134 |
+
|
135 |
+
### Optimum
|
136 |
+
[Optimum](https://github.com/huggingface/optimum) provides a Stable Diffusion pipeline compatible with both [OpenVINO](https://docs.openvino.ai/latest/index.html) and [ONNX Runtime](https://onnxruntime.ai/).
|
137 |
+
|
138 |
+
#### OpenVINO
|
139 |
+
|
140 |
+
To install Optimum with the dependencies required for OpenVINO :
|
141 |
+
|
142 |
+
```bash
|
143 |
+
pip install optimum[openvino]
|
144 |
+
```
|
145 |
+
|
146 |
+
To load an OpenVINO model and run inference with OpenVINO Runtime, you need to replace `StableDiffusionXLPipeline` with Optimum `OVStableDiffusionXLPipeline`. In case you want to load a PyTorch model and convert it to the OpenVINO format on-the-fly, you can set `export=True`.
|
147 |
+
|
148 |
+
```diff
|
149 |
+
- from diffusers import StableDiffusionPipeline
|
150 |
+
+ from optimum.intel import OVStableDiffusionPipeline
|
151 |
+
|
152 |
+
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
153 |
+
- pipeline = StableDiffusionPipeline.from_pretrained(model_id)
|
154 |
+
+ pipeline = OVStableDiffusionPipeline.from_pretrained(model_id)
|
155 |
+
prompt = "A majestic lion jumping from a big stone at night"
|
156 |
+
image = pipeline(prompt).images[0]
|
157 |
+
```
|
158 |
+
|
159 |
+
You can find more examples (such as static reshaping and model compilation) in optimum [documentation](https://huggingface.co/docs/optimum/main/en/intel/inference#stable-diffusion-xl).
|
160 |
+
|
161 |
+
|
162 |
+
#### ONNX
|
163 |
+
|
164 |
+
To install Optimum with the dependencies required for ONNX Runtime inference :
|
165 |
+
|
166 |
+
```bash
|
167 |
+
pip install optimum[onnxruntime]
|
168 |
+
```
|
169 |
+
|
170 |
+
To load an ONNX model and run inference with ONNX Runtime, you need to replace `StableDiffusionXLPipeline` with Optimum `ORTStableDiffusionXLPipeline`. In case you want to load a PyTorch model and convert it to the ONNX format on-the-fly, you can set `export=True`.
|
171 |
+
|
172 |
+
```diff
|
173 |
+
- from diffusers import StableDiffusionPipeline
|
174 |
+
+ from optimum.onnxruntime import ORTStableDiffusionPipeline
|
175 |
+
|
176 |
+
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
177 |
+
- pipeline = StableDiffusionPipeline.from_pretrained(model_id)
|
178 |
+
+ pipeline = ORTStableDiffusionPipeline.from_pretrained(model_id)
|
179 |
+
prompt = "A majestic lion jumping from a big stone at night"
|
180 |
+
image = pipeline(prompt).images[0]
|
181 |
+
```
|
182 |
+
|
183 |
+
You can find more examples in optimum [documentation](https://huggingface.co/docs/optimum/main/en/onnxruntime/usage_guides/models#stable-diffusion-xl).
|
184 |
+
|
185 |
+
|
186 |
+
## Uses
|
187 |
+
|
188 |
+
### Direct Use
|
189 |
+
|
190 |
+
The model is intended for research purposes only. Possible research areas and tasks include
|
191 |
+
|
192 |
+
- Generation of artworks and use in design and other artistic processes.
|
193 |
+
- Applications in educational or creative tools.
|
194 |
+
- Research on generative models.
|
195 |
+
- Safe deployment of models which have the potential to generate harmful content.
|
196 |
+
- Probing and understanding the limitations and biases of generative models.
|
197 |
+
|
198 |
+
Excluded uses are described below.
|
199 |
+
|
200 |
+
### Out-of-Scope Use
|
201 |
+
|
202 |
+
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.
|
203 |
+
|
204 |
+
## Limitations and Bias
|
205 |
+
|
206 |
+
### Limitations
|
207 |
+
|
208 |
+
- The model does not achieve perfect photorealism
|
209 |
+
- The model cannot render legible text
|
210 |
+
- The model struggles with more difficult tasks which involve compositionality, such as rendering an image corresponding to “A red cube on top of a blue sphere”
|
211 |
+
- Faces and people in general may not be generated properly.
|
212 |
+
- The autoencoding part of the model is lossy.
|
213 |
+
|
214 |
+
### Bias
|
215 |
+
While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
|
comparison.png
ADDED
gitattributes.txt
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 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
01.png filter=lfs diff=lfs merge=lfs -text
|
model_index.json
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "StableDiffusionXLPipeline",
|
3 |
+
"_diffusers_version": "0.19.0.dev0",
|
4 |
+
"force_zeros_for_empty_prompt": true,
|
5 |
+
"add_watermarker": null,
|
6 |
+
"scheduler": [
|
7 |
+
"diffusers",
|
8 |
+
"EulerDiscreteScheduler"
|
9 |
+
],
|
10 |
+
"text_encoder": [
|
11 |
+
"transformers",
|
12 |
+
"CLIPTextModel"
|
13 |
+
],
|
14 |
+
"text_encoder_2": [
|
15 |
+
"transformers",
|
16 |
+
"CLIPTextModelWithProjection"
|
17 |
+
],
|
18 |
+
"tokenizer": [
|
19 |
+
"transformers",
|
20 |
+
"CLIPTokenizer"
|
21 |
+
],
|
22 |
+
"tokenizer_2": [
|
23 |
+
"transformers",
|
24 |
+
"CLIPTokenizer"
|
25 |
+
],
|
26 |
+
"unet": [
|
27 |
+
"diffusers",
|
28 |
+
"UNet2DConditionModel"
|
29 |
+
],
|
30 |
+
"vae": [
|
31 |
+
"diffusers",
|
32 |
+
"AutoencoderKL"
|
33 |
+
]
|
34 |
+
}
|
pipeline.png
ADDED
sd_xl_offset_example-lora_1.0.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4852686128f953d0277d0793e2f0335352f96a919c9c16a09787d77f55cbdf6f
|
3 |
+
size 49553604
|