SidharthanRajendran
commited on
Commit
•
da2dc5d
1
Parent(s):
21c2b73
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
tags:
|
7 |
+
- AutoGPTQ
|
8 |
+
- 4bit
|
9 |
+
- GPTQ
|
10 |
+
---
|
11 |
+
|
12 |
+
Model created using [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) on a [GPT-2](https://huggingface.co/gpt2) model with 4-bit quantization.
|
13 |
+
|
14 |
+
You can load this model with the AutoGPTQ library, installed with the following command:
|
15 |
+
|
16 |
+
```
|
17 |
+
pip install auto-gptq
|
18 |
+
```
|
19 |
+
|
20 |
+
You can then download the model from the hub using the following code:
|
21 |
+
|
22 |
+
```python
|
23 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
24 |
+
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
25 |
+
|
26 |
+
model_name = "Sanrove/gpt2-GPTQ-4b"
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
28 |
+
quantize_config = BaseQuantizeConfig.from_pretrained(model_name)
|
29 |
+
model = AutoGPTQForCausalLM.from_quantized(model_name,
|
30 |
+
model_basename="gptq_model-4bit-128g",
|
31 |
+
device="cuda:0",
|
32 |
+
use_triton=True,
|
33 |
+
use_safetensors=True,
|
34 |
+
quantize_config=quantize_config)
|
35 |
+
```
|
36 |
+
|
37 |
+
This model works with the traditional [Text Generation pipeline](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.TextGenerationPipeline).
|
38 |
+
|
39 |
+
Example of generation with the input text "I have a dream":
|
40 |
+
|
41 |
+
```
|
42 |
+
I have a dream." – William Shakespeare
|
43 |
+
|
44 |
+
With this opening line, one can see how Shakespeare was very influenced by the story of the great poet. The great poet was the first true English poet, as well as the son of a English noble
|
45 |
+
```
|