RefalMachine commited on
Commit
658c8fb
·
verified ·
1 Parent(s): d0fff20

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .cache/huggingface/.gitignore +1 -0
  2. .cache/huggingface/download/.gitattributes.lock +0 -0
  3. .cache/huggingface/download/.gitattributes.metadata +3 -0
  4. .cache/huggingface/download/README.md.lock +0 -0
  5. .cache/huggingface/download/README.md.metadata +3 -0
  6. .cache/huggingface/download/config.json.lock +0 -0
  7. .cache/huggingface/download/config.json.metadata +3 -0
  8. .cache/huggingface/download/configuration_deepseek.py.lock +0 -0
  9. .cache/huggingface/download/configuration_deepseek.py.metadata +3 -0
  10. .cache/huggingface/download/model.safetensors.index.json.lock +0 -0
  11. .cache/huggingface/download/model.safetensors.index.json.metadata +3 -0
  12. .cache/huggingface/download/modeling_deepseek.py.lock +0 -0
  13. .cache/huggingface/download/modeling_deepseek.py.metadata +3 -0
  14. .cache/huggingface/download/tokenizer.json.lock +0 -0
  15. .cache/huggingface/download/tokenizer.json.metadata +3 -0
  16. .cache/huggingface/download/tokenizer_config.json.lock +0 -0
  17. .cache/huggingface/download/tokenizer_config.json.metadata +3 -0
  18. README.md +216 -0
  19. config.json +58 -0
  20. configuration_deepseek.py +199 -0
  21. model-00001-of-000163.safetensors +3 -0
  22. model-00002-of-000163.safetensors +3 -0
  23. model-00003-of-000163.safetensors +3 -0
  24. model-00004-of-000163.safetensors +3 -0
  25. model-00005-of-000163.safetensors +3 -0
  26. model-00006-of-000163.safetensors +3 -0
  27. model-00007-of-000163.safetensors +3 -0
  28. model-00008-of-000163.safetensors +3 -0
  29. model-00009-of-000163.safetensors +3 -0
  30. model-00010-of-000163.safetensors +3 -0
  31. model-00011-of-000163.safetensors +3 -0
  32. model-00012-of-000163.safetensors +3 -0
  33. model-00013-of-000163.safetensors +3 -0
  34. model-00014-of-000163.safetensors +3 -0
  35. model-00015-of-000163.safetensors +3 -0
  36. model-00016-of-000163.safetensors +3 -0
  37. model-00017-of-000163.safetensors +3 -0
  38. model-00018-of-000163.safetensors +3 -0
  39. model-00019-of-000163.safetensors +3 -0
  40. model-00020-of-000163.safetensors +3 -0
  41. model-00021-of-000163.safetensors +3 -0
  42. model-00022-of-000163.safetensors +3 -0
  43. model-00023-of-000163.safetensors +3 -0
  44. model-00024-of-000163.safetensors +3 -0
  45. model-00025-of-000163.safetensors +3 -0
  46. model-00026-of-000163.safetensors +3 -0
  47. model-00027-of-000163.safetensors +3 -0
  48. model-00028-of-000163.safetensors +3 -0
  49. model-00029-of-000163.safetensors +3 -0
  50. model-00030-of-000163.safetensors +3 -0
