Suparious commited on
Commit
fa67a7f
1 Parent(s): 51e746a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -1
README.md CHANGED
@@ -15,7 +15,12 @@ tags:
15
  - arxiv:2304.12244
16
  - arxiv:2306.08568
17
  - arxiv:2308.09583
18
-
 
 
 
 
 
19
  ---
20
  # microsoft/WizardLM-2-7B AWQ
21
 
@@ -28,3 +33,74 @@ We introduce and opensource WizardLM-2, our next generation state-of-the-art lar
28
  which have improved performance on complex chat, multilingual, reasoning and agent.
29
  New family includes three cutting-edge models: WizardLM-2 8x22B, WizardLM-2 70B, and WizardLM-2 7B.
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  - arxiv:2304.12244
16
  - arxiv:2306.08568
17
  - arxiv:2308.09583
18
+ model_creator: microsoft
19
+ model_name: WizardLM-2-7B
20
+ base_model: microsoft/WizardLM-2-7B
21
+ inference: false
22
+ pipeline_tag: text-generation
23
+ quantized_by: Suparious
24
  ---
25
  # microsoft/WizardLM-2-7B AWQ
26
 
 
33
  which have improved performance on complex chat, multilingual, reasoning and agent.
34
  New family includes three cutting-edge models: WizardLM-2 8x22B, WizardLM-2 70B, and WizardLM-2 7B.
35
 
36
+ ## How to use
37
+
38
+ ### Install the necessary packages
39
+
40
+ ```bash
41
+ pip install --upgrade accelerate autoawq autoawq-kernels transformers
42
+ ```
43
+
44
+ ### Example Python code
45
+
46
+ ```python
47
+ from awq import AutoAWQForCausalLM
48
+ from transformers import AutoTokenizer, TextStreamer
49
+
50
+ model_path = "solidrust/WizardLM-2-7B-AWQ"
51
+ system_message = "You are WizardLM, incarnated as a powerful AI."
52
+
53
+ # Load model
54
+ model = AutoAWQForCausalLM.from_quantized(model_path,
55
+ fuse_layers=True)
56
+ tokenizer = AutoTokenizer.from_pretrained(model_path,
57
+ trust_remote_code=True)
58
+ streamer = TextStreamer(tokenizer,
59
+ skip_prompt=True,
60
+ skip_special_tokens=True)
61
+
62
+ # Convert prompt to tokens
63
+ prompt_template = """\
64
+ <|im_start|>system
65
+ {system_message}<|im_end|>
66
+ <|im_start|>user
67
+ {prompt}<|im_end|>
68
+ <|im_start|>assistant"""
69
+
70
+ prompt = "You're standing on the surface of the Earth. "\
71
+ "You walk one mile south, one mile west and one mile north. "\
72
+ "You end up exactly where you started. Where are you?"
73
+
74
+ tokens = tokenizer(prompt_template.format(system_message=system_message,prompt=prompt),
75
+ return_tensors='pt').input_ids.cuda()
76
+
77
+ # Generate output
78
+ generation_output = model.generate(tokens,
79
+ streamer=streamer,
80
+ max_new_tokens=512)
81
+
82
+ ```
83
+
84
+ ### About AWQ
85
+
86
+ AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference with equivalent or better quality compared to the most commonly used GPTQ settings.
87
+
88
+ AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
89
+
90
+ It is supported by:
91
+
92
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
93
+ - [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
94
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
95
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
96
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
97
+
98
+ ## Prompt template: ChatML
99
+
100
+ ```plaintext
101
+ <|im_start|>system
102
+ {system_message}<|im_end|>
103
+ <|im_start|>user
104
+ {prompt}<|im_end|>
105
+ <|im_start|>assistant
106
+ ```