File size: 896 Bytes
dfe5a34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
Generated using autoawq: `pip install git+https://github.com/casper-hansen/AutoAWQ.git@f0321eedca887c12680553fc561d176b03b1b9a5 flash_attn`

Following code used for generation:

```python
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer

model_path = 'models/Phi-3-medium-128k-instruct'
quant_path = 'models/Phi-3-medium-128k-instruct-awq'
quant_config = { "zero_point": True, "q_group_size": 128, "w_bit": 4, "version": "GEMM" }

# Load model
model = AutoAWQForCausalLM.from_pretrained(model_path, **{"device_map": "auto"})
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)

# Quantize
model.quantize(tokenizer, quant_config=quant_config)

# Save quantized model
model.save_quantized(quant_path)
tokenizer.save_pretrained(quant_path)
```

Original model here: https://huggingface.co/microsoft/Phi-3-medium-128k-instruct

---
license: mit
---