Text Generation
Transformers
Safetensors
deepseek_v3
conversational
custom_code
text-generation-inference
fp8
Instructions to use huihui-ai/DeepSeek-R1-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use huihui-ai/DeepSeek-R1-bf16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="huihui-ai/DeepSeek-R1-bf16", 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("huihui-ai/DeepSeek-R1-bf16", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("huihui-ai/DeepSeek-R1-bf16", trust_remote_code=True) 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use huihui-ai/DeepSeek-R1-bf16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "huihui-ai/DeepSeek-R1-bf16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "huihui-ai/DeepSeek-R1-bf16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/huihui-ai/DeepSeek-R1-bf16
- SGLang
How to use huihui-ai/DeepSeek-R1-bf16 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 "huihui-ai/DeepSeek-R1-bf16" \ --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": "huihui-ai/DeepSeek-R1-bf16", "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 "huihui-ai/DeepSeek-R1-bf16" \ --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": "huihui-ai/DeepSeek-R1-bf16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use huihui-ai/DeepSeek-R1-bf16 with Docker Model Runner:
docker model run hf.co/huihui-ai/DeepSeek-R1-bf16
huihui-ai/DeepSeek-R1
This model converted from DeepSeek-R1 to BF16.
Here we simply provide the conversion command and related information about ollama.
If needed, we can upload the bf16 version.
FP8 to BF16
- Download deepseek-ai/DeepSeek-R1 model, requires approximately 641GB of space.
cd /home/admin/models
huggingface-cli download deepseek-ai/DeepSeek-R1 --local-dir ./deepseek-ai/DeepSeek-R1
- Create the environment.
conda create -yn DeepSeek-V3 python=3.12
conda activate DeepSeek-V3
pip install -r requirements.txt
- Convert to BF16, requires an additional approximately 1.3 TB of space.
Here, you need to download the transformation code from the "inference" folder of deepseek-ai/DeepSeek-V3
cd deepseek-ai/DeepSeek-V3/inference
python fp8_cast_bf16.py --input-fp8-hf-path /home/admin/models/deepseek-ai/DeepSeek-R1/ --output-bf16-hf-path /home/admin/models/deepseek-ai/DeepSeek-R1-bf16
BF16 to f16.gguf
- Use the llama.cpp conversion program to convert DeepSeek-R1-bf16 to gguf format, requires an additional approximately 1.3 TB of space.
python convert_hf_to_gguf.py /home/admin/models/deepseek-ai/DeepSeek-R1-bf16 --outfile /home/admin/models/deepseek-ai/DeepSeek-R1-bf16/ggml-model-f16.gguf --outtype f16
- Use the llama.cpp quantitative program to quantitative model (llama-quantize needs to be compiled.), other quant option. Convert first Q2_K, requires an additional approximately 227 GB of space.
llama-quantize /home/admin/models/deepseek-ai/DeepSeek-R1-bf16/ggml-model-f16.gguf /home/admin/models/deepseek-ai/DeepSeek-R1-bf16/ggml-model-Q2_K.gguf Q2_K
- Use llama-cli to test.
llama-cli -m /home/admin/models/deepseek-ai/DeepSeek-R1-bf16/ggml-model-Q2_K.gguf -n 2048
Use with ollama
Note: this model requires Ollama 0.5.5
You can use huihui_ai/deepseek-r1:671b-q2_K directly
ollama run huihui_ai/deepseek-r1:671b-q2_K
or huihui_ai/deepseek-r1:671b-q3_K
ollama run huihui_ai/deepseek-r1:671b-q3_K
- Downloads last month
- 15
docker model run hf.co/huihui-ai/DeepSeek-R1-bf16