-
Notifications
You must be signed in to change notification settings - Fork 13.7k
model : add support for apple/DiffuCoder-7B-cpGRPO #14502
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6b12564
Support Diffucoder / Dream arch
gabriellarson 68a14c7
Support DiffuCoder / Dream arch
gabriellarson 2b9f3bc
Support DiffuCoder / Dream arch
gabriellarson 933bdda
Support DiffuCoder / Dream arch
gabriellarson 9f20306
Support DiffuCoder / Dream arch
gabriellarson 4e20a97
quick fix
gabriellarson 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
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 |
|---|---|---|
|
|
@@ -873,6 +873,14 @@ void llama_model::load_hparams(llama_model_loader & ml) { | |
| default: type = LLM_TYPE_UNKNOWN; | ||
| } | ||
| } break; | ||
| case LLM_ARCH_DREAM: | ||
| { | ||
| ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps); | ||
| switch (hparams.n_layer) { | ||
| case 28: type = LLM_TYPE_7B; break; | ||
| default: type = LLM_TYPE_UNKNOWN; | ||
| } | ||
| } break; | ||
| case LLM_ARCH_PHI2: | ||
| { | ||
| ml.get_key(LLM_KV_ATTENTION_LAYERNORM_EPS, hparams.f_norm_eps); | ||
|
|
@@ -2634,6 +2642,39 @@ bool llama_model::load_tensors(llama_model_loader & ml) { | |
| layer.ffn_up_exps = create_tensor(tn(LLM_TENSOR_FFN_UP_EXPS, "weight", i), { n_embd, n_ff_exp, n_expert}, 0); | ||
| } | ||
| } break; | ||
| case LLM_ARCH_DREAM: | ||
|
Collaborator
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. This looks (unsurprisingly) identical to Qwen2, I don't think it deserves the duplication. |
||
| { | ||
| tok_embd = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, 0); | ||
|
|
||
| // output | ||
| output_norm = create_tensor(tn(LLM_TENSOR_OUTPUT_NORM, "weight"), {n_embd}, 0); | ||
| output = create_tensor(tn(LLM_TENSOR_OUTPUT, "weight"), {n_embd, n_vocab}, TENSOR_NOT_REQUIRED); | ||
| // if output is NULL, init from the input tok embed | ||
| if (output == NULL) { | ||
| output = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, TENSOR_DUPLICATED); | ||
| } | ||
|
|
||
| for (int i = 0; i < n_layer; ++i) { | ||
| auto & layer = layers[i]; | ||
|
|
||
| layer.attn_norm = create_tensor(tn(LLM_TENSOR_ATTN_NORM, "weight", i), {n_embd}, 0); | ||
|
|
||
| layer.wq = create_tensor(tn(LLM_TENSOR_ATTN_Q, "weight", i), {n_embd, n_embd_head_k * n_head}, 0); | ||
| layer.wk = create_tensor(tn(LLM_TENSOR_ATTN_K, "weight", i), {n_embd, n_embd_gqa}, 0); | ||
| layer.wv = create_tensor(tn(LLM_TENSOR_ATTN_V, "weight", i), {n_embd, n_embd_gqa}, 0); | ||
| layer.wo = create_tensor(tn(LLM_TENSOR_ATTN_OUT, "weight", i), {n_embd_head_k * n_head, n_embd}, 0); | ||
|
|
||
| // Dream has bias in attention projections | ||
| layer.bq = create_tensor(tn(LLM_TENSOR_ATTN_Q, "bias", i), {n_embd_head_k * n_head}, 0); | ||
| layer.bk = create_tensor(tn(LLM_TENSOR_ATTN_K, "bias", i), {n_embd_gqa}, 0); | ||
| layer.bv = create_tensor(tn(LLM_TENSOR_ATTN_V, "bias", i), {n_embd_gqa}, 0); | ||
|
|
||
| layer.ffn_norm = create_tensor(tn(LLM_TENSOR_FFN_NORM, "weight", i), {n_embd}, 0); | ||
| layer.ffn_gate = create_tensor(tn(LLM_TENSOR_FFN_GATE, "weight", i), {n_embd, n_ff}, 0); | ||
| layer.ffn_down = create_tensor(tn(LLM_TENSOR_FFN_DOWN, "weight", i), { n_ff, n_embd}, 0); | ||
| layer.ffn_up = create_tensor(tn(LLM_TENSOR_FFN_UP, "weight", i), {n_embd, n_ff}, 0); | ||
| } | ||
| } break; | ||
| case LLM_ARCH_PHI2: | ||
| { | ||
| tok_embd = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, 0); | ||
|
|
@@ -14610,6 +14651,10 @@ llm_graph_result_ptr llama_model::build_graph( | |
| { | ||
| llm = std::make_unique<llm_build_qwen3moe>(*this, params, gf); | ||
| } break; | ||
| case LLM_ARCH_DREAM: | ||
| { | ||
| llm = std::make_unique<llm_build_qwen2>(*this, params, gf); | ||
| } break; | ||
| case LLM_ARCH_PHI2: | ||
| { | ||
| llm = std::make_unique<llm_build_phi2>(*this, params, gf); | ||
|
|
@@ -14980,6 +15025,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) { | |
| case LLM_ARCH_QWEN2MOE: | ||
| case LLM_ARCH_QWEN3: | ||
| case LLM_ARCH_QWEN3MOE: | ||
| case LLM_ARCH_DREAM: | ||
| case LLM_ARCH_OLMO2: | ||
| case LLM_ARCH_OLMOE: | ||
| case LLM_ARCH_PHI2: | ||
|
|
||
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.
Why is this needed?
SpecialVocabshould be able to handle this.