MaziyarPanahi commited on
Commit
c0f0c2d
·
verified ·
1 Parent(s): 824ad41

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -0
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mistral-7B-Instruct-v0.2
3
+ inference: false
4
+ license: apache-2.0
5
+ model_creator: Mistral AI_
6
+ model_name: Mistral 7B Instruct v0.2
7
+ model_type: mistral
8
+ pipeline_tag: text-generation
9
+ prompt_template: |
10
+ <s>[INST] {prompt} [/INST]
11
+ quantized_by: TheBloke
12
+ tags:
13
+ - finetuned
14
+ - mistral
15
+ - quantized
16
+ - 4-bit
17
+ ---
18
+ # Description
19
+
20
+ This repo contains GPTQ model files for [Mistral AI_'s Mistral 7B Instruct v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2).
21
+
22
+ ## How to use
23
+ ### Install the necessary packages
24
+
25
+ ```
26
+ pip install --upgrade accelerate auto-gptq transformers
27
+ ```
28
+
29
+ ### Example Python code
30
+
31
+
32
+ ```python
33
+ from transformers import AutoTokenizer, pipeline
34
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
35
+ import torch
36
+
37
+ model_id = "MaziyarPanahi/Mistral-7B-Instruct-v0.2-GPTQ"
38
+
39
+ quantize_config = BaseQuantizeConfig(
40
+ bits=4,
41
+ group_size=128,
42
+ desc_act=False
43
+ )
44
+
45
+ model = AutoGPTQForCausalLM.from_quantized(
46
+ model_id,
47
+ use_safetensors=True,
48
+ device="cuda:0",
49
+ quantize_config=quantize_config)
50
+
51
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
52
+
53
+ pipe = pipeline(
54
+ "text-generation",
55
+ model=model,
56
+ tokenizer=tokenizer,
57
+ max_new_tokens=512,
58
+ temperature=0.7,
59
+ top_p=0.95,
60
+ repetition_penalty=1.1
61
+ )
62
+
63
+ outputs = pipe("What is a large language model?")
64
+ print(outputs[0]["generated_text"])
65
+ ```