mirror of
https://github.com/iafiscal1212/diffuse-cpp.git
synced 2026-12-04 08:38:08 +00:00
fix(dream): add QKV bias support for Qwen2.5 backbone
Dream/Qwen2.5 uses biases on Q, K, V projections. Without them, attention is fundamentally incorrect producing garbage output. Changes: - diffuse_layer: add optional bq, bk, bv bias tensor pointers - diffuse-model: load bias tensors from GGUF (nullptr if absent) - diffuse-graph: apply ggml_add after QKV projection in all 3 graph builders - convert-dream.py: include QKV bias tensors instead of skipping them Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f6aa5597a
commit
531ef58222
4 files changed
+32
-1
No files matched your search
@@ -102,6 +102,11 @@ diffuse_model * diffuse_model_load_impl(const std::string & path, int n_threads)
|
||||
l.ffn_gate = get_tensor(meta_ctx, fmt_layer("blk.%d.ffn_gate.weight", i).c_str());
|
||||
l.ffn_up = get_tensor(meta_ctx, fmt_layer("blk.%d.ffn_up.weight", i).c_str());
|
||||
l.ffn_down = get_tensor(meta_ctx, fmt_layer("blk.%d.ffn_down.weight", i).c_str());
|
||||
|
||||
// Optional QKV biases (Dream/Qwen2.5 has them, LLaDA does not)
|
||||
l.bq = ggml_get_tensor(meta_ctx, fmt_layer("blk.%d.attn_q.bias", i).c_str());
|
||||
l.bk = ggml_get_tensor(meta_ctx, fmt_layer("blk.%d.attn_k.bias", i).c_str());
|
||||
l.bv = ggml_get_tensor(meta_ctx, fmt_layer("blk.%d.attn_v.bias", i).c_str());
|
||||
}
|
||||
|
||||
DIFFUSE_LOG("model loaded: %lld tensors",
|
||||
|
||||
Reference in new issue
Block a user