lokinfey commited on
Commit
0b895f5
·
verified ·
1 Parent(s): ef74867
Files changed (1) hide show
  1. README.md +46 -3
README.md CHANGED
@@ -1,3 +1,46 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+
5
+
6
+ # **Phi-4-mlx-int4**
7
+
8
+ This is a quantized INT4 model based on Apple MLX Framework Phi-4. You can deploy it on Apple Silicon devices (M1,M2,M3).
9
+
10
+ <b><span style="text-decoration:underline">Note: This is unoffical version,just for test and dev.</span></b>
11
+
12
+ ## **Installation**
13
+
14
+
15
+ ```bash
16
+
17
+ pip install -U mlx-lm
18
+
19
+ ```
20
+
21
+ ## **Conversion**
22
+
23
+ ```bash
24
+
25
+ python -m mlx_lm.convert --hf-path {Your Phi-4-MLX Path} -q
26
+
27
+ ```
28
+
29
+ ## **Samples**
30
+
31
+ ```python
32
+
33
+ from mlx_lm import load, generate
34
+
35
+ model, tokenizer = load("Your Phi-4-mlx Path")
36
+
37
+ prompt = tokenizer.apply_chat_template(
38
+ [{"role": "user", "content": "I have $20,000 in my savings account, where I receive a 4% profit per year and payments twice a year. Can you please tell me how long it will take for me to become a millionaire? Also, can you please explain the math step by step as if you were explaining it to an uneducated person?"}],
39
+ tokenize=False,
40
+ add_generation_prompt=True,
41
+ )
42
+
43
+ response = generate(model, tokenizer, prompt=prompt,max_tokens=1024, verbose=True)
44
+
45
+ ```
46
+