helenai commited on
Commit
30a382d
·
verified ·
1 Parent(s): d3e8b78

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +87 -0
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - Qwen/Qwen2.5-VL-7B-Instruct
4
+ ---
5
+
6
+ This is the [Qwen/Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) model, converted to OpenVINO, with nf4 weights for the language model, int8 weights for the other models.
7
+ The nf4 weights are compressed with symmetric, channel-wise quantization. The model works on Intel NPU. See below for the model export command/properties.
8
+
9
+ ## Download Model
10
+
11
+ To download the model, run `pip install huggingface-hub[cli]` and then:
12
+ ```
13
+ huggingface-cli download helenai/Qwen2.5-VL-7B-Instruct-ov-nf4-npu --local-dir Qwen2.5-VL-7B-Instruct-ov-nf4-npu
14
+ ```
15
+
16
+ ## Run inference with OpenVINO GenAI
17
+
18
+ Use OpenVINO GenAI to run inference on this model. This model works with OpenVINO GenAI 2025.3 and later. Make sure to use the latest NPU driver ([Windows](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html), [Linux](https://github.com/intel/linux-npu-driver))
19
+
20
+ - Install OpenVINO GenAI and pillow:
21
+
22
+ ```
23
+ pip install --upgrade openvino-genai pillow
24
+ ```
25
+
26
+ - Download a test image: `curl -O "https://storage.openvinotoolkit.org/test_data/images/dog.jpg"`
27
+ - Run inference:
28
+
29
+ ```python
30
+ import numpy as np
31
+ import openvino as ov
32
+ import openvino_genai
33
+ from PIL import Image
34
+
35
+ # CACHE_DIR caches the model the first time, so subsequent model loading will be faster
36
+ pipeline_config = {"CACHE_DIR": "model_cache"}
37
+ pipe = openvino_genai.VLMPipeline("Qwen2.5-VL-7B-Instruct-ov-nf4-npu", "NPU", **pipeline_config)
38
+
39
+ image = Image.open("dog.jpg")
40
+ # optional: resizing to a smaller size (depending on image and prompt) is often useful to speed up inference.
41
+ image = image.resize((128, 128))
42
+
43
+ image_data = np.array(image.getdata()).reshape(1, image.size[1], image.size[0], 3).astype(np.uint8)
44
+ image_data = ov.Tensor(image_data)
45
+
46
+ prompt = "Can you describe the image?"
47
+ result = pipe.generate(prompt, image=image_data, max_new_tokens=100)
48
+ print(result.texts[0])
49
+ ```
50
+
51
+ See [OpenVINO GenAI repository](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#performing-visual-language-text-generation)
52
+
53
+ ## Model export properties
54
+
55
+ Model export command:
56
+
57
+ ```
58
+ optimum-cli export openvino -m Qwen/Qwen2.5-VL-7B-Instruct --weight-format nf4 --group-size -1 --sym Qwen2.5-VL-7B-Instruct-ov-nf4-npu
59
+ ```
60
+
61
+ ### Framework versions
62
+
63
+ ```
64
+ openvino : 2025.3.0-19807-44526285f24-releases/2025/3
65
+ nncf : 2.18.0
66
+ optimum_intel : 1.26.0.dev0+bc13ae5
67
+ optimum : 1.27.0
68
+ pytorch : 2.7.1
69
+ transformers : 4.51.3
70
+ ```
71
+
72
+ ### LLM export properties
73
+
74
+ ```
75
+ all_layers : False
76
+ awq : False
77
+ backup_mode : int8_asym
78
+ compression_format : dequantize
79
+ gptq : False
80
+ group_size : -1
81
+ ignored_scope : []
82
+ lora_correction : False
83
+ mode : nf4
84
+ ratio : 1.0
85
+ scale_estimation : False
86
+ sensitivity_metric : weight_quantization_error
87
+ ```