madroid commited on
Commit
59c9882
1 Parent(s): e7fbe37

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -1
README.md CHANGED
@@ -23,5 +23,20 @@ pip install mlx-lm
23
  from mlx_lm import load, generate
24
 
25
  model, tokenizer = load("mlx-community/Qwen1.5-1.8B-Chat-4bit")
26
- response = generate(model, tokenizer, prompt="hello", verbose=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ```
 
23
  from mlx_lm import load, generate
24
 
25
  model, tokenizer = load("mlx-community/Qwen1.5-1.8B-Chat-4bit")
26
+
27
+ prompt = "hello"
28
+
29
+ messages = [
30
+ {"role": "system", "content": "You are a helpful assistant."},
31
+ {"role": "user", "content": prompt}
32
+ ]
33
+
34
+ text = tokenizer.apply_chat_template(
35
+ messages,
36
+ tokenize=False,
37
+ add_generation_prompt=True
38
+ )
39
+
40
+ response = generate(model, tokenizer, prompt=text, verbose=True, max_tokens=200)
41
+
42
  ```