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") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # 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/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4.1-Flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4.1-Flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4.1-Flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - 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
Sync the chat template with the 16 October encoding.py, make it load in llama.cpp and transformers.js, and add a response template
Updates the chat template to follow the 16 October encoding.py (as #74 does) and to load in llama.cpp and transformers.js, and adds a response template. OpenAI-style reasoning_effort values are now accepted (medium maps to 75 rather than 62). Supersedes #74. The chat template also marks the assistant's output with {% generation %} tags, so return_assistant_tokens_mask (TRL's assistant_only_loss) trains on just that; the tags don't change the rendered text.
Thanks for adding this! One limitation of the current response parsing framework is that DSML uses string="true/false" on each parameter to distinguish strings from JSON values. The xml-inline parser cannot currently use that attribute to select how each value is decoded, and schema-based casting cannot reliably recover the distinction—for example, "2" versus 2 when both types are allowed. Could you consider adding attribute-aware value parsing, or a dedicated DSML parser, to preserve these semantics as defined in encoding.py?
Hugging Face 的标志
搜索模型、数据集、用户……
deepseek-ai
/
DeepSeek-V4.1-闪存
喜欢
4.94k
跟随
深潜
154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8
执照:
密特
模型卡
文件
xet
社区
83
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前
更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。
参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前
谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,
查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译
Hugging Face 的标志
搜索模型、数据集、用户……
deepseek-ai
/
DeepSeek-V4.1-闪存
喜欢
4.94k
跟随
深潜
154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8
执照:
密特
模型卡
文件
xet
社区
83
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前
更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。
参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前
谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,
查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译
Hugging Face 的标志
搜索模型、数据集、用户……
deepseek-ai
/
DeepSeek-V4.1-闪存喜欢
4.94k
跟随
深潜154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8执照:
密特
模型卡
文件
xet
社区
83将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。
参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,
查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译
Hugging Face 的标志
搜索模型、数据集、用户……
deepseek-ai
/
DeepSeek-V4.1-闪存喜欢
4.94k
跟随
深潜154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8执照:
密特
模型卡
文件
xet
社区
83将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。
参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,
查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译
Thanks for adding this! One limitation of the current response parsing framework is that DSML uses string="true/false" on each parameter to distinguish strings from JSON values. The xml-inline parser cannot currently use that attribute to select how each value is decoded, and schema-based casting cannot reliably recover the distinction—for example, "2" versus 2 when both types are allowed. Could you consider adding attribute-aware value parsing, or a dedicated DSML parser, to preserve these semantics as defined in encoding.py?
Thanks for adding this! One limitation of the current response parsing framework is that DSML uses string="thttps://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/discussions/79#6af286dedae82a224a459833rue/false" on each parameter to distinguish strings from JSON values. The xml-inline parser cannot currently use that attribute to select how each value is decoded, and schema-based casting cannot reliably recover the distinction—for example, "2" versus 2 when both types are allowed. Could you consider adding attribute-aware value parsing, or a dedicated DSML parser, to preserve these semantics as defined in encoding.py?





















