]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
DeepSeek V4 (#24162)
authorAman Gupta <redacted>
Mon, 29 Jun 2026 08:58:51 +0000 (16:58 +0800)
committerGitHub <redacted>
Mon, 29 Jun 2026 08:58:51 +0000 (16:58 +0800)
commit8c146a8366304c871efc26057cc90370ccf58dad
tree44646f7554438d3918728b38c0ef563e3d76a5f1
parent6cb18b2f2ec72c177681051f22e7e7a4f154bb99
DeepSeek V4  (#24162)

* convert: add dsv4 conversion

* add basic setup

* add llm_graph_input_dsv4

* add save-load state

* add sinkhorn eps - correction by @fairydreaming

* add rope fix

* cleanup dead code

* fix bugs

* support pro model: added by @fairydreaming

* remove redundant V cache

* Chat template

* remove debugging leftovers

* Add mechanism for inlining templates based on architecture

* s/deepseek-v4-flash/deepseek4/g

* s/deepseek-v4-flash/deepseek4/g continued

* enable graph reuse

* enable FA

* fix test llama archs

* rename

* compatibility with antirez ds4 GGUFs

* simplified set_gguf_parameters() by calling super class method, replaced moe.score_func with expert_gating_func.

* reserve worst-case kv-cache

* revert max split inputs

* address review comments

* add padding to enable FA

* pad only the final value of plan.n_kv to 256

* remove built-in cpp chat template

* cont: remove cpp built-in template

* rm outdated test

* replace ggml_view_3d() with ggml_reshape_3d()

Co-authored-by: Georgi Gerganov <redacted>
* only support n_seq=1 for now

* remove unused var

* cont: remove unused var

* use scale bias

* use correct ptr for can_reuse

* remove gen-chat-inline-templates.py

* simplify graph reuse

* cont: cleanup

* remove unused inputs

* enable partial checkpointing

* add correct shape for kq_mask + set llama_model_n_swa to 0 for dsv4

* precompute source_idx + add comment about dummy write

* support multi-seq

* remove restored_trim_pos

* use split_equal when possible

* fix indent

* address review comments

* use LLM_KV

* fix ci

---------

Co-authored-by: Piotr Wilkin <redacted>
Co-authored-by: Stanisław Szymczyk <redacted>
Co-authored-by: Xuan Son Nguyen <redacted>
Co-authored-by: fairydreaming <redacted>
Co-authored-by: Georgi Gerganov <redacted>
25 files changed:
conversion/__init__.py
conversion/base.py
conversion/deepseek.py
gguf-py/gguf/constants.py
gguf-py/gguf/gguf_writer.py
models/templates/deepseek-ai-DeepSeek-V4.jinja [new file with mode: 0644]
src/CMakeLists.txt
src/llama-arch.cpp
src/llama-arch.h
src/llama-context.cpp
src/llama-graph.cpp
src/llama-graph.h
src/llama-hparams.h
src/llama-kv-cache-dsv4.cpp [new file with mode: 0644]
src/llama-kv-cache-dsv4.h [new file with mode: 0644]
src/llama-kv-cache-iswa.cpp
src/llama-kv-cache-iswa.h
src/llama-kv-cache.cpp
src/llama-kv-cache.h
src/llama-model-loader.cpp
src/llama-model.cpp
src/llama-model.h
src/models/deepseek4.cpp [new file with mode: 0644]
src/models/models.h
tests/test-llama-archs.cpp