Instructions to use leafspark/DeepSeek-V2-Chat-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use leafspark/DeepSeek-V2-Chat-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="leafspark/DeepSeek-V2-Chat-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("leafspark/DeepSeek-V2-Chat-GGUF", dtype="auto") - llama-cpp-python
How to use leafspark/DeepSeek-V2-Chat-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="leafspark/DeepSeek-V2-Chat-GGUF", filename="DeepSeek-V2-Chat.bf16.gguf/DeepSeek-V2-Chat.bf16.part-01-of-22.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 leafspark/DeepSeek-V2-Chat-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf leafspark/DeepSeek-V2-Chat-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 leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf leafspark/DeepSeek-V2-Chat-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 leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf leafspark/DeepSeek-V2-Chat-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 leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M
Use Docker
docker model run hf.co/leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use leafspark/DeepSeek-V2-Chat-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "leafspark/DeepSeek-V2-Chat-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": "leafspark/DeepSeek-V2-Chat-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M
- SGLang
How to use leafspark/DeepSeek-V2-Chat-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 "leafspark/DeepSeek-V2-Chat-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": "leafspark/DeepSeek-V2-Chat-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 "leafspark/DeepSeek-V2-Chat-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": "leafspark/DeepSeek-V2-Chat-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use leafspark/DeepSeek-V2-Chat-GGUF with Ollama:
ollama run hf.co/leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M
- Unsloth Studio new
How to use leafspark/DeepSeek-V2-Chat-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 leafspark/DeepSeek-V2-Chat-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 leafspark/DeepSeek-V2-Chat-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for leafspark/DeepSeek-V2-Chat-GGUF to start chatting
- Docker Model Runner
How to use leafspark/DeepSeek-V2-Chat-GGUF with Docker Model Runner:
docker model run hf.co/leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M
- Lemonade
How to use leafspark/DeepSeek-V2-Chat-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull leafspark/DeepSeek-V2-Chat-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.DeepSeek-V2-Chat-GGUF-Q4_K_M
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf leafspark/DeepSeek-V2-Chat-GGUF:# Run inference directly in the terminal:
llama-cli -hf leafspark/DeepSeek-V2-Chat-GGUF: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 leafspark/DeepSeek-V2-Chat-GGUF:# Run inference directly in the terminal:
./llama-cli -hf leafspark/DeepSeek-V2-Chat-GGUF: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 leafspark/DeepSeek-V2-Chat-GGUF:# Run inference directly in the terminal:
./build/bin/llama-cli -hf leafspark/DeepSeek-V2-Chat-GGUF:Use Docker
docker model run hf.co/leafspark/DeepSeek-V2-Chat-GGUF:DeepSeek-V2-Chat-GGUF
Quantizised from https://huggingface.co/deepseek-ai/DeepSeek-V2-Chat
Using llama.cpp b3026 for quantizisation. Given the rapid release of llama.cpp builds, this will likely change over time.
Please set the metadata KV overrides below.
Usage:
Downloading the bf16:
- Find the relevant directory
- Download all files
- Run merge.py
- Merged GGUF should appear
Downloading the quantizations:
- Find the relevant directory
- Download all files
- Point to the first split (most programs should load all the splits automatically now)
Running in llama.cpp:
To start in command line chat mode (chat completion):
main -m DeepSeek-V2-Chat.{quant}.gguf -c {context length} --color -c (-i)
To use llama.cpp's OpenAI compatible server:
server \
-m DeepSeek-V2-Chat.{quant}.gguf \
-c {context_length} \
(--color [recommended: colored output in supported terminals]) \
(-i [note: interactive mode]) \
(--mlock [note: avoid using swap]) \
(--verbose) \
(--log-disable [note: disable logging to file, may be useful for prod]) \
(--metrics [note: prometheus compatible monitoring endpoint]) \
(--api-key [string]) \
(--port [int]) \
(--flash-attn [note: must be fully offloaded to supported GPU])
Making an importance matrix:
imatrix \
-m DeepSeek-V2-Chat.{quant}.gguf \
-f groups_merged.txt \
--verbosity [0, 1, 2] \
-ngl {GPU offloading; must build with CUDA} \
--ofreq {recommended: 1}
Making a quant:
quantize \
DeepSeek-V2-Chat.bf16.gguf \
DeepSeek-V2-Chat.{quant}.gguf \
{quant} \
(--imatrix [file])
Note: Use iMatrix quants only if you can fully offload to GPU, otherwise speed will be affected negatively.
Quants:
| Quant | Status | Size | Description | KV Metadata | Weighted | Notes |
|---|---|---|---|---|---|---|
| BF16 | Available | 439 GB | Lossless :) | Old | No | Q8_0 is sufficient for most cases |
| Q8_0 | Available | 233.27 GB | High quality recommended | Updated | Yes | |
| Q8_0 | Available | ~110 GB | High quality recommended | Updated | Yes | |
| Q5_K_M | Available | 155 GB | Medium-high quality recommended | Updated | Yes | |
| Q4_K_M | Available | 132 GB | Medium quality recommended | Old | No | |
| Q3_K_M | Available | 104 GB | Medium-low quality | Updated | Yes | |
| IQ3_XS | Available | 89.6 GB | Better than Q3_K_M | Old | Yes | |
| Q2_K | Available | 80.0 GB | Low quality not recommended | Old | No | |
| IQ2_XXS | Available | 61.5 GB | Lower quality not recommended | Old | Yes | |
| IQ1_M | Uploading | 27.3 GB | Extremely low quality not recommended | Old | Yes | Testing purposes; use IQ2 at least |
Planned Quants (weighted/iMatrix):
| Planned Quant | Notes |
|---|---|
| Q5_K_S | |
| Q4_K_S | |
| Q3_K_S | |
| IQ4_XS | |
| IQ2_XS | |
| IQ2_S | |
| IQ2_M |
Metadata KV overrides (pass them using --override-kv, can be specified multiple times):
deepseek2.attention.q_lora_rank=int:1536
deepseek2.attention.kv_lora_rank=int:512
deepseek2.expert_shared_count=int:2
deepseek2.expert_feed_forward_length=int:1536
deepseek2.expert_weights_scale=float:16
deepseek2.leading_dense_block_count=int:1
deepseek2.rope.scaling.yarn_log_multiplier=float:0.0707
License:
- DeepSeek license for model weights, which can be found in the
LICENSEfile in the root of this repo - MIT license for any repo code
Performance:
~1.5t/s with Ryzen 3 3700x (96gb 3200mhz) [Q2_K]
iMatrix:
Find imatrix.dat in the root of this repo, made with a Q2_K quant containing 62 chunks (see here for info: https://github.com/ggerganov/llama.cpp/issues/5153#issuecomment-1913185693)
Using groups_merged.txt, find it here: https://github.com/ggerganov/llama.cpp/discussions/5263#discussioncomment-8395384
Censorship:
This model is a bit censored, finetuning on toxic DPO might help.
- Downloads last month
- 6,522
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit

Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf leafspark/DeepSeek-V2-Chat-GGUF:# Run inference directly in the terminal: llama-cli -hf leafspark/DeepSeek-V2-Chat-GGUF: