Instructions to use second-state/phi-4-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use second-state/phi-4-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="second-state/phi-4-GGUF", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("second-state/phi-4-GGUF", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("second-state/phi-4-GGUF", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use second-state/phi-4-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf second-state/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf second-state/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 serve -hf second-state/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf second-state/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 second-state/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf second-state/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 second-state/phi-4-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf second-state/phi-4-GGUF:Q4_K_M
Use Docker
docker model run hf.co/second-state/phi-4-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use second-state/phi-4-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "second-state/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": "second-state/phi-4-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/second-state/phi-4-GGUF:Q4_K_M
- SGLang
How to use second-state/phi-4-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "second-state/phi-4-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "second-state/phi-4-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "second-state/phi-4-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "second-state/phi-4-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use second-state/phi-4-GGUF with Ollama:
ollama run hf.co/second-state/phi-4-GGUF:Q4_K_M
- Unsloth Studio
How to use second-state/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 second-state/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 second-state/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 second-state/phi-4-GGUF to start chatting
- Docker Model Runner
How to use second-state/phi-4-GGUF with Docker Model Runner:
docker model run hf.co/second-state/phi-4-GGUF:Q4_K_M
- Lemonade
How to use second-state/phi-4-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull second-state/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
- Atomic Chat
Update models
Browse files- .gitattributes +13 -0
- config.json +33 -0
- phi-4-Q2_K.gguf +3 -0
- phi-4-Q3_K_L.gguf +3 -0
- phi-4-Q3_K_M.gguf +3 -0
- phi-4-Q3_K_S.gguf +3 -0
- phi-4-Q4_0.gguf +3 -0
- phi-4-Q4_K_M.gguf +3 -0
- phi-4-Q4_K_S.gguf +3 -0
- phi-4-Q5_0.gguf +3 -0
- phi-4-Q5_K_M.gguf +3 -0
- phi-4-Q5_K_S.gguf +3 -0
- phi-4-Q6_K.gguf +3 -0
- phi-4-Q8_0.gguf +3 -0
- phi-4-f16.gguf +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,16 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
phi-4-Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
phi-4-Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
phi-4-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
phi-4-Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
phi-4-Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
phi-4-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
phi-4-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
phi-4-Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
phi-4-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
phi-4-Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
phi-4-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
phi-4-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
phi-4-f16.gguf filter=lfs diff=lfs merge=lfs -text
|
config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "microsoft/phi-4",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"Phi3ForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"auto_map": {},
|
| 9 |
+
"bos_token_id": 100257,
|
| 10 |
+
"embd_pdrop": 0.0,
|
| 11 |
+
"eos_token_id": 100257,
|
| 12 |
+
"hidden_act": "silu",
|
| 13 |
+
"hidden_size": 5120,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"intermediate_size": 17920,
|
| 16 |
+
"max_position_embeddings": 16384,
|
| 17 |
+
"model_type": "phi3",
|
| 18 |
+
"num_attention_heads": 40,
|
| 19 |
+
"num_hidden_layers": 40,
|
| 20 |
+
"num_key_value_heads": 10,
|
| 21 |
+
"original_max_position_embeddings": 16384,
|
| 22 |
+
"pad_token_id": 100257,
|
| 23 |
+
"resid_pdrop": 0.0,
|
| 24 |
+
"rms_norm_eps": 1e-05,
|
| 25 |
+
"rope_scaling": null,
|
| 26 |
+
"rope_theta": 250000,
|
| 27 |
+
"sliding_window": null,
|
| 28 |
+
"tie_word_embeddings": false,
|
| 29 |
+
"torch_dtype": "bfloat16",
|
| 30 |
+
"transformers_version": "4.47.0",
|
| 31 |
+
"use_cache": true,
|
| 32 |
+
"vocab_size": 100352
|
| 33 |
+
}
|
phi-4-Q2_K.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3b2bc268b6bd2765edb0d0c1d2e50789eb4d38567ff3f06c4f5356207858786d
|
| 3 |
+
size 5547348064
|
phi-4-Q3_K_L.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f56babd99b629fd3e4a6fdfa82be89ff0d4b7522925353ded5c00dd3f592bc2a
|
| 3 |
+
size 7930155104
|
phi-4-Q3_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c997739dc76f9e53a5e1235162f19a0127fcbf25fec1fa2ce4cfc2344459f11
|
| 3 |
+
size 7363268704
|
phi-4-Q3_K_S.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:03e3f4da25219943b3ef61c1aea0d865d92200ae8d8287042da3e6c723a96c0a
|
| 3 |
+
size 6504747104
|
phi-4-Q4_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e77d0e11ff2d018df67afe192b05853ce47aad2012810dc79162fb858a5b4b7
|
| 3 |
+
size 8383418464
|
phi-4-Q4_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ab704ffa097f5902b937ca5d0c166226f1201e7492da30fa4e1c086c217afd6b
|
| 3 |
+
size 9053114464
|
phi-4-Q4_K_S.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:076a14910e1d9f02f40996b23f0347ec5a8caa503081cdd037cd268068d2d9cc
|
| 3 |
+
size 8440762464
|
phi-4-Q5_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3db2aa4eb3b0200662fbee59a223750b8d9205dc51fb611e443f5de3639872cc
|
| 3 |
+
size 10151579744
|
phi-4-Q5_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71b29a0ad348ff0c08fa84570e51443a87012921fdc2ffce0baab016b9ef415d
|
| 3 |
+
size 10604187744
|
phi-4-Q5_K_S.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d8d8e6f8668dee00ba115e5861a1dbc48125fd0a3fa304c552be69f2c924846
|
| 3 |
+
size 10151579744
|
phi-4-Q6_K.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:58c70ac0bb2d84b6d0b885eadb624a2a323f0798329cc6969fb6b4ecaab41def
|
| 3 |
+
size 12030251104
|
phi-4-Q8_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:294392031c56647d3c4ca7de0698174efd58469ceb7e171f0cd52169d0f49fdd
|
| 3 |
+
size 15580500064
|
phi-4-f16.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eefbdf36370dcac18aa8d15bace19e30be3a6e221e5448b57f7fa27ea197f2eb
|
| 3 |
+
size 29323399264
|