Instructions to use ownllm/phi-4-mlx-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ownllm/phi-4-mlx-4bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("ownllm/phi-4-mlx-4bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use ownllm/phi-4-mlx-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "ownllm/phi-4-mlx-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "ownllm/phi-4-mlx-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ownllm/phi-4-mlx-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Atomic Chat
Phi-4 (14B), MLX 4-bit, for OwnLLM
A copy of the 4-bit MLX conversion of Microsoft's Phi-4 (about 14 billion parameters), kept in the OwnLLM model collection for Apple Silicon computers running MLX.
- Original model: microsoft/phi-4, by Microsoft, MIT license (see
LICENSE). - Conversion: MLX 4-bit, by the MLX community. The weights are unchanged by OwnLLM.
- Size: about 7.7 GB. Needs an Apple Silicon Mac with 16 GB of memory or more.
- Format: MLX. The OwnLLM package for Mac, Linux and Windows uses GGUF files with llama.cpp and does not load this
format; these files are for Apple Silicon use with
mlx-lm.
pip install mlx-lm
mlx_lm.generate --model ownllm/phi-4-mlx-4bit --prompt "Explain a mortgage in two sentences."
OwnLLM is not affiliated with or endorsed by Microsoft. A language model can be confident and mistaken; do not rely on it alone for medical, legal, financial or safety decisions. Project: https://github.com/ownllm-org/ownllm
- Downloads last month
- -
Model size
15B params
Tensor type
U32
·
F16 ·
Hardware compatibility
Log In to add your hardware
4-bit
Model tree for ownllm/phi-4-mlx-4bit
Base model
microsoft/phi-4