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