Moses25 commited on
Commit
fcbb03b
1 Parent(s): 0512711

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +42 -3
README.md CHANGED
@@ -1,3 +1,42 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+ ```python
5
+ from awq import AutoAWQForCausalLM
6
+ from transformers import AutoTokenizer, TextStreamer
7
+
8
+
9
+ quant_path = "Moses25/Mistral-7B-Instruct-32K-AWQ"
10
+
11
+ # Load model
12
+ model = AutoAWQForCausalLM.from_quantized(quant_path, fuse_layers=True)
13
+ tokenizer = AutoTokenizer.from_pretrained(quant_path, trust_remote_code=True)
14
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
15
+
16
+ prompt = "You're standing on the surface of the Earth. "\
17
+ "You walk one mile south, one mile west and one mile north. "\
18
+ "You end up exactly where you started. Where are you?"
19
+
20
+ chat = [
21
+ {"role": "system", "content": "You are a concise assistant that helps answer questions."},
22
+ {"role": "user", "content": prompt},
23
+ ]
24
+
25
+ terminators = [
26
+ tokenizer.eos_token_id,
27
+ tokenizer.convert_tokens_to_ids("</s>")
28
+ ]
29
+
30
+ tokens = tokenizer.apply_chat_template(
31
+ chat,
32
+ return_tensors="pt"
33
+ ).cuda()
34
+
35
+ # Generate output
36
+ generation_output = model.generate(
37
+ tokens,
38
+ streamer=streamer,
39
+ max_new_tokens=2048,
40
+ eos_token_id=terminators
41
+ )
42
+ ```