Update README.md
Browse files
README.md
CHANGED
@@ -18,7 +18,8 @@ The provided OpenVINO™ IR model is compatible with:
|
|
18 |
* OpenVINO version 2024.1.0 and higher
|
19 |
* Optimum Intel 1.16.0 and higher
|
20 |
|
21 |
-
## Running Model Inference
|
|
|
22 |
|
23 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
24 |
|
@@ -32,7 +33,7 @@ pip install optimum[openvino]
|
|
32 |
from transformers import AutoTokenizer
|
33 |
from optimum.intel.openvino import OVModelForCausalLM
|
34 |
|
35 |
-
model_id = "OpenVINO
|
36 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
37 |
model = OVModelForCausalLM.from_pretrained(model_id)
|
38 |
|
@@ -45,6 +46,37 @@ print(text)
|
|
45 |
|
46 |
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).
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
## Legal information
|
49 |
|
50 |
The original model is distributed under [bigcode-openrail-m](https://www.bigcode-project.org/docs/pages/bigcode-openrail/) license. More details can be found in [bigcode/starcoder2-3b](https://huggingface.co/bigcode/starcoder2-3b).
|
|
|
18 |
* OpenVINO version 2024.1.0 and higher
|
19 |
* Optimum Intel 1.16.0 and higher
|
20 |
|
21 |
+
## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
|
22 |
+
|
23 |
|
24 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
25 |
|
|
|
33 |
from transformers import AutoTokenizer
|
34 |
from optimum.intel.openvino import OVModelForCausalLM
|
35 |
|
36 |
+
model_id = "OpenVINO/<model_name>"
|
37 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
38 |
model = OVModelForCausalLM.from_pretrained(model_id)
|
39 |
|
|
|
46 |
|
47 |
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).
|
48 |
|
49 |
+
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
50 |
+
|
51 |
+
1. Install packages required for using OpenVINO GenAI.
|
52 |
+
```
|
53 |
+
pip install openvino-genai huggingface_hub
|
54 |
+
```
|
55 |
+
|
56 |
+
2. Download model from HuggingFace Hub
|
57 |
+
|
58 |
+
```
|
59 |
+
import huggingface_hub as hf_hub
|
60 |
+
|
61 |
+
model_id = "OpenVINO/starcoder2-3b-fp16-ov"
|
62 |
+
model_path = "starcoder2-3b-fp16-ov"
|
63 |
+
|
64 |
+
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
65 |
+
|
66 |
+
```
|
67 |
+
|
68 |
+
3. Run model inference:
|
69 |
+
|
70 |
+
```
|
71 |
+
import openvino_genai as ov_genai
|
72 |
+
|
73 |
+
device = "CPU"
|
74 |
+
pipe = ov_genai.LLMPipeline(model_path, device)
|
75 |
+
print(pipe.generate("def print_hello_world():"))
|
76 |
+
```
|
77 |
+
|
78 |
+
More GenAI usage examples can be found in OpenVINO GenAI library [docs](https://github.com/openvinotoolkit/openvino.genai/blob/master/src/README.md) and [samples](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#openvino-genai-samples)
|
79 |
+
|
80 |
## Legal information
|
81 |
|
82 |
The original model is distributed under [bigcode-openrail-m](https://www.bigcode-project.org/docs/pages/bigcode-openrail/) license. More details can be found in [bigcode/starcoder2-3b](https://huggingface.co/bigcode/starcoder2-3b).
|