katuni4ka commited on
Commit
ca613a4
1 Parent(s): 75e614e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -11
README.md CHANGED
@@ -27,10 +27,10 @@ For more information on quantization, check the [OpenVINO model optimization gui
27
 
28
  The provided OpenVINO™ IR model is compatible with:
29
 
30
- * OpenVINO version 2024.0.0 and higher
31
  * Optimum Intel 1.16.0 and higher
32
 
33
- ## Running Model Inference
34
 
35
  1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
36
 
@@ -49,20 +49,47 @@ tokenizer = AutoTokenizer.from_pretrained(model_id)
49
  model = OVModelForCausalLM.from_pretrained(model_id)
50
 
51
 
52
- messages = [
53
- {"role": "user", "content": "What is your favourite condiment?"},
54
- {"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
55
- {"role": "user", "content": "Do you have mayonnaise recipes?"}
56
- ]
57
 
58
- inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")
59
-
60
- outputs = model.generate(inputs, max_new_tokens=20)
61
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
62
  ```
63
 
64
  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).
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  ## Limitations
67
 
68
  Check the original model card for [limitations](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#limitations).
 
27
 
28
  The provided OpenVINO™ IR model is compatible with:
29
 
30
+ * OpenVINO version 2024.2.0 and higher
31
  * Optimum Intel 1.16.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
 
 
49
  model = OVModelForCausalLM.from_pretrained(model_id)
50
 
51
 
52
+ inputs = tokenizer("What is OpenVINO?", return_tensors="pt")
 
 
 
 
53
 
54
+ outputs = model.generate(**inputs, max_length=200)
55
+ text = tokenizer.batch_decode(outputs)[0]
56
+ print(text)
 
57
  ```
58
 
59
  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).
60
 
61
+ ## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
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/mixtral-8x7b-instruct-v0.1-int4-ov"
74
+ model_path = "mixtral-8x7b-instruct-v0.1-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?"))
88
+ ```
89
+
90
+ 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)
91
+
92
+
93
  ## Limitations
94
 
95
  Check the original model card for [limitations](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#limitations).