MLX code snippet

#2
by pcuenq HF staff - opened
Files changed (1) hide show
  1. README.md +22 -0
README.md CHANGED
@@ -17,6 +17,28 @@ Phi-2 is a Transformer with **2.7 billion** parameters. It was trained using the
17
 
18
  Our model hasn't been fine-tuned through reinforcement learning from human feedback. The intention behind crafting this open-source model is to provide the research community with a non-restricted small model to explore vital safety challenges, such as reducing toxicity, understanding societal biases, enhancing controllability, and more.
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ## Intended Uses
21
 
22
  Phi-2 is intended for research purposes only. Given the nature of the training data, the Phi-2 model is best suited for prompts using the QA format, the chat format, and the code format.
 
17
 
18
  Our model hasn't been fine-tuned through reinforcement learning from human feedback. The intention behind crafting this open-source model is to provide the research community with a non-restricted small model to explore vital safety challenges, such as reducing toxicity, understanding societal biases, enhancing controllability, and more.
19
 
20
+ This repository contains the Phi-2 weights in `npz` format suitable for use with Apple's MLX framework.
21
+
22
+ ## Use with MLX
23
+
24
+ ```bash
25
+ pip install mlx
26
+ pip install transformers huggingface_hub hf_transfer
27
+ git clone https://github.com/ml-explore/mlx-examples.git
28
+
29
+ # Download model
30
+ export HF_HUB_ENABLE_HF_TRANSFER=1
31
+ huggingface-cli download --local-dir-use-symlinks False --local-dir phi-2 mlx-community/phi-2
32
+
33
+ # The phi2 example script currently requires the weights to be in the current dir
34
+ ln -s phi-2/weights.npz .
35
+
36
+ # Run example
37
+ python mlx-examples/phi2/phi2.py --prompt "My name is"
38
+ ```
39
+
40
+ The rest of the model card was copied from [the original Phi-2 repository](https://huggingface.co/microsoft/phi-2).
41
+
42
  ## Intended Uses
43
 
44
  Phi-2 is intended for research purposes only. Given the nature of the training data, the Phi-2 model is best suited for prompts using the QA format, the chat format, and the code format.