Update README.md
Browse files
README.md
CHANGED
|
@@ -31,7 +31,7 @@ The provided OpenVINO™ IR model is compatible with:
|
|
| 31 |
* OpenVINO version 2024.5.0 and higher
|
| 32 |
* Optimum Intel 1.21.0 and higher
|
| 33 |
|
| 34 |
-
## Running Model Inference
|
| 35 |
|
| 36 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
| 37 |
|
|
@@ -42,21 +42,51 @@ pip install optimum[openvino]
|
|
| 42 |
2. Run model inference:
|
| 43 |
|
| 44 |
```
|
| 45 |
-
from optimum.intel import
|
| 46 |
|
| 47 |
model_id = "OpenVINO/LCM_Dreamshaper_v7-int8-ov"
|
| 48 |
-
pipeline =
|
| 49 |
|
| 50 |
prompt = "sailing ship in storm by Rembrandt"
|
| 51 |
images = pipeline(prompt, num_inference_steps=4).images
|
| 52 |
```
|
| 53 |
|
| 54 |
-
##
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
## Legal information
|
| 62 |
|
|
|
|
| 31 |
* OpenVINO version 2024.5.0 and higher
|
| 32 |
* Optimum Intel 1.21.0 and higher
|
| 33 |
|
| 34 |
+
## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
|
| 35 |
|
| 36 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
| 37 |
|
|
|
|
| 42 |
2. Run model inference:
|
| 43 |
|
| 44 |
```
|
| 45 |
+
from optimum.intel.openvino import OVDiffusionPipeline
|
| 46 |
|
| 47 |
model_id = "OpenVINO/LCM_Dreamshaper_v7-int8-ov"
|
| 48 |
+
pipeline = OVDiffusionPipeline.from_pretrained(model_id)
|
| 49 |
|
| 50 |
prompt = "sailing ship in storm by Rembrandt"
|
| 51 |
images = pipeline(prompt, num_inference_steps=4).images
|
| 52 |
```
|
| 53 |
|
| 54 |
+
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
| 55 |
|
| 56 |
+
1. Install packages required for using OpenVINO GenAI.
|
| 57 |
+
```
|
| 58 |
+
pip install huggingface_hub
|
| 59 |
+
pip install -U --pre --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly openvino openvino-tokenizers openvino-genai
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
2. Download model from HuggingFace Hub
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
import huggingface_hub as hf_hub
|
| 66 |
+
|
| 67 |
+
model_id = "OpenVINO/LCM_Dreamshaper_v7-int8-ov"
|
| 68 |
+
model_path = "LCM_Dreamshaper_v7-int8-ov"
|
| 69 |
+
|
| 70 |
+
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
| 71 |
+
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
3. Run model inference:
|
| 75 |
+
|
| 76 |
+
```
|
| 77 |
+
import openvino_genai as ov_genai
|
| 78 |
+
from PIL import Image
|
| 79 |
+
|
| 80 |
+
device = "CPU"
|
| 81 |
+
pipe = ov_genai.Text2ImagePipeline(model_path, device)
|
| 82 |
+
|
| 83 |
+
prompt = "sailing ship in storm by Rembrandt"
|
| 84 |
+
image_tensor = pipe.generate(prompt, num_inference_steps=4)
|
| 85 |
+
image = Image.fromarray(image_tensor.data[0])
|
| 86 |
+
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
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)
|
| 90 |
|
| 91 |
## Legal information
|
| 92 |
|