Update README.md
Browse files
README.md
CHANGED
@@ -15,7 +15,8 @@ The provided OpenVINO™ IR model is compatible with:
|
|
15 |
* OpenVINO version 2024.4.0 and higher
|
16 |
* Optimum Intel 1.20.0 and higher
|
17 |
|
18 |
-
## Running Model Inference
|
|
|
19 |
|
20 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
21 |
|
@@ -33,7 +34,7 @@ model_id = "OpenVINO/codegen-6B-multi-fp16-ov"
|
|
33 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
34 |
model = OVModelForCausalLM.from_pretrained(model_id)
|
35 |
|
36 |
-
inputs = tokenizer("
|
37 |
|
38 |
outputs = model.generate(**inputs, max_length=200)
|
39 |
text = tokenizer.batch_decode(outputs)[0]
|
@@ -42,6 +43,36 @@ print(text)
|
|
42 |
|
43 |
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).
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
## Limitations
|
46 |
|
47 |
Check the original model card for [original model card](https://huggingface.co/Salesforce/codegen-6B-multi) for limitations.
|
|
|
15 |
* OpenVINO version 2024.4.0 and higher
|
16 |
* Optimum Intel 1.20.0 and higher
|
17 |
|
18 |
+
## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
|
19 |
+
|
20 |
|
21 |
1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
|
22 |
|
|
|
34 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
35 |
model = OVModelForCausalLM.from_pretrained(model_id)
|
36 |
|
37 |
+
inputs = tokenizer("def print_hello_world():", return_tensors="pt")
|
38 |
|
39 |
outputs = model.generate(**inputs, max_length=200)
|
40 |
text = tokenizer.batch_decode(outputs)[0]
|
|
|
43 |
|
44 |
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).
|
45 |
|
46 |
+
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
47 |
+
|
48 |
+
1. Install packages required for using OpenVINO GenAI.
|
49 |
+
```
|
50 |
+
pip install openvino-genai huggingface_hub
|
51 |
+
```
|
52 |
+
|
53 |
+
2. Download model from HuggingFace Hub
|
54 |
+
|
55 |
+
```
|
56 |
+
import huggingface_hub as hf_hub
|
57 |
+
|
58 |
+
model_id = "OpenVINO/codegen-6B-multi-fp16-ov"
|
59 |
+
model_path = "codegen-6B-multi-fp16-ov"
|
60 |
+
|
61 |
+
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
62 |
+
|
63 |
+
```
|
64 |
+
|
65 |
+
3. Run model inference:
|
66 |
+
|
67 |
+
```
|
68 |
+
import openvino_genai as ov_genai
|
69 |
+
|
70 |
+
device = "CPU"
|
71 |
+
pipe = ov_genai.LLMPipeline(model_path, device)
|
72 |
+
print(pipe.generate("def print_hello_world():", max_length=200))
|
73 |
+
```
|
74 |
+
|
75 |
+
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)
|
76 |
## Limitations
|
77 |
|
78 |
Check the original model card for [original model card](https://huggingface.co/Salesforce/codegen-6B-multi) for limitations.
|