Update README.md
Browse files
README.md
CHANGED
@@ -5,6 +5,31 @@ license: apache-2.0
|
|
5 |
## Quantization Description
|
6 |
This repo contains a GPTQ 4 bit quantized version of the Mistral-7B-Instruct-v0.3 Large Language Model.
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
## Model Description
|
9 |
The Mistral-7B-Instruct-v0.3 Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-7B-v0.3.
|
10 |
|
|
|
5 |
## Quantization Description
|
6 |
This repo contains a GPTQ 4 bit quantized version of the Mistral-7B-Instruct-v0.3 Large Language Model.
|
7 |
|
8 |
+
### Using the GPTQ model
|
9 |
+
|
10 |
+
```python
|
11 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
12 |
+
|
13 |
+
model_name_or_path = "thesven/Mistral-7B-v0.3-GPTQ"
|
14 |
+
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
16 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
17 |
+
device_map="auto",
|
18 |
+
trust_remote_code=False,
|
19 |
+
revision="main")
|
20 |
+
model.pad_token = model.config.eos_token_id
|
21 |
+
|
22 |
+
|
23 |
+
prompt_template=f'''
|
24 |
+
<s>[INST]Write a story about Ai</s>[/INST]
|
25 |
+
<s>[ASSISTANT]
|
26 |
+
'''
|
27 |
+
|
28 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
29 |
+
output = model.generate(inputs=input_ids, temperature=0.1, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
30 |
+
|
31 |
+
```
|
32 |
+
|
33 |
## Model Description
|
34 |
The Mistral-7B-Instruct-v0.3 Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-7B-v0.3.
|
35 |
|