srang992 commited on
Commit
09d3b7f
1 Parent(s): 22e8194

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +91 -3
README.md CHANGED
@@ -1,3 +1,91 @@
1
- ---
2
- license: llama3.2
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3.2
3
+ language:
4
+ - en
5
+ base_model:
6
+ - meta-llama/Llama-3.2-1B-Instruct
7
+ pipeline_tag: text-generation
8
+ library_name: transformers
9
+ ---
10
+
11
+ # Llama-3.2-1B-Instruct-ov-INT8
12
+ * Model creator: [Meta Llama](https://huggingface.co/meta-llama)
13
+ * Original model: [Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct)
14
+
15
+ ## Description
16
+ This is [Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-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 INT8 by [NNCF](https://github.com/openvinotoolkit/nncf).
17
+
18
+ ## Quantization Parameters
19
+
20
+ Weight compression was performed using `nncf.compress_weights` with the following parameters:
21
+
22
+ * mode: **int8_asym**
23
+ * ratio: **1**
24
+ * group_size: **128**
25
+
26
+ For more information on quantization, check the [OpenVINO model optimization guide](https://docs.openvino.ai/2024/openvino-workflow/model-optimization-guide/weight-compression.html).
27
+
28
+
29
+ ## Compatibility
30
+
31
+ The provided OpenVINO™ IR model is compatible with:
32
+
33
+ * OpenVINO version 2024.4.0 and higher
34
+ * Optimum Intel 1.19.0 and higher
35
+
36
+ ## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
37
+
38
+
39
+ 1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
40
+
41
+ ```
42
+ pip install optimum[openvino]
43
+ ```
44
+
45
+ 2. Run model inference:
46
+
47
+ ```
48
+ from transformers import AutoTokenizer
49
+ from optimum.intel.openvino import OVModelForCausalLM
50
+
51
+ model_id = "srang992/Llama-3.2-1B-Instruct-ov-INT8"
52
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
53
+ model = OVModelForCausalLM.from_pretrained(model_id)
54
+
55
+ inputs = tokenizer("What is OpenVINO?", return_tensors="pt")
56
+
57
+ outputs = model.generate(**inputs, max_length=200)
58
+ text = tokenizer.batch_decode(outputs)[0]
59
+ print(text)
60
+ ```
61
+
62
+ 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).
63
+
64
+ ## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
65
+
66
+ 1. Install packages required for using OpenVINO GenAI.
67
+ ```
68
+ pip install openvino-genai huggingface_hub
69
+ ```
70
+
71
+ 2. Download model from HuggingFace Hub
72
+
73
+ ```
74
+ import huggingface_hub as hf_hub
75
+
76
+ model_id = "srang992/Llama-3.2-1B-Instruct-ov-INT8"
77
+ model_path = "Llama-3.2-1B-Instruct-ov-INT8"
78
+
79
+ hf_hub.snapshot_download(model_id, local_dir=model_path)
80
+
81
+ ```
82
+
83
+ 3. Run model inference:
84
+
85
+ ```
86
+ import openvino_genai as ov_genai
87
+
88
+ device = "CPU"
89
+ pipe = ov_genai.LLMPipeline(model_path, device)
90
+ print(pipe.generate("What is OpenVINO?", max_length=200))
91
+ ```