.cache/huggingface/.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *
.cache/huggingface/download/.gitattributes.lock ADDED
File without changes
.cache/huggingface/download/.gitattributes.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ a6344aac8c09253b3b630fb776ae94478aa0275b
3
+ 1744376983.7702692
.cache/huggingface/download/README.md.lock ADDED
File without changes
.cache/huggingface/download/README.md.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ 2fe892d44dbd9a616788e690b020e6ca62e63846
3
+ 1744376983.8970878
.cache/huggingface/download/config.json.lock ADDED
File without changes
.cache/huggingface/download/config.json.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ 10125e39c48849c74602601b4dd743f38d70cab4
3
+ 1744376983.8941584
.cache/huggingface/download/configuration_deepseek.py.lock ADDED
File without changes
.cache/huggingface/download/configuration_deepseek.py.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ f549f2b17d9a20fef5c26cb7a3977fafecc9fe79
3
+ 1744376983.806615
.cache/huggingface/download/model.safetensors.index.json.lock ADDED
File without changes
.cache/huggingface/download/model.safetensors.index.json.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ 5b60276c1efb766f6a1aee2e357e27407f6ed12b
3
+ 1744376984.309682
.cache/huggingface/download/modeling_deepseek.py.lock ADDED
File without changes
.cache/huggingface/download/modeling_deepseek.py.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ 85f5d8c136c07c33f95ea8a04c6df59658dbd131
3
+ 1744376983.8944745
.cache/huggingface/download/tokenizer.json.lock ADDED
File without changes
.cache/huggingface/download/tokenizer.json.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ 51083c600ec00c7f57ae1af7fef7108c52ce7376
3
+ 1744376984.465291
.cache/huggingface/download/tokenizer_config.json.lock ADDED
File without changes
.cache/huggingface/download/tokenizer_config.json.metadata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 2e840f66bd45f87e2078d0972405e53dc26672c1
2
+ 32c3b675b1901ecf6f8bd59c5d31516da5100d36
3
+ 1744376983.7724736
README.md ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: transformers
4
+ tags:
5
+ - bf16
6
+ - bfloat16
7
+ - deepseek
8
+ - v3-0324
9
+ base_model:
10
+ - deepseek-ai/DeepSeek-V3-0324
11
+ ---
12
+
13
+ This is the BF16 model of DeekSeek V3-0324. Useful for quantization and inference on GPUs that do not support FP8 (Nvidia Ampere)
14
+
15
+ BF16 is result of dequantizing the FP8 quantized weights from DeepSeek AI: https://huggingface.co/deepseek-ai/DeepSeek-V3-0324
16
+
17
+ [GPTQModel](https://github.com/modelcloud/gptqmodel) is your go-to choice for DeepSeek V3-0324 quantization toolkit for inference on vLLM and SGLang
18
+
19
+
20
+ # DeepSeek-V3-0324
21
+ <!-- markdownlint-disable first-line-h1 -->
22
+ <!-- markdownlint-disable html -->
23
+ <!-- markdownlint-disable no-duplicate-header -->
24
+
25
+ <div align="center">
26
+ <img src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/logo.svg?raw=true" width="60%" alt="DeepSeek-V3" />
27
+ </div>
28
+ <hr>
29
+ <div align="center" style="line-height: 1;">
30
+ <a href="https://www.deepseek.com/" target="_blank" style="margin: 2px;">
31
+ <img alt="Homepage" src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/badge.svg?raw=true" style="display: inline-block; vertical-align: middle;"/>
32
+ </a>
33
+ <a href="https://chat.deepseek.com/" target="_blank" style="margin: 2px;">
34
+ <img alt="Chat" src="https://img.shields.io/badge/🤖%20Chat-DeepSeek%20V3-536af5?color=536af5&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
35
+ </a>
36
+ <a href="https://huggingface.co/deepseek-ai" target="_blank" style="margin: 2px;">
37
+ <img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DeepSeek%20AI-ffc107?color=ffc107&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
38
+ </a>
39
+ </div>
40
+
41
+ <div align="center" style="line-height: 1;">
42
+ <a href="https://discord.gg/Tc7c45Zzu5" target="_blank" style="margin: 2px;">
43
+ <img alt="Discord" src="https://img.shields.io/badge/Discord-DeepSeek%20AI-7289da?logo=discord&logoColor=white&color=7289da" style="display: inline-block; vertical-align: middle;"/>
44
+ </a>
45
+ <a href="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/qr.jpeg?raw=true" target="_blank" style="margin: 2px;">
46
+ <img alt="Wechat" src="https://img.shields.io/badge/WeChat-DeepSeek%20AI-brightgreen?logo=wechat&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
47
+ </a>
48
+ <a href="https://twitter.com/deepseek_ai" target="_blank" style="margin: 2px;">
49
+ <img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-deepseek_ai-white?logo=x&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
50
+ </a>
51
+ </div>
52
+
53
+ <div align="center" style="line-height: 1;">
54
+ <a href="LICENSE" style="margin: 2px;">
55
+ <img alt="License" src="https://img.shields.io/badge/License-MIT-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
56
+ </a>
57
+ </div>
58
+
59
+ ## Features
60
+
61
+ DeepSeek-V3-0324 demonstrates notable improvements over its predecessor, DeepSeek-V3, in several key aspects.
62
+
63
+ ![Model Performance](figures/0324_comparison.png)
64
+
65
+ ### Reasoning Capabilities
66
+
67
+ - Significant improvements in benchmark performance:
68
+ - MMLU-Pro: 75.9 → 81.2 (+5.3)
69
+ - GPQA: 59.1 → 68.4 (+9.3)
70
+ - AIME: 39.6 → 59.4 (+19.8)
71
+ - LiveCodeBench: 39.2 → 49.2 (+10.0)
72
+
73
+ ### Front-End Web Development
74
+
75
+ - Improved the executability of the code
76
+ - More aesthetically pleasing web pages and game front-ends
77
+
78
+ ### Chinese Writing Proficiency
79
+
80
+ - Enhanced style and content quality:
81
+ - Aligned with the R1 writing style
82
+ - Better quality in medium-to-long-form writing
83
+
84
+ - Feature Enhancements
85
+ - Improved multi-turn interactive rewriting
86
+ - Optimized translation quality and letter writing
87
+
88
+ ### Chinese Search Capabilities
89
+
90
+ - Enhanced report analysis requests with more detailed outputs
91
+
92
+ ### Function Calling Improvements
93
+
94
+ - Increased accuracy in Function Calling, fixing issues from previous V3 versions
95
+
96
+ ---
97
+
98
+ ## Usage Recommendations
99
+
100
+ ### System Prompt
101
+
102
+ In the official DeepSeek web/app, we use the same system prompt with a specific date.
103
+
104
+ ```
105
+ 该助手为DeepSeek Chat,由深度求索公司创造。
106
+ 今天是{current date}。
107
+ ```
108
+
109
+ For example,
110
+
111
+ ```
112
+ 该助手为DeepSeek Chat,由深度求索公司创造。
113
+ 今天是3月24日,星期一。
114
+ ```
115
+
116
+ ### Temperature
117
+
118
+ In our web and application environments, the temperature parameter $T_{model}$ is set to 0.3. Because many users use the default temperature 1.0 in API call, we have implemented an API temperature $T_{api}$ mapping mechanism that adjusts the input API temperature value of 1.0 to the most suitable model temperature setting of 0.3.
119
+
120
+ $$
121
+ T_{model} = T_{api} \times 0.3 \quad (0 \leq T_{api} \leq 1)
122
+ $$
123
+
124
+ $$
125
+ T_{model} = T_{api} - 0.7 \quad (1 < T_{api} \leq 2)
126
+ $$
127
+
128
+ Thus, if you call V3 via API, temperature 1.0 equals to the model temperature 0.3.
129
+
130
+ ### Prompts for File Uploading and Web Search
131
+
132
+ For file uploading, please follow the template to create prompts, where {file_name}, {file_content} and {question} are arguments.
133
+
134
+ ```
135
+ file_template = \
136
+ """[file name]: {file_name}
137
+ [file content begin]
138
+ {file_content}
139
+ [file content end]
140
+ {question}"""
141
+ ```
142
+
143
+ For Web Search, {search_results}, {cur_date}, and {question} are arguments.
144
+
145
+ For Chinese query, we use the prompt:
146
+
147
+ ```
148
+ search_answer_zh_template = \
149
+ '''# 以下内容是基于用户发送的消息的搜索结果:
150
+ {search_results}
151
+ 在我给你的搜索结果中,每个结果都是[webpage X begin]...[webpage X end]格式的,X代表每篇文章的数字索引。请在适当的情况下在句子末尾引用上下文。请按照引用编号[citation:X]的格式在答案中对应部分引用上下文。如果一句话源自多个上下文,请列出所有相关的引用编号,例如[citation:3][citation:5],切记不要将引用集中在最后返回引用编号,而是在答案对应部分列出。
152
+ 在回答时,请注意以下几点:
153
+ - 今天是{cur_date}。
154
+ - 并非搜索结果的所有内容都与用户的问题密切相关,你需要结合问题,对搜索结果进行甄别、筛选。
155
+ - 对于列举类的问题(如列举所有航班信息),尽量将答案控制在10个要点以内,并告诉用户可以查看搜索来源、获得完整信息。优先提供信息完整、最相关的列举项;如非必要,不要主动告诉用户搜索结果未提供的内容。
156
+ - 对于创作类的问题(如写论文),请务必在正文的段落中引用对应的参考编号,例如[citation:3][citation:5],不能只在文章末尾引用。你需要解读并概括用户的题目要求,选择合适的格式,充分利用搜索结果并抽取重要信息,生成符合用户要求、极具思想深度、富有创造力与专业性的答案。你的创作篇幅需要尽可能延长,对于每一个要点的论述要推测用户的意图,给出尽可能多角度的回答要点,且务必信息量大、论述详尽。
157
+ - 如果回答很长,请尽量结构化、分段落总结。如果需要分点作答,尽量控制在5个点以内,并合并相关的内容。
158
+ - 对于客观类的问答,如果问题的答案非常简短,可以适当补充一到两句相关信息,以丰富内容。
159
+ - 你需要根据用户要求和回答内容选择合适、美观的回答格式,确保可读性强。
160
+ - 你的回答应该综合多个相关网页来回答,不能重复引用一个网页。
161
+ - 除非用户要求,否则你回答的语言需要和用户提问的语言保持一致。
162
+
163
+ # 用户消息为:
164
+ {question}'''
165
+ ```
166
+
167
+ For English query, we use the prompt:
168
+
169
+ ```
170
+ search_answer_en_template = \
171
+ '''# The following contents are the search results related to the user's message:
172
+ {search_results}
173
+ In the search results I provide to you, each result is formatted as [webpage X begin]...[webpage X end], where X represents the numerical index of each article. Please cite the context at the end of the relevant sentence when appropriate. Use the citation format [citation:X] in the corresponding part of your answer. If a sentence is derived from multiple contexts, list all relevant citation numbers, such as [citation:3][citation:5]. Be sure not to cluster all citations at the end; instead, include them in the corresponding parts of the answer.
174
+ When responding, please keep the following points in mind:
175
+ - Today is {cur_date}.
176
+ - Not all content in the search results is closely related to the user's question. You need to evaluate and filter the search results based on the question.
177
+ - For listing-type questions (e.g., listing all flight information), try to limit the answer to 10 key points and inform the user that they can refer to the search sources for complete information. Prioritize providing the most complete and relevant items in the list. Avoid mentioning content not provided in the search results unless necessary.
178
+ - For creative tasks (e.g., writing an essay), ensure that references are cited within the body of the text, such as [citation:3][citation:5], rather than only at the end of the text. You need to interpret and summarize the user's requirements, choose an appropriate format, fully utilize the search results, extract key information, and generate an answer that is insightful, creative, and professional. Extend the length of your response as much as possible, addressing each point in detail and from multiple perspectives, ensuring the content is rich and thorough.
179
+ - If the response is lengthy, structure it well and summarize it in paragraphs. If a point-by-point format is needed, try to limit it to 5 points and merge related content.
180
+ - For objective Q&A, if the answer is very brief, you may add one or two related sentences to enrich the content.
181
+ - Choose an appropriate and visually appealing format for your response based on the user's requirements and the content of the answer, ensuring strong readability.
182
+ - Your answer should synthesize information from multiple relevant webpages and avoid repeatedly citing the same webpage.
183
+ - Unless the user requests otherwise, your response should be in the same language as the user's question.
184
+
185
+ # The user's message is:
186
+ {question}'''
187
+ ```
188
+
189
+ ## How to Run Locally
190
+
191
+ The model structure of DeepSeek-V3-0324 is exactly the same as DeepSeek-V3. Please visit [DeepSeek-V3](https://github.com/deepseek-ai/DeepSeek-V3) repo for more information about running this model locally.
192
+
193
+ **This model supports features such as function calling, JSON output, and FIM completion. For instructions on how to construct prompts to use these features, please refer to [DeepSeek-V2.5](https://huggingface.co/deepseek-ai/DeepSeek-V2.5#function-calling) repo.**
194
+
195
+ **NOTE: Hugging Face's Transformers has not been directly supported yet.**
196
+
197
+ ## License
198
+
199
+ This repository and the model weights are licensed under the [MIT License](LICENSE).
200
+
201
+ ## Citation
202
+
203
+ ```
204
+ @misc{deepseekai2024deepseekv3technicalreport,
205
+ title={DeepSeek-V3 Technical Report},
206
+ author={DeepSeek-AI},
207
+ year={2024},
208
+ eprint={2412.19437},
209
+ archivePrefix={arXiv},
210
+ primaryClass={cs.CL},
211
+ url={https://arxiv.org/abs/2412.19437},
212
+ }
213
+ ```
214
+
215
+ ## Contact
216
+ If you have any questions, please raise an issue or contact us at [[email protected]]([email protected]).
config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DeepseekV3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_deepseek.DeepseekV3Config",
9
+ "AutoModel": "modeling_deepseek.DeepseekV3Model",
10
+ "AutoModelForCausalLM": "modeling_deepseek.DeepseekV3ForCausalLM"
11
+ },
12
+ "bos_token_id": 0,
13
+ "eos_token_id": 1,
14
+ "ep_size": 1,
15
+ "first_k_dense_replace": 3,
16
+ "hidden_act": "silu",
17
+ "hidden_size": 7168,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 18432,
20
+ "kv_lora_rank": 512,
21
+ "max_position_embeddings": 163840,
22
+ "model_type": "deepseek_v3",
23
+ "moe_intermediate_size": 2048,
24
+ "moe_layer_freq": 1,
25
+ "n_group": 8,
26
+ "n_routed_experts": 256,
27
+ "n_shared_experts": 1,
28
+ "norm_topk_prob": true,
29
+ "num_attention_heads": 128,
30
+ "num_experts_per_tok": 8,
31
+ "num_hidden_layers": 61,
32
+ "num_key_value_heads": 128,
33
+ "num_nextn_predict_layers": 1,
34
+ "q_lora_rank": 1536,
35
+ "qk_nope_head_dim": 128,
36
+ "qk_rope_head_dim": 64,
37
+ "rms_norm_eps": 1e-06,
38
+ "rope_scaling": {
39
+ "beta_fast": 32.0,
40
+ "beta_slow": 1.0,
41
+ "factor": 40.0,
42
+ "mscale": 1.0,
43
+ "mscale_all_dim": 1.0,
44
+ "original_max_position_embeddings": 4096,
45
+ "type": "yarn"
46
+ },
47
+ "rope_theta": 10000,
48
+ "routed_scaling_factor": 2.5,
49
+ "scoring_func": "sigmoid",
50
+ "tie_word_embeddings": false,
51
+ "topk_group": 4,
52
+ "topk_method": "noaux_tc",
53
+ "torch_dtype": "bfloat16",
54
+ "transformers_version": "4.46.3",
55
+ "use_cache": true,
56
+ "v_head_dim": 128,
57
+ "vocab_size": 129280
58
+ }
configuration_deepseek.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers.configuration_utils import PretrainedConfig
2
+ from transformers.utils import logging
3
+
4
+ logger = logging.get_logger(__name__)
5
+
6
+ DEEPSEEK_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
7
+ class DeepseekV3Config(PretrainedConfig):
8
+ r"""
9
+ This is the configuration class to store the configuration of a [`DeepseekV3Model`]. It is used to instantiate an DeepSeek
10
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
11
+ defaults will yield a similar configuration to that of the DeepSeek-V3.
12
+
13
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
14
+ documentation from [`PretrainedConfig`] for more information.
15
+
16
+
17
+ Args:
18
+ vocab_size (`int`, *optional*, defaults to 129280):
19
+ Vocabulary size of the Deep model. Defines the number of different tokens that can be represented by the
20
+ `inputs_ids` passed when calling [`DeepseekV3Model`]
21
+ hidden_size (`int`, *optional*, defaults to 4096):
22
+ Dimension of the hidden representations.
23
+ intermediate_size (`int`, *optional*, defaults to 11008):
24
+ Dimension of the MLP representations.
25
+ moe_intermediate_size (`int`, *optional*, defaults to 1407):
26
+ Dimension of the MoE representations.
27
+ num_hidden_layers (`int`, *optional*, defaults to 32):
28
+ Number of hidden layers in the Transformer decoder.
29
+ num_nextn_predict_layers (`int`, *optional*, defaults to 1):
30
+ Number of nextn predict layers in the DeepSeekV3 Model.
31
+ num_attention_heads (`int`, *optional*, defaults to 32):
32
+ Number of attention heads for each attention layer in the Transformer decoder.
33
+ n_shared_experts (`int`, *optional*, defaults to None):
34
+ Number of shared experts, None means dense model.
35
+ n_routed_experts (`int`, *optional*, defaults to None):
36
+ Number of routed experts, None means dense model.
37
+ routed_scaling_factor (`float`, *optional*, defaults to 1.0):
38
+ Scaling factor or routed experts.
39
+ topk_method (`str`, *optional*, defaults to `gready`):
40
+ Topk method used in routed gate.
41
+ n_group (`int`, *optional*, defaults to None):
42
+ Number of groups for routed experts.
43
+ topk_group (`int`, *optional*, defaults to None):
44
+ Number of selected groups for each token(for each token, ensuring the selected experts is only within `topk_group` groups).
45
+ num_experts_per_tok (`int`, *optional*, defaults to None):
46
+ Number of selected experts, None means dense model.
47
+ moe_layer_freq (`int`, *optional*, defaults to 1):
48
+ The frequency of the MoE layer: one expert layer for every `moe_layer_freq - 1` dense layers.
49
+ first_k_dense_replace (`int`, *optional*, defaults to 0):
50
+ Number of dense layers in shallow layers(embed->dense->dense->...->dense->moe->moe...->lm_head).
51
+ \--k dense layers--/
52
+ norm_topk_prob (`bool`, *optional*, defaults to False):
53
+ Whether to normalize the weights of the routed experts.
54
+ scoring_func (`str`, *optional*, defaults to 'softmax'):
55
+ Method of computing expert weights.
56
+ aux_loss_alpha (`float`, *optional*, defaults to 0.001):
57
+ Auxiliary loss weight coefficient.
58
+ seq_aux = (`bool`, *optional*, defaults to True):
59
+ Whether to compute the auxiliary loss for each individual sample.
60
+ num_key_value_heads (`int`, *optional*):
61
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
62
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
63
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
64
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
65
+ by meanpooling all the original heads within that group. For more details checkout [this
66
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
67
+ `num_attention_heads`.
68
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
69
+ The non-linear activation function (function or string) in the decoder.
70
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
71
+ The maximum sequence length that this model might ever be used with.
72
+ initializer_range (`float`, *optional*, defaults to 0.02):
73
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
74
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
75
+ The epsilon used by the rms normalization layers.
76
+ use_cache (`bool`, *optional*, defaults to `True`):
77
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
78
+ relevant if `config.is_decoder=True`.
79
+ pad_token_id (`int`, *optional*):
80
+ Padding token id.
81
+ bos_token_id (`int`, *optional*, defaults to 1):
82
+ Beginning of stream token id.
83
+ eos_token_id (`int`, *optional*, defaults to 2):
84
+ End of stream token id.
85
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
86
+ Whether to tie weight embeddings
87
+ rope_theta (`float`, *optional*, defaults to 10000.0):
88
+ The base period of the RoPE embeddings.
89
+ rope_scaling (`Dict`, *optional*):
90
+ Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
91
+ strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
92
+ `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
93
+ `max_position_embeddings` to the expected new maximum.
94
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
95
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
96
+ attention_dropout (`float`, *optional*, defaults to 0.0):
97
+ The dropout ratio for the attention probabilities.
98
+
99
+ ```python
100
+ >>> from transformers import DeepseekV3Model, DeepseekV3Config
101
+
102
+ >>> # Initializing a Deepseek-V3 style configuration
103
+ >>> configuration = DeepseekV3Config()
104
+
105
+ >>> # Accessing the model configuration
106
+ >>> configuration = model.config
107
+ ```"""
108
+
109
+ model_type = "deepseek_v3"
110
+ keys_to_ignore_at_inference = ["past_key_values"]
111
+
112
+ def __init__(
113
+ self,
114
+ vocab_size=129280,
115
+ hidden_size=7168,
116
+ intermediate_size=18432,
117
+ moe_intermediate_size = 2048,
118
+ num_hidden_layers=61,
119
+ num_nextn_predict_layers=1,
120
+ num_attention_heads=128,
121
+ num_key_value_heads=128,
122
+ n_shared_experts = 1,
123
+ n_routed_experts = 256,
124
+ ep_size = 1,
125
+ routed_scaling_factor = 2.5,
126
+ kv_lora_rank = 512,
127
+ q_lora_rank = 1536,
128
+ qk_rope_head_dim = 64,
129
+ v_head_dim = 128,
130
+ qk_nope_head_dim = 128,
131
+ topk_method = 'noaux_tc',
132
+ n_group = 8,
133
+ topk_group = 4,
134
+ num_experts_per_tok = 8,
135
+ moe_layer_freq = 1,
136
+ first_k_dense_replace = 3,
137
+ norm_topk_prob = True,
138
+ scoring_func = 'sigmoid',
139
+ hidden_act="silu",
140
+ max_position_embeddings=4096,
141
+ initializer_range=0.02,
142
+ rms_norm_eps=1e-6,
143
+ use_cache=True,
144
+ pad_token_id=None,
145
+ bos_token_id=0,
146
+ eos_token_id=1,
147
+ tie_word_embeddings=False,
148
+ rope_theta=10000.0,
149
+ rope_scaling=None,
150
+ attention_bias=False,
151
+ attention_dropout=0.0,
152
+ **kwargs,
153
+ ):
154
+ self.vocab_size = vocab_size
155
+ self.max_position_embeddings = max_position_embeddings
156
+ self.hidden_size = hidden_size
157
+ self.intermediate_size = intermediate_size
158
+ self.moe_intermediate_size = moe_intermediate_size
159
+ self.num_hidden_layers = num_hidden_layers
160
+ self.num_nextn_predict_layers = num_nextn_predict_layers
161
+ self.num_attention_heads = num_attention_heads
162
+ self.n_shared_experts = n_shared_experts
163
+ self.n_routed_experts = n_routed_experts
164
+ self.ep_size = ep_size
165
+ self.routed_scaling_factor = routed_scaling_factor
166
+ self.kv_lora_rank = kv_lora_rank
167
+ self.q_lora_rank = q_lora_rank
168
+ self.qk_rope_head_dim = qk_rope_head_dim
169
+ self.v_head_dim = v_head_dim
170
+ self.qk_nope_head_dim = qk_nope_head_dim
171
+ self.topk_method = topk_method
172
+ self.n_group = n_group
173
+ self.topk_group = topk_group
174
+ self.num_experts_per_tok = num_experts_per_tok
175
+ self.moe_layer_freq = moe_layer_freq
176
+ self.first_k_dense_replace = first_k_dense_replace
177
+ self.norm_topk_prob = norm_topk_prob
178
+ self.scoring_func = scoring_func
179
+ # for backward compatibility
180
+ if num_key_value_heads is None:
181
+ num_key_value_heads = num_attention_heads
182
+
183
+ self.num_key_value_heads = num_key_value_heads
184
+ self.hidden_act = hidden_act
185
+ self.initializer_range = initializer_range
186
+ self.rms_norm_eps = rms_norm_eps
187
+ self.use_cache = use_cache
188
+ self.rope_theta = rope_theta
189
+ self.rope_scaling = rope_scaling
190
+ self.attention_bias = attention_bias
191
+ self.attention_dropout = attention_dropout
192
+
193
+ super().__init__(
194
+ pad_token_id=pad_token_id,
195
+ bos_token_id=bos_token_id,
196
+ eos_token_id=eos_token_id,
197
+ tie_word_embeddings=tie_word_embeddings,
198
+ **kwargs,
199
+ )
model-00001-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25691319c02475ce2d3ba1951228332b14e216293981f05bed5633bbae4e21b9
3
+ size 5236369040
model-00002-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5022b7ca21dfff9feee98914c93d8c0cb4cb9f2527bd12906fd962c2a731032
3
+ size 4305737040
model-00003-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e57dbb98272a80472fcd6d928008e01394d9d036c1ef16a7d1a0e1042242d027
3
+ size 4305737448
model-00004-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42864eaf848dcace15bb2b05570655e912d2774e909d792b437be77a9dadb3e4
3
+ size 4305761544
model-00005-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8b02f40308e3957df73c362de09bbf42757476d25a0a4fd698f773bffe02ff2
3
+ size 4305737224
model-00006-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23de0f7d02f88049869b9fda9b519d4b1535bc6ba81630a0f78e18ccff9bc1a1
3
+ size 4375574176
model-00007-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e080c24b6c93cabb796d321154185080a0dee50735525b0879c14a9c38b57b9
3
+ size 4309387600
model-00008-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d498537f2918f213995d18b1bb54585f3c1253657d74770d9b02b887e53d1230
3
+ size 4305737432
model-00009-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1050527936e724a4cc10d04eaca5e3a6bfd01bcefd1906c7d6d8fd5e0df4f906
3
+ size 4305761736
model-00010-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cffc54516eb47903c91d9757f7a28311a5a54e5dabac0a5428fc962d2fb658e
3
+ size 4305737032
model-00011-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ddf80d4b649b966dd274e92a1e3a0c46bd21e6b77b76fe7bbfdbde9f7ba3434
3
+ size 4305737448
model-00012-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9dbf3a1cb57b96df6996adb42f70081ff6062ab7c515b145595bf6fd0c208a4
3
+ size 1322608064
model-00013-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dff91b03714a58882143b3a85c42dac3d0695601cd31dfa74899b986088fabac
3
+ size 4305732480
model-00014-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10c251c860228197f6bc5d9c1051df0ec52e5ac22eb3a58312b6f33572524b23
3
+ size 4305737400
model-00015-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db3da25443593f4b27dc5ec85ebdc2fca1d0b08812b53292329d841a707b4b35
3
+ size 4305761768
model-00016-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48ef1494edd759bee020eb5c9fbc7c373f3dc7ff3106b7e2908d1cbf918a4584
3
+ size 4305737008
model-00017-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:433f3601106156031edb0cda44015b48fb4efaa336f1aa91399a6186e1f35f5c
3
+ size 4305716968
model-00018-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e89a4fd1832ad30204c4a2455a09dae742a56ec45e9ed016812b66c903e027f
3
+ size 4305782064
model-00019-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7172462875d52fb9cd9002862642ba2aa72ec6e8e332532b7f72eb90d7164e2
3
+ size 4305716712
model-00020-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abfac480f0307021ed55ae85d54594767e18c45bfd83e8985ad7c8f3a8af2619
3
+ size 4305737456
model-00021-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:507bcb4458982ece87605bbbc1c2cfd308591b24ab2391a238ff5a160c3234f7
3
+ size 4305761936
model-00022-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4612f74d7ea76d4c0c9bb3ada32d7e6a39e51f92277044027f1c69ffd878cb84
3
+ size 4305737976
model-00023-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a442be113122aa8edad2b12103bda77617e3e28bbefeff1249f96dbff912b59f
3
+ size 4305762360
model-00024-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3e4457a50c080788300c48169bc0a6871dbc682210e3e43642711b3414a9787
3
+ size 4305737584
model-00025-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62b4bc4c206d5cda3ca9b309eeb4ff7160ebf5cafdc2308a138744dcbdad254a
3
+ size 4305738040
model-00026-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:255124c33a2334376dcb81e9d6299001aa1da7761fd6bdba5222a9182856ec37
3
+ size 4305762168
model-00027-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff6532d5962bb7f47d086be77e0fbe259ef02bf6303339bf03bb5061ddda43f2
3
+ size 4305737768
model-00028-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ddfcdf96631487a446d6bd238fe05d1bd88f9330a466c7ca02e8323d68f118c
3
+ size 4305717552
model-00029-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19c5258b207e1da422c353500d174268cf2840883a07f885d52c5683c1142fcb
3
+ size 4305782464
model-00030-of-000163.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11909f672f9a1b99f933d4949ddadf2c67f01e71faa09ebb20205c46ba57e44a
3
+ size 4305717472