Text Generation
Transformers
Safetensors
deepseek_v3
conversational
custom_code
Eval Results
text-generation-inference
fp8
Instructions to use deepseek-ai/DeepSeek-V3.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-V3.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-V3.1", 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-V3.1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-V3.1", 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-V3.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "deepseek-ai/DeepSeek-V3.1" # 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-V3.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-V3.1
- SGLang
How to use deepseek-ai/DeepSeek-V3.1 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-V3.1" \ --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-V3.1", "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-V3.1" \ --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-V3.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-V3.1 with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-V3.1
Download assets/search_tool_trajectory.html from deepseek-ai/DeepSeek-V3.1: direct link, hf CLI and curl.
- Browser
- Download file 10.3 kB
-
https://huggingface.co/deepseek-ai/DeepSeek-V3.1/resolve/main/assets/search_tool_trajectory.html
- Command line
-
hf download hf://deepseek-ai/DeepSeek-V3.1/assets/search_tool_trajectory.html
-
curl -L -o search_tool_trajectory.html https://huggingface.co/deepseek-ai/DeepSeek-V3.1/resolve/main/assets/search_tool_trajectory.html
10.3 kB
| <meta charset="utf-8"> | |
| <style> | |
| body { margin:16px; font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace; white-space:pre-wrap; word-break:break-word; line-height:1.6; } | |
| .token { padding:0 2px; border-radius:4px; } | |
| .yellow { background:#FFF59D; } | |
| .blue { background:#BBDEFB; } | |
| </style> | |
| <div><span class="token yellow"><|User|></span>The current date is 2025-08-16, Saturday. Your primary task is to solve the user's questions, leveraging the appropriate tools as needed. | |
| [Core Instruction: Language Consistency] | |
| You MUST write your entire response in the same language as the user's question. | |
| If the user asks in Chinese, you must think and write in Chinese. | |
| If the user asks in French, you must think and write in French. | |
| Do not switch to English unless the user's question was in English. This applies to your reasoning, explanations, and the final answer. | |
| [Core Instruction: Citation Formatting] | |
| If the search tool was used and you are referencing a specific webpage in your final answer (the content after <|search▁end|>), you must use the format "[citation:x]", where x is the corresponding webpage number. | |
| You must first engage in step-by-step, rigorous thinking and reasoning before using the appropriate tool or providing the final answer. | |
| ## Tools | |
| You have access to the following tools: | |
| ### search | |
| Description: Search the web for information. The result will be a string. | |
| Parameters: {"type": "object", "properties": {"questions": {"type": "string", "description": "Generate up to 5 search queries based on the requirements below:\n\n- Separate different queries with \"||\". For example: \"Elon Musk lawsuit OpenAI reasons||Elon Musk lawsuit OpenAI latest updates\".\n- All search queries should use generalized, search engine-friendly, and easily retrievable keywords to improve search efficiency and the relevance of results. Avoid directly extracting phrases from the question that are difficult to retrieve effectively. For example: Avoid using relative or ambiguous terms such as “third author” or “the following year.” - Instead, use more universal expressions like “author list” or “award history.”\n- For a single search query, keep them short - remove unnecessary auxiliary words, conjunctions, and interrogative words. Primarily use keyword combinations (separated by spaces). Ideally, they should not exceed 15 characters. Avoid using special punctuation marks.\n- When seeking information from non-English primary sources, adjust search query to retrieve content in the original language (e.g., chinese), even if your initial question is in English. This improves accuracy and avoids translation-related errors.\n- You can search 1 to 5 search queries in parallel each time. If the question involves comparing multiple entities (e.g., people, places, books, movies) or contains two or more sub-questions, please split it into separate queries for each entity or sub-question.\n- Do not re-search for queries that have already been searched."}}, "required": ["questions"]} | |
| IMPORTANT: ALWAYS adhere to this exact format for tool use: | |
| <|tool▁calls▁begin|><|tool▁call▁begin|>tool_call_name<|tool▁sep|>tool_call_arguments<|tool▁call▁end|>{additional_tool_calls}<|tool▁calls▁end|> | |
| Where: | |
| - `tool_call_name` must be an exact match to one of the available tools | |
| - `tool_call_arguments` must be valid JSON that strictly follows the tool's Parameters Schema | |
| - For multiple tool calls, chain them directly without separators or spaces | |
| # The user's message is: 有一个全球旗舰店被称为“博物馆”的品牌,在2025年5月初与一家中国度假酒店集团进行的品牌联名,这次联名的宣传片的艺术指导是谁?<span class="token yellow"><|Assistant|></span><span class="token yellow"></think></span><span class="token blue"><|search▁begin|></span> | |
| 我们将逐步解决这个问题。首先,我们需要找到符合以下条件的品牌: | |
| 1. 全球旗舰店被称为“博物馆”的品牌。 | |
| 2. 在2025年5月初与一家中国度假酒店集团进行品牌联名。 | |
| 3. 联名宣传片的艺术指导是谁? | |
| ### 第一步:全球旗舰店被称为“博物馆”的品牌 | |
| 首先,我们需要找到全球旗舰店被称为“博物馆”的品牌。可能的候选包括: | |
| [……] | |
| ### 搜索符合条件的品牌 | |
| 我将先搜索符合条件的品牌。<span class="token blue"><|tool▁calls▁begin|></span><span class="token blue"><|tool▁call▁begin|></span>search<span class="token blue"><|tool▁sep|></span>{"questions":"全球旗舰店被称为博物馆的品牌||全球旗舰店博物馆||Aesop全球旗舰店博物馆||Aesop旗舰店博物馆||Nike全球旗舰店博物馆"}<span class="token blue"><|tool▁call▁end|></span><span class="token blue"><|tool▁calls▁end|></span><span class="token blue"><|end▁of▁sentence|></span><span class="token yellow"><|tool▁output▁begin|></span>[webpage 0 begin] | |
| [webpage title]始祖鸟在它的“博物馆”里如何讲户外故事? | |
| [webpage url]https://wap.eastmoney.com/a/202405213082252819.html | |
| [webpage date published] | |
| [webpage snippet begin] | |
| 2024年5月21日 — 如何低门槛投资美股? 5月18日,位于上海南京西路的始祖鸟全球旗舰店正式开业,而这家店的另一个名称是“始祖鸟博物馆”。一楼和二楼则是多种产品线的零售 ... | |
| [webpage snippet end] | |
| [webpage content begin] | |
| [……] | |
| [webpage content end] | |
| [webpage 0 end] | |
| [……] | |
| <span class="token yellow"><|tool▁output▁end|></span>根据搜索结果,符合条件的品牌是始祖鸟(Arc'teryx)。其全球旗舰店被称为“始祖鸟博物馆”,位于上海南京西路。 | |
| ### 第二步:品牌联名 | |
| 根据问题描述,始祖鸟在2025年5月初与一家中国度假酒店集团进行品牌联名。我们需要找到这次联名的宣传片艺术指导。 | |
| #### 关键点: | |
| 1. **时间**:2025年5月初(由于当前时间是2025年8月16日,而联名发生在2025年5月初,因此可能需要搜索相关新闻或公告)。 | |
| 2. **联名对象**:一家中国度假酒店集团。 | |
| 3. **联名内容**:品牌联名,宣传片的艺术指导。 | |
| ### 第三步:始祖鸟的联名活动 | |
| 我需要先找到始祖鸟在2025年5月初与中国度假酒店集团的联名活动。可能的度假酒店集团包括: | |
| 1. **松赞酒店**:始祖鸟曾与松赞酒店合作过(根据之前的文章提到)。 | |
| 2. **安缦酒店**:高端度假酒店。 | |
| 3. **悦榕庄**:度假酒店集团。 | |
| 4. **Club Med**:度假村集团。 | |
| 5. **华住集团**:旗下有度假酒店品牌,但可能不符合“度假酒店集团”的描述。 | |
| 6. **开元酒店集团**:度假酒店品牌。 | |
| 7. **柏联酒店**:高端度假酒店。 | |
| 根据之前的文章提到,始祖鸟曾与松赞酒店合作过联名服饰。因此,松赞酒店可能是联名对象之一。 | |
| ### 第四步:搜索联名活动 | |
| 我需要搜索始祖鸟在2025年5月初与中国度假酒店集团的联名活动。我将先尝试搜索相关新闻。<span class="token blue"><|tool▁calls▁begin|></span><span class="token blue"><|tool▁call▁begin|></span>search<span class="token blue"><|tool▁sep|></span>{"questions":"始祖鸟2025年5月联名||始祖鸟2025年5月酒店联名||始祖鸟度假酒店联名||始祖鸟宣传片艺术指导||始祖鸟松赞联名2025"}<span class="token blue"><|tool▁call▁end|></span><span class="token blue"><|tool▁calls▁end|></span><span class="token blue"><|end▁of▁sentence|></span><span class="token yellow"><|tool▁output▁begin|></span>[webpage 19 begin] | |
| [webpage title]始祖鸟× 松赞相约纳木错 | |
| [webpage url]https://socialbeta.com/campaign/24810 | |
| [webpage date published] | |
| [webpage snippet begin] | |
| 始祖鸟与中国高端旅行品牌松赞再次携手,推出以「圣湖」纳木措为灵感的全新联名系列。这已是双方继以两座神山——卡瓦格博与南迦巴瓦为灵感之后的第三次 ... | |
| [webpage snippet end] | |
| [webpage content begin] | |
| [……] | |
| [webpage content end] | |
| [webpage 19 end] | |
| [……] | |
| <span class="token yellow"><|tool▁output▁end|></span>根据搜索结果,始祖鸟在2025年5月初与松赞酒店集团进行了联名合作。这次联名以纳木措湖为灵感,推出了联名系列产品,并拍摄了概念影片《见水知蓝·纳木措》。 | |
| ### 第五步:宣传片的艺术指导 | |
| 根据搜索结果,宣传片《见水知蓝·纳木措》的艺术指导是国际摄影大师杜可风(Christopher Doyle)。 | |
| ### 最终答案 | |
| 根据搜索结果,始祖鸟与松赞酒店集团的联名宣传片《见水知蓝·纳木措》的艺术指导是杜可风(Christopher Doyle)。 | |
| <span class="token blue"><|search▁end|></span> | |
| 根据搜索结果,始祖鸟(Arc'teryx)在2025年5月初与中国度假酒店集团松赞(Songtsam)进行了品牌联名,推出了以纳木措湖为灵感的联名系列[citation:19][citation:21]。此次联名的宣传片《见水知蓝·纳木措》的艺术指导是国际摄影大师**杜可风**(Christopher Doyle)[citation:21]。 | |
| ### 联名背景: | |
| - **合作对象**:始祖鸟 × 松赞(第三次合作,聚焦纳木措湖)[citation:19][citation:21] | |
| - **宣传片**:《见水知蓝·纳木措》,以纳木措湖的“开湖”时刻为灵感,采用16:9宽幅画面和沉浸式叙事手法,展现高原自然与人文的共生哲学[citation:21]。 | |
| - **艺术指导**:杜可风(Christopher Doyle)担任艺术指导,将其标志性的蓝调美学融入影片,强调自然光影和真实记录[citation:21]。 | |
| 如需进一步了解联名详情或宣传片内容,可以查阅或[citation:19][citation:21]。</div> | |