daedalus314
commited on
Commit
•
c2f36b7
1
Parent(s):
91f9d25
Update README.md
Browse filesThe body of the README now provides an overview and a sample usage of the model.
README.md
CHANGED
@@ -8,4 +8,48 @@ library_name: transformers
|
|
8 |
tags:
|
9 |
- NLP
|
10 |
- GPTQ
|
11 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
tags:
|
9 |
- NLP
|
10 |
- GPTQ
|
11 |
+
---
|
12 |
+
|
13 |
+
# Overview
|
14 |
+
This model is a quantized version of [Griffin-3B](https://huggingface.co/acrastt/Griffin-3B), using [GPTQ](https://arxiv.org/abs/2210.17323). The quantization has been done following the sample [notebook](https://colab.research.google.com/drive/1_TIrmuKOFhuRRiTWN94iLKUFu6ZX4ceb) provided by Hugging Face.
|
15 |
+
|
16 |
+
# Usage
|
17 |
+
The model has been quantized as part of the project [GPTStonks](https://github.com/GPTStonks). It works with `transformers>=4.33.0` and it can run on a consumer GPU, with less than 3GB of GPU RAM. The libraries `optimum`, `auto-gptq`, `peft` and `accelerate` should also be installed.
|
18 |
+
|
19 |
+
Here is a sample code to load the model and run inference with it using sampling as decoding strategy:
|
20 |
+
```python
|
21 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
22 |
+
import torch
|
23 |
+
|
24 |
+
model_id = "daedalus314/Griffin-3B-GPTQ"
|
25 |
+
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
27 |
+
quant_model = AutoModelForCausalLM.from_pretrained(model_id, device_map='auto')
|
28 |
+
|
29 |
+
text = """### HUMAN:
|
30 |
+
What is artifical intelligence?
|
31 |
+
|
32 |
+
### RESPONSE:
|
33 |
+
"""
|
34 |
+
inputs = tokenizer(text, return_tensors="pt").to(0)
|
35 |
+
|
36 |
+
out = quant_model.generate(
|
37 |
+
**inputs,
|
38 |
+
do_sample=True,
|
39 |
+
top_p=0.9,
|
40 |
+
temperature=0.9,
|
41 |
+
max_length=1024,
|
42 |
+
)
|
43 |
+
print(tokenizer.decode(out[0], skip_special_tokens=True))
|
44 |
+
```
|
45 |
+
And a sample output:
|
46 |
+
```
|
47 |
+
### HUMAN:
|
48 |
+
What is artifical intelligence?
|
49 |
+
|
50 |
+
### RESPONSE:
|
51 |
+
Artificial intelligence, or AI, refers to the ability of computers to perform tasks that typically require human intelligence, such as decision making, problem solving, and language understanding. AI has been used in various fields, including healthcare, manufacturing, and finance, among others.
|
52 |
+
```
|
53 |
+
|
54 |
+
# Further details
|
55 |
+
Please refer to the original model [Griffin-3B](https://huggingface.co/acrastt/Griffin-3B).
|