Text Generation
Transformers
Safetensors
deepseek_v3
conversational
custom_code
Eval Results
text-generation-inference
fp8
Instructions to use deepseek-ai/DeepSeek-R1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-R1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-R1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-R1", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use deepseek-ai/DeepSeek-R1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "deepseek-ai/DeepSeek-R1" # 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-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-R1
- SGLang
How to use deepseek-ai/DeepSeek-R1 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-R1" \ --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-R1", "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-R1" \ --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-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-R1 with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-R1
Commit History
-
Add GPQA evaluation results
Verified signatureThis PR adds structured evaluation results using the new [.eval_results/ format](https://huggingface.co/docs/hub/eval-results).8659db5
-
Small fix
56d4cbb
-
Update bib info
Verified signaturea157fa3
-
Update tokenizer_config.json
8a58a13
-
Update README.md
f7361cd
-
Update README.md
5dde110
-
Update README.md
4dc77d4
-
Update tokenizer_config.json
cb48aa8 -
Update tokenizer_config.json
7bae4ba
-
Update README.md (#16)
Verified signature- Update README.md (66197628819e6921cfdb010421f39f239f51902e) Co-authored-by: Tiezhen WANG <xianbao@users.noreply.huggingface.co>3302ba7 -
Tag Model as MIT license (#12)
Verified signature- Tag Model as MIT license (3186eda3e40fb9dbe84f8b364ad4ff3ca44bde9c) Co-authored-by: Caleb Fahlgren <cfahlgren1@users.noreply.huggingface.co>17e58a0 -
Add generation_config.json
ebc477a
-
Release DeepSeek-R1
5a56bdb -
Add files using upload-large-folder tool
Verified signature952e8ef -
Add files using upload-large-folder tool
Verified signatureca135fb -
Add files using upload-large-folder tool
Verified signature1d646a4 -
Add files using upload-large-folder tool
Verified signature2aec6f9 -
Add files using upload-large-folder tool
Verified signature0c37a84 -
Add files using upload-large-folder tool
Verified signature455029a -
Add files using upload-large-folder tool
Verified signature21b6a6f -
Add files using upload-large-folder tool
Verified signatureabf9bba -
initial commit
Verified signaturee175219