Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
```
|
| 5 |
+
!pip install --upgrade auto-round transformers
|
| 6 |
+
|
| 7 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 8 |
+
import torch
|
| 9 |
+
from auto_round import AutoRoundConfig ## must import for auto-round format
|
| 10 |
+
|
| 11 |
+
quantized_model_path = "Siddharth63/Qwen3-8B-Base-2bits-AutoRound-GPTQ-sym"
|
| 12 |
+
quantization_config = AutoRoundConfig(backend="auto")
|
| 13 |
+
model = AutoModelForCausalLM.from_pretrained(quantized_model_path, device_map="auto",
|
| 14 |
+
torch_dtype=torch.float16,
|
| 15 |
+
quantization_config=quantization_config)
|
| 16 |
+
tokenizer = AutoTokenizer.from_pretrained(quantized_model_path)
|
| 17 |
+
text = "Atherosclerosis"
|
| 18 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 19 |
+
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50)[0]))
|
| 20 |
+
```
|