Instructions to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="bartowski/microsoft_Phi-4-mini-instruct-GGUF", filename="microsoft_Phi-4-mini-instruct-IQ2_M.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 bartowski/microsoft_Phi-4-mini-instruct-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf bartowski/microsoft_Phi-4-mini-instruct-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 bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf bartowski/microsoft_Phi-4-mini-instruct-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 bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf bartowski/microsoft_Phi-4-mini-instruct-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 bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
Use Docker
docker model run hf.co/bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bartowski/microsoft_Phi-4-mini-instruct-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": "bartowski/microsoft_Phi-4-mini-instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
- Ollama
How to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with Ollama:
ollama run hf.co/bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
- Unsloth Studio new
How to use bartowski/microsoft_Phi-4-mini-instruct-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 bartowski/microsoft_Phi-4-mini-instruct-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 bartowski/microsoft_Phi-4-mini-instruct-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for bartowski/microsoft_Phi-4-mini-instruct-GGUF to start chatting
- Pi new
How to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with Docker Model Runner:
docker model run hf.co/bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
- Lemonade
How to use bartowski/microsoft_Phi-4-mini-instruct-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull bartowski/microsoft_Phi-4-mini-instruct-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.microsoft_Phi-4-mini-instruct-GGUF-Q4_K_M
List all available models
lemonade list
error loading using llama-cpp-python
from llama_cpp import Llama
llm = Llama.from_pretrained(
repo_id="bartowski/microsoft_Phi-4-mini-instruct-GGUF",
filename="microsoft_Phi-4-mini-instruct-Q5_K_M.gguf",
)
ValueError Traceback (most recent call last)
Cell In[5], line 3
1 from llama_cpp import Llama
----> 3 llm = Llama.from_pretrained(
4 repo_id="bartowski/microsoft_Phi-4-mini-instruct-GGUF",
5 filename="microsoft_Phi-4-mini-instruct-Q5_K_M.gguf",
6 )
File ~/mounted_nfs_data/ashish/slim-openai-chroma/SlimCs_env/lib/python3.12/site-packages/llama_cpp/llama.py:2218, in Llama.from_pretrained(cls, repo_id, filename, local_dir, local_dir_use_symlinks, cache_dir, **kwargs)
2215 else:
2216 model_path = os.path.join(local_dir, filename)
-> 2218 return cls(
2219 model_path=model_path,
2220 **kwargs,
2221 )
File ~/mounted_nfs_data/ashish/slim-openai-chroma/SlimCs_env/lib/python3.12/site-packages/llama_cpp/llama.py:371, in Llama.init(self, model_path, n_gpu_layers, split_mode, main_gpu, tensor_split, rpc_servers, vocab_only, use_mmap, use_mlock, kv_overrides, seed, n_ctx, n_batch, n_threads, n_threads_batch, rope_scaling_type, pooling_type, rope_freq_base, rope_freq_scale, yarn_ext_factor, yarn_attn_factor, yarn_beta_fast, yarn_beta_slow, yarn_orig_ctx, logits_all, embedding, offload_kqv, flash_attn, last_n_tokens_size, lora_base, lora_scale, lora_path, numa, chat_format, chat_handler, draft_model, tokenizer, type_k, type_v, spm_infill, verbose, **kwargs)
366 if not os.path.exists(model_path):
367 raise ValueError(f"Model path does not exist: {model_path}")
369 self._model = self._stack.enter_context(
370 contextlib.closing(
--> 371 LlamaModel(
372 path_model=self.model_path,
373 params=self.model_params,
374 verbose=self.verbose,
375 )
376 )
377 )
379 # Override tokenizer
380 self.tokenizer = tokenizer or LlamaTokenizer(self)
File ~/mounted_nfs_data/ashish/slim-openai-chroma/SlimCs_env/lib/python3.12/site-packages/llama_cpp/_internals.py:55, in _LlamaModel.init(self, path_model, params, verbose)
50 self.model = llama_cpp.llama_load_model_from_file(
51 self.path_model.encode("utf-8"), self.params
52 )
54 if self.model is None:
---> 55 raise ValueError(f"Failed to load model from file: {path_model}")
57 def free_model():
58 if self.model is None:
ValueError: Failed to load model from file: /home/til-master-node/.cache/huggingface/hub/models--bartowski--microsoft_Phi-4-mini-instruct-GGUF/snapshots/7ff82c2aaa4dde30121698a973765f39be5288c0/./microsoft_Phi-4-mini-instruct-Q5_K_M.gguf