Shell snippet for MLX (#2)
Browse files- Shell snippet for MLX (b31a554dd9607a5fa94d725f7d7b02510d934f49)
README.md
CHANGED
@@ -15,5 +15,22 @@ Llama 2 is a collection of pretrained and fine-tuned generative text models rang
|
|
15 |
|
16 |
Weights have been converted to `float16` from the original `bfloat16` type, because `numpy` is not compatible with `bfloat16` out of the box.
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
Please, refer to the [original model card](https://huggingface.co/meta-llama/Llama-2-7b-chat/tree/main) for details on Llama 2.
|
19 |
|
|
|
15 |
|
16 |
Weights have been converted to `float16` from the original `bfloat16` type, because `numpy` is not compatible with `bfloat16` out of the box.
|
17 |
|
18 |
+
How to use with [MLX](https://github.com/ml-explore/mlx).
|
19 |
+
|
20 |
+
```bash
|
21 |
+
|
22 |
+
# Install mlx, mlx-examples, huggingface-cli
|
23 |
+
pip install mlx
|
24 |
+
pip install huggingface_hub huggingface_transfer
|
25 |
+
git clone https://github.com/ml-explore/mlx-examples.git
|
26 |
+
|
27 |
+
# Download model
|
28 |
+
export HF_HUB_ENABLE_HF_TRANSFER=1
|
29 |
+
huggingface-cli download --local-dir models --local-dir-use-symlinks False mlx-llama/Llama-2-7b-chat-mlx Llama-2-7b-chat-mlx
|
30 |
+
|
31 |
+
# Run example
|
32 |
+
python mlx-examples/llama/llama.py Llama-2-7b-chat-mlx/Llama-2-7b-chat.npz Llama-2-7b-chat-mlx/tokenizer.model "My name is "
|
33 |
+
```
|
34 |
+
|
35 |
Please, refer to the [original model card](https://huggingface.co/meta-llama/Llama-2-7b-chat/tree/main) for details on Llama 2.
|
36 |
|