add README
Browse files
README.md
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: creativeml-openrail-m
|
3 |
+
tags:
|
4 |
+
- stable-diffusion
|
5 |
+
- stable-diffusion-diffusers
|
6 |
+
- text-to-image
|
7 |
+
inference: true
|
8 |
+
extra_gated_prompt: |-
|
9 |
+
This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
|
10 |
+
The CreativeML OpenRAIL License specifies:
|
11 |
+
|
12 |
+
1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
|
13 |
+
2. CompVis claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
|
14 |
+
3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
|
15 |
+
Please read the full license carefully here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
|
16 |
+
|
17 |
+
extra_gated_heading: Please read the LICENSE to access this model
|
18 |
+
---
|
19 |
+
|
20 |
+
# OpenVINO Stable Diffusion
|
21 |
+
|
22 |
+
This repository contains the models from [Stable Diffusion v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5) from RunwayML converted to
|
23 |
+
OpenVINO, for accelerated inference on CPU with OpenVINO's integration into Optimum:
|
24 |
+
[optimum-intel](https://github.com/huggingface/optimum-intel#openvino). Please check out the [source model
|
25 |
+
repository](https://huggingface.co/runwayml/stable-diffusion-v1-5) for more information about the model and its license.
|
26 |
+
|
27 |
+
> NOTE: Stable Diffusion in OpenVINO is work-in-progress. This code does not yet work with the current version of
|
28 |
+
> optimum-intel but will work soon.
|
29 |
+
|
30 |
+
This example code uses static shapes for even faster inference. Using larger sizes will require more memory.
|
31 |
+
|
32 |
+
```python
|
33 |
+
from optimum.intel.openvino.modeling_diffusion import OVStableDiffusionPipeline
|
34 |
+
|
35 |
+
batch_size = 1
|
36 |
+
num_images_per_prompt = 1
|
37 |
+
height = 256
|
38 |
+
width = 256
|
39 |
+
|
40 |
+
# load the model and reshape to static shapes for faster inference
|
41 |
+
model_id = "helenai/runwayml-stable-diffusion-v1-5-ov-fp32"
|
42 |
+
stable_diffusion = OVStableDiffusionPipeline.from_pretrained(model_id, compile=False)
|
43 |
+
stable_diffusion.reshape( batch_size=batch_size, height=height, width=width, num_images_per_prompt=num_images_per_prompt)
|
44 |
+
stable_diffusion.compile()
|
45 |
+
|
46 |
+
# generate image!
|
47 |
+
prompt = "sailing ship in storm by Leonardo da Vinci"
|
48 |
+
images = stable_diffusion(prompt, height=height, width=width, num_images_per_prompt=num_images_per_prompt).images
|
49 |
+
images[0].save("result.png")
|
50 |
+
```
|