Instructions to use deepseek-ai/DeepSeek-V4-Pro with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-V4-Pro with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-V4-Pro") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V4-Pro") model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-V4-Pro") - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use deepseek-ai/DeepSeek-V4-Pro with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "deepseek-ai/DeepSeek-V4-Pro" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4-Pro", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-V4-Pro
- SGLang
How to use deepseek-ai/DeepSeek-V4-Pro 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 "deepseek-ai/DeepSeek-V4-Pro" \ --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": "deepseek-ai/DeepSeek-V4-Pro", "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 "deepseek-ai/DeepSeek-V4-Pro" \ --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": "deepseek-ai/DeepSeek-V4-Pro", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-V4-Pro with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-V4-Pro
Creative writing — a step back from V3.2
When it comes to creative writing (or roleplaying), this model seems to be a step back from 3.2. Here are the reasons:
1. A massive positivity bias. It doesn't like conflicts and will try to resolve them as soon as they appear. Aggressive characters get timid. Assertive ones fold as soon as someone starts pushing back. In some cases, it doesn't even expect what it has already established in reasoning: it can sometimes decide for the character to do something aggressive, then ignore it in the actual text or substitute it with a calmer reaction. This is the exact opposite of R1, where every character was aggressive and overdramatic; 3.2 got it right.
Formatting rules disobedience. As soon as you demand an HTML block somewhere in the text, DeepSeek V4 will ignore it. At best, it will ignore the HTML tags and output whatever's inside them if you prompt for it very strongly. At worst, it will not output anything inside the block at all. It might obey the desired rules for a few exchanges, but once it starts ignoring them, there is no prompt that can make it start following them again.
Hallucination rate. I thought it would improve, given the larger context. 3.2 usually started making a lot of mistakes around 28000 tokens. I thought V4 would improve, given the larger context window. Instead, it can make heavy mistakes around 12000 tokens, sometimes not being able to figure out who said what. An extremely frequent mistake I see is when a character says something and then starts behaving as if someone else had said it instead.
I agree with you. I think that all these problems were originated from its aggressive context compression in the entire hybrid attention infrastructure, mHC also worsen creative writing.
我也同意,而且该模型在我的情况下经常将我需要明确区分优劣的两者美化为在不同方面各有优势的两极,导致使用它进行一些技术调研和判断时很难信任,它总是说A技术在哪方面更好,而B技术在另一方面则更优秀,而不给出自己对两个技术的优劣判断,显得相当没有主见。