Upload 8-bit float quantized model via script
Browse files
README.md
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- llmcompressor
|
5 |
+
- quantization
|
6 |
+
- wfp8
|
7 |
+
---
|
8 |
+
|
9 |
+
# Meta-Llama-3-8B-Instruct-WFP8
|
10 |
+
|
11 |
+
This model is a 8-bit quantized version of [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) "using the [llmcompressor](https://github.com/neuralmagic/llmcompressor) library.
|
12 |
+
|
13 |
+
## Quantization Details
|
14 |
+
|
15 |
+
* **Base Model:** [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)
|
16 |
+
* **Quantization Library:** `llmcompressor`
|
17 |
+
* **Quantization Method:** Weight-only 8-bit float (WFP8)
|
18 |
+
* **Quantization Recipe:**
|
19 |
+
```yaml
|
20 |
+
quant_stage:
|
21 |
+
quant_modifiers:
|
22 |
+
QuantizationModifier:
|
23 |
+
ignore: [lm_head]
|
24 |
+
config_groups:
|
25 |
+
group_0:
|
26 |
+
weights: {num_bits: 8, type: float, symmetric: true, strategy: channel, dynamic: false}
|
27 |
+
targets: [Linear]
|
28 |
+
```
|
29 |
+
|
30 |
+
## Evaluation Results
|
31 |
+
|
32 |
+
The following table shows the evaluation results on various benchmarks compared to the baseline (non-quantized) model.
|
33 |
+
|
34 |
+
| Task | Baseline Metric (10.0% Threshold) | Quantized Metric | Metric Type |
|
35 |
+
|------------------|-------------------------------------------------------|------------------|---------------------|
|
36 |
+
| winogrande | 0.7577 | 0.7616 | acc,none |
|
37 |
+
|
38 |
+
## How to Use
|
39 |
+
|
40 |
+
You can load the quantized model and tokenizer using the `transformers` library:
|
41 |
+
|
42 |
+
```python
|
43 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
44 |
+
|
45 |
+
model_id = "NoorNizar/Meta-Llama-3-8B-Instruct-WFP8"
|
46 |
+
|
47 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
48 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
49 |
+
|
50 |
+
# Example usage (replace with your specific task)
|
51 |
+
prompt = "Hello, world!"
|
52 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
53 |
+
outputs = model.generate(**inputs, max_new_tokens=50)
|
54 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
55 |
+
```
|
56 |
+
|
57 |
+
## Disclaimer
|
58 |
+
|
59 |
+
This model was quantized automatically using a script. Performance and behavior might differ slightly from the original base model.
|