File size: 2,153 Bytes
118bac7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
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
---
language:
- en
- de
- fr
- it
- pt
- hi
- es
- th
license: llama3.2
library_name: transformers
tags:
- woq
- intel-neural-compressor
- inc
- neural-compressor
- intel
- teq
- meta
- pytorch
- llama
- llama-3
model_name: Llama 3.2 1B Instruct
base_model: meta-llama/Llama-3.2-1B-Instruct
inference: false
model_creator: meta-llama
pipeline_tag: text-generation
prompt_template: '{prompt}
  '
quantized_by: fbaldassarri
---

## Model Information

Quantized version of [meta-llama/Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct) using torch.float32 for quantization tuning.
- 4 bits (INT4)
- group size = 128
- Asymmetrical Quantization
- Algorith method: TEQ (Trainable Equivalent Transformation for Quantization of LLMs)

Quantization framework: [Intel Neural Compressor](https://github.com/intel/neural-compressor/) version 3.3.1

Note: this INT4 version of Llama-3.2-1B-Instruct has been quantized to run inference through CPU.

## Disclaimer

This quantized model comes with no warrenty. It has been developed experimetally only for research purposes. 

This repository only contains contains two files: quantized_model.pt (weights structure) and qconfig.json, and the generated model is a quantized model. 
It needs to be used in combination with the base model meta-llama/Llama-3.2-1B-Instruct.

## Replication Recipe

```
$ conda create --name neural-compressor-3.3.1 --file requirements_conda_neural-compressor-3.3.1

$ python meta-llama_Llama-3.2-1B-Instruct-TEQ-int4-gs128-asym.py
```

## Run Inference

To run inference you can use [fbaldassarri/woq-inference](https://github.com/fbaldassarri/woq-inference).

```
python teq_inference.py --base meta-llama/Llama-3.2-1B-Instruct --model_dir ./meta-llama_Llama-3.2-1B-Instruct-TEQ-int4-gs128-asym --weights_file quantized_weight.pt --config_file qconfig.json --prompt "What If you have got superpowers?" --device cpu
```

Note: You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

## License

[Llama 3.2 Community License](https://github.com/meta-llama/llama-models/blob/main/models/llama3_2/LICENSE)