Image-Text-to-Text
Transformers
Safetensors
deepseek_v41
text-generation
Eval Results
8-bit precision
fp8
Instructions to use deepseek-ai/DeepSeek-V4.1-Flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-V4.1-Flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="deepseek-ai/DeepSeek-V4.1-Flash")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-V4.1-Flash", device_map="auto") - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use deepseek-ai/DeepSeek-V4.1-Flash 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.1-Flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4.1-Flash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-V4.1-Flash
- SGLang
How to use deepseek-ai/DeepSeek-V4.1-Flash 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.1-Flash" \ --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": "deepseek-ai/DeepSeek-V4.1-Flash", "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 "deepseek-ai/DeepSeek-V4.1-Flash" \ --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": "deepseek-ai/DeepSeek-V4.1-Flash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-V4.1-Flash with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-V4.1-Flash
Update README.md
#6
by zjxia - opened
README.md
CHANGED
|
@@ -39,6 +39,24 @@ examples under `inference/examples/` encode to identical prompts and token IDs.
|
|
| 39 |
See [`inference/README.md`](inference/README.md) for dependency installation,
|
| 40 |
checkpoint conversion, and TXT/JSON inference commands.
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
## License
|
| 43 |
|
| 44 |
This repository is licensed under the [MIT License](LICENSE).
|
|
|
|
| 39 |
See [`inference/README.md`](inference/README.md) for dependency installation,
|
| 40 |
checkpoint conversion, and TXT/JSON inference commands.
|
| 41 |
|
| 42 |
+
## How to Run with SGLang
|
| 43 |
+
Enable DSpark with `--speculative-algorithm DSPARK` and do not set a separate `--speculative-draft-model-path` as the target and draft weights therefore come from the same checkpoint. See the [SGLang cookbook](https://docs.sglang.io/cookbook/autoregressive/DeepSeek/DeepSeek-V4_1) for detailed instructions, benchmarks and other hardwares configurations.
|
| 44 |
+
|
| 45 |
+
```sh
|
| 46 |
+
sglang serve \
|
| 47 |
+
--trust-remote-code \
|
| 48 |
+
--model-path deepseek-ai/DeepSeek-V4.1-Flash \
|
| 49 |
+
--tp 4 \
|
| 50 |
+
--ep-size 4 \
|
| 51 |
+
--mem-fraction-static 0.8 \
|
| 52 |
+
--speculative-algorithm DSPARK \
|
| 53 |
+
--speculative-dspark-block-size 5 \
|
| 54 |
+
--reasoning-parser auto \
|
| 55 |
+
--tool-call-parser auto \
|
| 56 |
+
--host 0.0.0.0 \
|
| 57 |
+
--port 30000
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
## License
|
| 61 |
|
| 62 |
This repository is licensed under the [MIT License](LICENSE).
|