Update README.md
Browse files
README.md
CHANGED
|
@@ -37,47 +37,6 @@ The provided OpenVINO™ IR model is compatible with:
|
|
| 37 |
* OpenVINO version 2025.2.0 and higher
|
| 38 |
* Optimum Intel 1.26.0 and higher
|
| 39 |
|
| 40 |
-
## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
|
| 41 |
-
|
| 42 |
-
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
| 43 |
-
|
| 44 |
-
```
|
| 45 |
-
pip install --pre -U --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release openvino_tokenizers openvino
|
| 46 |
-
|
| 47 |
-
pip install git+https://github.com/huggingface/optimum-intel.git
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
2. Run model inference
|
| 51 |
-
|
| 52 |
-
```
|
| 53 |
-
from PIL import Image
|
| 54 |
-
import requests
|
| 55 |
-
from optimum.intel.openvino import OVModelForVisualCausalLM
|
| 56 |
-
from transformers import AutoTokenizer, TextStreamer
|
| 57 |
-
|
| 58 |
-
model_id = "OpenVINO/llava-v1.6-mistral-7b-hf-int8-ov"
|
| 59 |
-
|
| 60 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 61 |
-
|
| 62 |
-
ov_model = OVModelForVisualCausalLM.from_pretrained(model_id, trust_remote_code=True)
|
| 63 |
-
prompt = "What is unusual on this picture?"
|
| 64 |
-
|
| 65 |
-
url = "https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/d5fbbd1a-d484-415c-88cb-9986625b7b11"
|
| 66 |
-
image = Image.open(requests.get(url, stream=True).raw)
|
| 67 |
-
|
| 68 |
-
inputs = ov_model.preprocess_inputs(text=prompt, image=image, tokenizer=tokenizer, config=ov_model.config)
|
| 69 |
-
|
| 70 |
-
generation_args = {
|
| 71 |
-
"max_new_tokens": 100,
|
| 72 |
-
"streamer": TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
generate_ids = ov_model.generate(**inputs, **generation_args)
|
| 76 |
-
|
| 77 |
-
generate_ids = generate_ids[:, inputs['input_ids'].shape[1]:]
|
| 78 |
-
response = tokenizer.batch_decode(generate_ids, skip_special_tokens=True)[0]
|
| 79 |
-
|
| 80 |
-
```
|
| 81 |
|
| 82 |
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
| 83 |
|
|
|
|
| 37 |
* OpenVINO version 2025.2.0 and higher
|
| 38 |
* Optimum Intel 1.26.0 and higher
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
| 42 |
|