Improve language tag
#1
by
lbourdois
- opened
README.md
CHANGED
|
@@ -1,99 +1,111 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
language:
|
| 4 |
-
-
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
*
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
*
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
```
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
```
|
| 95 |
-
import
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
print(pipe.generate("What is OpenVINO?", max_length=200))
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- zho
|
| 5 |
+
- eng
|
| 6 |
+
- fra
|
| 7 |
+
- spa
|
| 8 |
+
- por
|
| 9 |
+
- deu
|
| 10 |
+
- ita
|
| 11 |
+
- rus
|
| 12 |
+
- jpn
|
| 13 |
+
- kor
|
| 14 |
+
- vie
|
| 15 |
+
- tha
|
| 16 |
+
- ara
|
| 17 |
+
base_model:
|
| 18 |
+
- Qwen/Qwen2.5-3B-Instruct
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
+
library_name: transformers
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# Qwen-2.5-3B-Instruct-ov-INT4
|
| 24 |
+
* Model creator: [Qwen](https://huggingface.co/Qwen)
|
| 25 |
+
* Original model: [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct)
|
| 26 |
+
|
| 27 |
+
## Description
|
| 28 |
+
This is [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2024/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to INT4 by [NNCF](https://github.com/openvinotoolkit/nncf).
|
| 29 |
+
|
| 30 |
+
## Quantization Parameters
|
| 31 |
+
|
| 32 |
+
Weight compression was performed using `nncf.compress_weights` with the following parameters:
|
| 33 |
+
|
| 34 |
+
* mode: **int4_sym**
|
| 35 |
+
* ratio: **0.6**
|
| 36 |
+
* group_size: **64**
|
| 37 |
+
|
| 38 |
+
For more information on quantization, check the [OpenVINO model optimization guide](https://docs.openvino.ai/2024/openvino-workflow/model-optimization-guide/weight-compression.html).
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
## Compatibility
|
| 42 |
+
|
| 43 |
+
The provided OpenVINO™ IR model is compatible with:
|
| 44 |
+
|
| 45 |
+
* OpenVINO version 2024.4.0 and higher
|
| 46 |
+
* Optimum Intel 1.19.0 and higher
|
| 47 |
+
|
| 48 |
+
## Prompt Template
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
<|im_start|>system
|
| 52 |
+
You are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>
|
| 53 |
+
<|im_start|>user
|
| 54 |
+
{input}<|im_end|>
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
| 61 |
+
|
| 62 |
+
```
|
| 63 |
+
pip install optimum[openvino]
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
2. Run model inference:
|
| 67 |
+
|
| 68 |
+
```
|
| 69 |
+
from transformers import AutoTokenizer
|
| 70 |
+
from optimum.intel.openvino import OVModelForCausalLM
|
| 71 |
+
|
| 72 |
+
model_id = "srang992/Qwen-2.5-3B-Instruct-ov-INT4"
|
| 73 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 74 |
+
model = OVModelForCausalLM.from_pretrained(model_id)
|
| 75 |
+
|
| 76 |
+
inputs = tokenizer("What is OpenVINO?", return_tensors="pt")
|
| 77 |
+
|
| 78 |
+
outputs = model.generate(**inputs, max_length=200)
|
| 79 |
+
text = tokenizer.batch_decode(outputs)[0]
|
| 80 |
+
print(text)
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
For more examples and possible optimizations, refer to the [OpenVINO Large Language Model Inference Guide](https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide.html).
|
| 84 |
+
|
| 85 |
+
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
| 86 |
+
|
| 87 |
+
1. Install packages required for using OpenVINO GenAI.
|
| 88 |
+
```
|
| 89 |
+
pip install openvino-genai huggingface_hub
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
2. Download model from HuggingFace Hub
|
| 93 |
+
|
| 94 |
+
```
|
| 95 |
+
import huggingface_hub as hf_hub
|
| 96 |
+
|
| 97 |
+
model_id = "srang992/Qwen-2.5-3B-Instruct-ov-INT4"
|
| 98 |
+
model_path = "Qwen-2.5-3B-Instruct-ov-INT4"
|
| 99 |
+
|
| 100 |
+
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
| 101 |
+
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
3. Run model inference:
|
| 105 |
+
|
| 106 |
+
```
|
| 107 |
+
import openvino_genai as ov_genai
|
| 108 |
+
|
| 109 |
+
device = "CPU"
|
| 110 |
+
pipe = ov_genai.LLMPipeline(model_path, device)
|
| 111 |
print(pipe.generate("What is OpenVINO?", max_length=200))
|