Instructions to use lmstudio-community/phi-4-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use lmstudio-community/phi-4-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="lmstudio-community/phi-4-GGUF", filename="phi-4-Q3_K_L.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use lmstudio-community/phi-4-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf lmstudio-community/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf lmstudio-community/phi-4-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf lmstudio-community/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf lmstudio-community/phi-4-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf lmstudio-community/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf lmstudio-community/phi-4-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf lmstudio-community/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf lmstudio-community/phi-4-GGUF:Q4_K_M
Use Docker
docker model run hf.co/lmstudio-community/phi-4-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use lmstudio-community/phi-4-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lmstudio-community/phi-4-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lmstudio-community/phi-4-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lmstudio-community/phi-4-GGUF:Q4_K_M
- Ollama
How to use lmstudio-community/phi-4-GGUF with Ollama:
ollama run hf.co/lmstudio-community/phi-4-GGUF:Q4_K_M
- Unsloth Studio
How to use lmstudio-community/phi-4-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lmstudio-community/phi-4-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lmstudio-community/phi-4-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for lmstudio-community/phi-4-GGUF to start chatting
- Docker Model Runner
How to use lmstudio-community/phi-4-GGUF with Docker Model Runner:
docker model run hf.co/lmstudio-community/phi-4-GGUF:Q4_K_M
- Lemonade
How to use lmstudio-community/phi-4-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull lmstudio-community/phi-4-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.phi-4-GGUF-Q4_K_M
List all available models
lemonade list
(Exit code: -1073740791). Unknown error. Try a different model and/or config
lmstudio-community/phi-4-GGUF/phi-4-Q4_K_M.gguf
lmstudio-community/phi-4-GGUF/phi-4-Q6_K.gguf
{
"cause": "(Exit code: -1073740791). Unknown error. Try a different model and/or config.",
"suggestion": "",
"data": {
"memory": {
"ram_capacity": "63.65 GB",
"ram_unused": "17.95 GB"
},
"gpu": {
"gpu_names": [
"NVIDIA GeForce RTX 4090 Laptop GPU"
],
"vram_recommended_capacity": "15.99 GB",
"vram_unused": "14.70 GB"
},
"os": {
"platform": "win32",
"version": "10.0.22631"
},
"app": {
"version": "0.2.31",
"downloadsDir": "D:\\LLM"
},
"model": {}
},
"title": "Error loading model."
}
hi there, can someone help me here ? i donΒ΄t know whatΒ΄s wrong here... thanks !
EDIT
NVM, its says its not compatible yet on Bartowski:
Run them in LM Studio with version 0.3.6
Ollama doesn't yet support this (as of January 8 2025)
Broken on Ollama also :
~ % ollama run hf.co/lmstudio-community/phi-4-GGUF:Q8_0
pulling manifest
pulling f44fdfa30b19... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 15 GB
pulling 1ae29500b4be... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 206 B
pulling 914cdee286e1... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 162 B
pulling 8aacca6925b2... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 191 B
verifying sha256 digest
writing manifest
success
Error: llama runner process has terminated: GGML_ASSERT(hparams.n_swa > 0) failed
Seem original is broken too...
~ % ollama run hf.co/bartowski/phi-4-GGUF:Q8_0
pulling manifest
pulling c4babb4b4d87... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 15 GB
pulling 1ae29500b4be... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 206 B
pulling 914cdee286e1... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 162 B
pulling 8aacca6925b2... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 191 B
verifying sha256 digest
writing manifest
success
Error: llama runner process has terminated: GGML_ASSERT(hparams.n_swa > 0) failed
~ %
Hey all: you need the newest engines in LM Studio for this to work. The easiest way to get them is installing LM Studio 0.3.6 from https://lmstudio.ai/download
oh shit... my lmstuido was so old, that even the "update" check didnΒ΄t show any new updates... i am not on the latest version and that model is working π€