MaziyarPanahi commited on
Commit
eddca5f
·
verified ·
1 Parent(s): 442d666

Upload folder using huggingface_hub

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