Instructions to use second-state/phi-2-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use second-state/phi-2-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="second-state/phi-2-GGUF", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("second-state/phi-2-GGUF", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("second-state/phi-2-GGUF", trust_remote_code=True) - llama-cpp-python
How to use second-state/phi-2-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="second-state/phi-2-GGUF", filename="phi-2-Q2_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use second-state/phi-2-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf second-state/phi-2-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf second-state/phi-2-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 second-state/phi-2-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf second-state/phi-2-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-2-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf second-state/phi-2-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-2-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf second-state/phi-2-GGUF:Q4_K_M
Use Docker
docker model run hf.co/second-state/phi-2-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use second-state/phi-2-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-2-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "second-state/phi-2-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/second-state/phi-2-GGUF:Q4_K_M
- SGLang
How to use second-state/phi-2-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-2-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "second-state/phi-2-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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-2-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "second-state/phi-2-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use second-state/phi-2-GGUF with Ollama:
ollama run hf.co/second-state/phi-2-GGUF:Q4_K_M
- Unsloth Studio new
How to use second-state/phi-2-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-2-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-2-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-2-GGUF to start chatting
- Docker Model Runner
How to use second-state/phi-2-GGUF with Docker Model Runner:
docker model run hf.co/second-state/phi-2-GGUF:Q4_K_M
- Lemonade
How to use second-state/phi-2-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull second-state/phi-2-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.phi-2-GGUF-Q4_K_M
List all available models
lemonade list
Xin Liu commited on
Commit ·
ac76528
1
Parent(s): 7f4bb3d
Add models
Browse filesSigned-off-by: Xin Liu <sam@secondstate.io>
- phi-2-Q2_K.gguf +3 -0
- phi-2-Q3_K_L.gguf +3 -0
- phi-2-Q3_K_M.gguf +3 -0
- phi-2-Q3_K_S.gguf +3 -0
- phi-2-Q4_0.gguf +3 -0
- phi-2-Q4_K_M.gguf +3 -0
- phi-2-Q4_K_S.gguf +3 -0
- phi-2-Q5_0.gguf +3 -0
- phi-2-Q5_K_M.gguf +3 -0
- phi-2-Q5_K_S.gguf +3 -0
- phi-2-Q6_K.gguf +3 -0
- phi-2-Q8_0.gguf +3 -0
phi-2-Q2_K.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a85d9fb3be8a0bff42ad5fb3a44a609641ae7f6d7811609e48d2a06d79fe408
|
| 3 |
+
size 1109719584
|
phi-2-Q3_K_L.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:151e8824c65b489a0047d9aa8f96c46cddc5aec62555e965d50bd8fddc170306
|
| 3 |
+
size 1575229984
|
phi-2-Q3_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dadd02955c85373667d3868bcba0a90d826ae63f3e849d0c017498ec6ca28052
|
| 3 |
+
size 1432689184
|
phi-2-Q3_K_S.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:68375808a372b10cf8d169e4158143541fdc1aded185f73b205fe663a01fd99c
|
| 3 |
+
size 1250826784
|
phi-2-Q4_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bb9e1a4422c3fd5670c0005b8f826f7e2ac33d0f2c0675aa21bffbc1fa845b08
|
| 3 |
+
size 1602468384
|
phi-2-Q4_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:633978264ca3431291ad70cf7e483636c63495edd57074af668ee6953ac9d5dd
|
| 3 |
+
size 1737636384
|
phi-2-Q4_K_S.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:013e23a4dc453a276ef8cfe398174446ecd2fb3b41d3972f14bf50ae0d79bace
|
| 3 |
+
size 1631959584
|
phi-2-Q5_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af87f8e00e4664b77464309cea3159f6cca3acd3f4d4c09ee5d89c88d2d5628b
|
| 3 |
+
size 1933425184
|
phi-2-Q5_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:36d88c4161f10a94a9b3c22ac3cef7a9807cc9239b1aac42559c5d90fafe4a3e
|
| 3 |
+
size 2003057184
|
phi-2-Q5_K_S.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a287fa8f2fe088507f1dab42e95fda6c69e2acfca7b725e7d1d01fc00be0a13
|
| 3 |
+
size 1933425184
|
phi-2-Q6_K.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b65be768d640627e0b1abc51d7b6b19c41b76b75f238cceb6e9c30c5bfd47102
|
| 3 |
+
size 2285066784
|
phi-2-Q8_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a736a52f8d30526ae6d4a1a2d2fd5701e7f7a2c95dc950f8ef36cd2a5adde364
|
| 3 |
+
size 2958039584
|