-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Add support for DeepSeek V3 #11049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add support for DeepSeek V3 #11049
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0061955
convert : add support for DeepSeek V3 model
sszymczy a43d495
llama : add support for DeepSeek V3 model.
sszymczy 93aca64
convert : renamed expert_weights_func to expert_gating_func
sszymczy d2f784d
convert : correct indentation
sszymczy 140eb29
gguf-py, llama : rename expert_weights to exp_probs in tensor and var…
sszymczy 5b4673b
llama : rename expert_weights_b to exp_probs_b
sszymczy dfffe67
llama : add support for ACCENT_MARK (\\p{M}) and SYMBOL (\\p{S}) unic…
sszymczy ddb2ddd
Merge remote-tracking branch 'origin/master' into deepseek-v3
sszymczy a48c3df
llama : add DeepSeek-V3 chat template
sszymczy 4a58b99
llama : move llama_expert_gating_func_type to llama-hparams.h
sszymczy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -102,6 +102,8 @@ class LLM: | |||||
EXPERT_USED_COUNT = "{arch}.expert_used_count" | ||||||
EXPERT_SHARED_COUNT = "{arch}.expert_shared_count" | ||||||
EXPERT_WEIGHTS_SCALE = "{arch}.expert_weights_scale" | ||||||
EXPERT_WEIGHTS_NORM = "{arch}.expert_weights_norm" | ||||||
EXPERT_GATING_FUNC = "{arch}.expert_gating_func" | ||||||
POOLING_TYPE = "{arch}.pooling_type" | ||||||
LOGIT_SCALE = "{arch}.logit_scale" | ||||||
DECODER_START_TOKEN_ID = "{arch}.decoder_start_token_id" | ||||||
|
@@ -312,6 +314,7 @@ class MODEL_TENSOR(IntEnum): | |||||
FFN_GATE_SHEXP = auto() | ||||||
FFN_DOWN_SHEXP = auto() | ||||||
FFN_UP_SHEXP = auto() | ||||||
FFN_EXPERT_WEIGHTS_B = auto() | ||||||
ATTN_Q_NORM = auto() | ||||||
ATTN_K_NORM = auto() | ||||||
LAYER_OUT_NORM = auto() | ||||||
|
@@ -496,6 +499,7 @@ class MODEL_TENSOR(IntEnum): | |||||
MODEL_TENSOR.FFN_GATE_EXP: "blk.{bid}.ffn_gate_exps", | ||||||
MODEL_TENSOR.FFN_DOWN_EXP: "blk.{bid}.ffn_down_exps", | ||||||
MODEL_TENSOR.FFN_UP_EXP: "blk.{bid}.ffn_up_exps", | ||||||
MODEL_TENSOR.FFN_EXPERT_WEIGHTS_B: "blk.{bid}.expert_weights_b", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||
MODEL_TENSOR.LAYER_OUT_NORM: "blk.{bid}.layer_output_norm", | ||||||
MODEL_TENSOR.SSM_IN: "blk.{bid}.ssm_in", | ||||||
MODEL_TENSOR.SSM_CONV1D: "blk.{bid}.ssm_conv1d", | ||||||
|
@@ -1276,6 +1280,7 @@ class MODEL_TENSOR(IntEnum): | |||||
MODEL_TENSOR.FFN_GATE_SHEXP, | ||||||
MODEL_TENSOR.FFN_DOWN_SHEXP, | ||||||
MODEL_TENSOR.FFN_UP_SHEXP, | ||||||
MODEL_TENSOR.FFN_EXPERT_WEIGHTS_B, | ||||||
], | ||||||
MODEL_ARCH.CHATGLM : [ | ||||||
MODEL_TENSOR.TOKEN_EMBD, | ||||||
|
@@ -1576,6 +1581,11 @@ class GGMLQuantizationType(IntEnum): | |||||
TQ2_0 = 35 | ||||||
|
||||||
|
||||||
class ExpertGatingFuncType(IntEnum): | ||||||
SOFTMAX = 1 | ||||||
SIGMOID = 2 | ||||||
|
||||||
|
||||||
# TODO: add GGMLFileType from ggml_ftype in ggml.h | ||||||
|
||||||
|
||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more consistency in the names, lets change the
EXPERT
toEXP
. Also, it seems thatPROBS
is better name since this is a bias for the computed expert probabilities:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done