Files changed (1) hide show
  1. README.md +121 -108
README.md CHANGED
@@ -1,108 +1,121 @@
1
- ---
2
- license: apache-2.0
3
- license_link: https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE
4
- base_model:
5
- - Qwen/Qwen2.5-7B-Instruct
6
- base_model_relation: quantized
7
-
8
- ---
9
- # Qwen2.5-7B-Instruct-int4-ov
10
- * Model creator: [Qwen](https://huggingface.co/Qwen)
11
- * Original model: [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)
12
-
13
- ## Description
14
- This is [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2025/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to INT4 by [NNCF](https://github.com/openvinotoolkit/nncf).
15
-
16
- ## Quantization Parameters
17
-
18
- Weight compression was performed using `nncf.compress_weights` with the following parameters:
19
-
20
- * mode: **INT4_ASYM**
21
- * ratio: **1**
22
- * group_size: **128**
23
-
24
- For more information on quantization, check the [OpenVINO model optimization guide](https://docs.openvino.ai/2025/openvino-workflow/model-optimization-guide/weight-compression.html).
25
-
26
- ## Compatibility
27
-
28
- The provided OpenVINO™ IR model is compatible with:
29
-
30
- * OpenVINO version 2025.1.0 and higher
31
- * Optimum Intel 1.24.0 and higher
32
-
33
- ## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
34
-
35
- 1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
36
-
37
- ```
38
- pip install optimum[openvino]
39
- ```
40
-
41
- 2. Run model inference:
42
-
43
- ```
44
- from transformers import AutoTokenizer
45
- from optimum.intel.openvino import OVModelForCausalLM
46
-
47
- model_id = "OpenVINO/qwen2.5-7b-instruct-int4-ov"
48
- tokenizer = AutoTokenizer.from_pretrained(model_id)
49
- model = OVModelForCausalLM.from_pretrained(model_id)
50
-
51
- inputs = tokenizer("What is OpenVINO?", return_tensors="pt")
52
-
53
- outputs = model.generate(**inputs, max_length=200)
54
- text = tokenizer.batch_decode(outputs)[0]
55
- print(text)
56
- ```
57
-
58
- For more examples and possible optimizations, refer to the [Inference with Optimum Intel](https://docs.openvino.ai/2025/openvino-workflow-generative/inference-with-optimum-intel.html).
59
-
60
- ## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
61
-
62
-
63
- 1. Install packages required for using OpenVINO GenAI.
64
- ```
65
- pip install openvino-genai huggingface_hub
66
- ```
67
-
68
- 2. Download model from HuggingFace Hub
69
-
70
- ```
71
- import huggingface_hub as hf_hub
72
-
73
- model_id = "OpenVINO/qwen2.5-7b-instruct-int4-ov"
74
- model_path = "qwen2.5-7b-instruct-int4-ov"
75
-
76
- hf_hub.snapshot_download(model_id, local_dir=model_path)
77
-
78
- ```
79
-
80
- 3. Run model inference:
81
-
82
- ```
83
- import openvino_genai as ov_genai
84
-
85
- device = "CPU"
86
- pipe = ov_genai.LLMPipeline(model_path, device)
87
- print(pipe.generate("What is OpenVINO?", max_length=200))
88
- ```
89
-
90
- More GenAI usage examples can be found in OpenVINO GenAI library [docs](https://docs.openvino.ai/2025/openvino-workflow-generative/inference-with-genai.html) and [samples](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#openvino-genai-samples)
91
-
92
- You can find more detaild usage examples in OpenVINO Notebooks:
93
-
94
- - [LLM](https://openvinotoolkit.github.io/openvino_notebooks/?search=LLM)
95
- - [RAG text generation](https://openvinotoolkit.github.io/openvino_notebooks/?search=RAG+system&tasks=Text+Generation)
96
- - [Convert models from ModelScope to OpenVINO](https://openvinotoolkit.github.io/openvino_notebooks/?search=Convert+models+from+ModelScope+to+OpenVINO)
97
-
98
- ## Limitations
99
-
100
- Check the original [model card](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) for limitations.
101
-
102
- ## Legal information
103
-
104
- The original model is distributed under [Apache License Version 2.0](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE) license. More details can be found in [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct).
105
-
106
- ## Disclaimer
107
-
108
- Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See [Intel’s Global Human Rights Principles](https://www.intel.com/content/dam/www/central-libraries/us/en/documents/policy-human-rights.pdf). Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE
4
+ base_model:
5
+ - Qwen/Qwen2.5-7B-Instruct
6
+ base_model_relation: quantized
7
+ language:
8
+ - zho
9
+ - eng
10
+ - fra
11
+ - spa
12
+ - por
13
+ - deu
14
+ - ita
15
+ - rus
16
+ - jpn
17
+ - kor
18
+ - vie
19
+ - tha
20
+ - ara
21
+ ---
22
+ # Qwen2.5-7B-Instruct-int4-ov
23
+ * Model creator: [Qwen](https://huggingface.co/Qwen)
24
+ * Original model: [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)
25
+
26
+ ## Description
27
+ This is [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2025/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to INT4 by [NNCF](https://github.com/openvinotoolkit/nncf).
28
+
29
+ ## Quantization Parameters
30
+
31
+ Weight compression was performed using `nncf.compress_weights` with the following parameters:
32
+
33
+ * mode: **INT4_ASYM**
34
+ * ratio: **1**
35
+ * group_size: **128**
36
+
37
+ For more information on quantization, check the [OpenVINO model optimization guide](https://docs.openvino.ai/2025/openvino-workflow/model-optimization-guide/weight-compression.html).
38
+
39
+ ## Compatibility
40
+
41
+ The provided OpenVINO™ IR model is compatible with:
42
+
43
+ * OpenVINO version 2025.1.0 and higher
44
+ * Optimum Intel 1.24.0 and higher
45
+
46
+ ## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
47
+
48
+ 1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
49
+
50
+ ```
51
+ pip install optimum[openvino]
52
+ ```
53
+
54
+ 2. Run model inference:
55
+
56
+ ```
57
+ from transformers import AutoTokenizer
58
+ from optimum.intel.openvino import OVModelForCausalLM
59
+
60
+ model_id = "OpenVINO/qwen2.5-7b-instruct-int4-ov"
61
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
62
+ model = OVModelForCausalLM.from_pretrained(model_id)
63
+
64
+ inputs = tokenizer("What is OpenVINO?", return_tensors="pt")
65
+
66
+ outputs = model.generate(**inputs, max_length=200)
67
+ text = tokenizer.batch_decode(outputs)[0]
68
+ print(text)
69
+ ```
70
+
71
+ For more examples and possible optimizations, refer to the [Inference with Optimum Intel](https://docs.openvino.ai/2025/openvino-workflow-generative/inference-with-optimum-intel.html).
72
+
73
+ ## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
74
+
75
+
76
+ 1. Install packages required for using OpenVINO GenAI.
77
+ ```
78
+ pip install openvino-genai huggingface_hub
79
+ ```
80
+
81
+ 2. Download model from HuggingFace Hub
82
+
83
+ ```
84
+ import huggingface_hub as hf_hub
85
+
86
+ model_id = "OpenVINO/qwen2.5-7b-instruct-int4-ov"
87
+ model_path = "qwen2.5-7b-instruct-int4-ov"
88
+
89
+ hf_hub.snapshot_download(model_id, local_dir=model_path)
90
+
91
+ ```
92
+
93
+ 3. Run model inference:
94
+
95
+ ```
96
+ import openvino_genai as ov_genai
97
+
98
+ device = "CPU"
99
+ pipe = ov_genai.LLMPipeline(model_path, device)
100
+ print(pipe.generate("What is OpenVINO?", max_length=200))
101
+ ```
102
+
103
+ More GenAI usage examples can be found in OpenVINO GenAI library [docs](https://docs.openvino.ai/2025/openvino-workflow-generative/inference-with-genai.html) and [samples](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#openvino-genai-samples)
104
+
105
+ You can find more detaild usage examples in OpenVINO Notebooks:
106
+
107
+ - [LLM](https://openvinotoolkit.github.io/openvino_notebooks/?search=LLM)
108
+ - [RAG text generation](https://openvinotoolkit.github.io/openvino_notebooks/?search=RAG+system&tasks=Text+Generation)
109
+ - [Convert models from ModelScope to OpenVINO](https://openvinotoolkit.github.io/openvino_notebooks/?search=Convert+models+from+ModelScope+to+OpenVINO)
110
+
111
+ ## Limitations
112
+
113
+ Check the original [model card](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) for limitations.
114
+
115
+ ## Legal information
116
+
117
+ The original model is distributed under [Apache License Version 2.0](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE) license. More details can be found in [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct).
118
+
119
+ ## Disclaimer
120
+
121
+ Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See [Intel’s Global Human Rights Principles](https://www.intel.com/content/dam/www/central-libraries/us/en/documents/policy-human-rights.pdf). Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.