juanpestana
commited on
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
license_link: https://huggingface.co/microsoft/phi-4/resolve/main/LICENSE
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tags:
|
8 |
+
- phi
|
9 |
+
- nlp
|
10 |
+
- math
|
11 |
+
- code
|
12 |
+
- chat
|
13 |
+
- conversational
|
14 |
+
- mlx
|
15 |
+
- mlx-my-repo
|
16 |
+
inference:
|
17 |
+
parameters:
|
18 |
+
temperature: 0
|
19 |
+
widget:
|
20 |
+
- messages:
|
21 |
+
- role: user
|
22 |
+
content: How should I explain the Internet?
|
23 |
+
library_name: transformers
|
24 |
+
base_model: microsoft/phi-4
|
25 |
+
---
|
26 |
+
|
27 |
+
# juanpestana/phi-4-Q4-mlx
|
28 |
+
|
29 |
+
The Model [juanpestana/phi-4-Q4-mlx](https://huggingface.co/juanpestana/phi-4-Q4-mlx) was converted to MLX format from [microsoft/phi-4](https://huggingface.co/microsoft/phi-4) using mlx-lm version **0.20.5**.
|
30 |
+
|
31 |
+
## Use with mlx
|
32 |
+
|
33 |
+
```bash
|
34 |
+
pip install mlx-lm
|
35 |
+
```
|
36 |
+
|
37 |
+
```python
|
38 |
+
from mlx_lm import load, generate
|
39 |
+
|
40 |
+
model, tokenizer = load("juanpestana/phi-4-Q4-mlx")
|
41 |
+
|
42 |
+
prompt="hello"
|
43 |
+
|
44 |
+
if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
|
45 |
+
messages = [{"role": "user", "content": prompt}]
|
46 |
+
prompt = tokenizer.apply_chat_template(
|
47 |
+
messages, tokenize=False, add_generation_prompt=True
|
48 |
+
)
|
49 |
+
|
50 |
+
response = generate(model, tokenizer, prompt=prompt, verbose=True)
|
51 |
+
```
|