Update README.md
Browse files
README.md
CHANGED
|
@@ -26,10 +26,10 @@ For more information on quantization, check the [OpenVINO model optimization gui
|
|
| 26 |
|
| 27 |
The provided OpenVINO™ IR model is compatible with:
|
| 28 |
|
| 29 |
-
* OpenVINO version 2024.
|
| 30 |
-
* Optimum Intel 1.
|
| 31 |
|
| 32 |
-
## Running Model Inference
|
| 33 |
|
| 34 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
| 35 |
|
|
@@ -40,21 +40,52 @@ pip install optimum[openvino]
|
|
| 40 |
2. Run model inference:
|
| 41 |
|
| 42 |
```
|
| 43 |
-
from optimum.intel.openvino import
|
| 44 |
|
| 45 |
model_id = "OpenVINO/stable-diffusion-v1-5-int8-ov"
|
| 46 |
-
pipeline =
|
| 47 |
|
| 48 |
prompt = "sailing ship in storm by Rembrandt"
|
| 49 |
-
images = pipeline(prompt).images
|
| 50 |
```
|
| 51 |
|
| 52 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
* [OpenVINO notebooks](https://github.com/openvinotoolkit/openvino_notebooks):
|
| 55 |
-
- [Latent Consistency Model using Optimum-Intel OpenVINO](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/stable-diffusion-text-to-image/stable-diffusion-text-to-image.ipynb)
|
| 56 |
-
* [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai):
|
| 57 |
-
- [C++ image generation pipeline](https://github.com/openvinotoolkit/openvino.genai/tree/master/image_generation/stable_diffusion_1_5/cpp)
|
| 58 |
|
| 59 |
## Limitations
|
| 60 |
|
|
|
|
| 26 |
|
| 27 |
The provided OpenVINO™ IR model is compatible with:
|
| 28 |
|
| 29 |
+
* OpenVINO version 2024.6.0 and higher
|
| 30 |
+
* Optimum Intel 1.21.0 and higher
|
| 31 |
|
| 32 |
+
## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
|
| 33 |
|
| 34 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
| 35 |
|
|
|
|
| 40 |
2. Run model inference:
|
| 41 |
|
| 42 |
```
|
| 43 |
+
from optimum.intel.openvino import OVDiffusionPipeline
|
| 44 |
|
| 45 |
model_id = "OpenVINO/stable-diffusion-v1-5-int8-ov"
|
| 46 |
+
pipeline = OVDiffusionPipeline.from_pretrained(model_id)
|
| 47 |
|
| 48 |
prompt = "sailing ship in storm by Rembrandt"
|
| 49 |
+
images = pipeline(prompt, num_inference_steps=4).images
|
| 50 |
```
|
| 51 |
|
| 52 |
+
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
| 53 |
+
|
| 54 |
+
1. Install packages required for using OpenVINO GenAI.
|
| 55 |
+
```
|
| 56 |
+
pip install huggingface_hub
|
| 57 |
+
pip install -U --pre --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly openvino openvino-tokenizers openvino-genai
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
2. Download model from HuggingFace Hub
|
| 61 |
+
|
| 62 |
+
```
|
| 63 |
+
import huggingface_hub as hf_hub
|
| 64 |
+
|
| 65 |
+
model_id = "OpenVINO/stable-diffusion-v1-5-int8-ov"
|
| 66 |
+
model_path = "stable-diffusion-v1-5-int8-ov"
|
| 67 |
+
|
| 68 |
+
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
| 69 |
+
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
3. Run model inference:
|
| 73 |
+
|
| 74 |
+
```
|
| 75 |
+
import openvino_genai as ov_genai
|
| 76 |
+
from PIL import Image
|
| 77 |
+
|
| 78 |
+
device = "CPU"
|
| 79 |
+
pipe = ov_genai.Text2ImagePipeline(model_path, device)
|
| 80 |
+
|
| 81 |
+
prompt = "sailing ship in storm by Rembrandt"
|
| 82 |
+
image_tensor = pipe.generate(prompt, num_inference_steps=4)
|
| 83 |
+
image = Image.fromarray(image_tensor.data[0])
|
| 84 |
+
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
More GenAI usage examples can be found in OpenVINO GenAI library [docs](https://github.com/openvinotoolkit/openvino.genai/blob/master/src/README.md) and [samples](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#openvino-genai-samples)
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
## Limitations
|
| 91 |
|