llama.cpp/common
bitalov 4625240437
model : add K2 Horizon dense and MoVA support (#29535)
* model: K2 Horizon gguf conversion code

* model: loading hparams and tensors in k2-horizon.cpp

* model: K2 Horizon compute graph

* model: K2 Horizon compute graph adjustment and registering tokenizers

* model: K2 Horizon chat template and accomodate safetensors naming

* unicode : add the K2-Horizon pre-tokenizer splitter

The K2-Horizon regex had no arm in unicode_regex_split_custom and fell through to the
general std::regex fallback, which fails two ways.

On MSVC std::regex rejects \p{...}, so no K2-Horizon GGUF loads on Windows at all:
llama-quantize, llama-imatrix and llama-perplexity all abort with
regex_error(error_escape) before a token is produced.

Where the fallback does compile it is still wrong. unicode_regex_split collapses each
codepoint to a single byte naming its Unicode category before matching, and U+200C/U+200D
are category Control, which has no entry in k_ucat_cpt, so both become the 0xD0 fallback
byte. The literal ‌ and ‍ alternatives in K2's regex can then never match and
every ZWNJ or ZWJ ends a letter run.

The splitter is the existing llama3 one with a single rule widened, since K2's regex
differs from llama3's only in that a letter run also takes marks, ZWNJ and ZWJ.

tests/test-unicode.cpp gains a case for this: it fails before the change with
[Amy] [ZWNJ khaham] and passes after with the run intact.

* tests: expand K2 Horizon unicode splitter coverage

* unicode: handle K2 Horizon case folding and empty input

Assisted-by: Codex

* jinja : support sequence indices in selectattr and rejectattr

Assisted-by: Codex

* model : add K2 Horizon dense and MoVA support

Includes the K2 Horizon implementation from ifm-ai/llama.cpp with converter, tensor-parallel and model save/reload fixes.

Assisted-by: Codex

* chat : support K2 Horizon reasoning and tool calls

Assisted-by: Codex

* conversion: remove obsolete K2 Aurora alias

Assisted-by: Codex

* k2-horizon: enforce response schemas and load YaRN betas

Constrain final JSON after reasoning, accept flexible JSON tool envelopes,
enforce XML dialects, and handle repeated or alternate thinking markers.
Load YaRN beta metadata instead of retaining the default values.

Add schema, streaming, continuation, and model reload regressions. Validate
CUDA and CPU builds and 0.9B, 4B, and MoVA conversation/tool round trips.

Assisted-by: Codex

* renaming template fixture

* adressing cisc follows ups

* desloppify the parser / adress aldehir comments

* clean test-chat

* remove fallback : model trained mostly on high anyway

* fix k2 attn_v_exp tn splitting and metal fusion baseline

* k2-horizon : forward expand views before sums

* k2-horizon: copy embds before group norm to fix TP

* disable tesnor parallelism

---------

Co-authored-by: Ryandito Diandaru <ryandito.diandaru@mbzuai.ac.ae>
Co-authored-by: WestWaters <mario.papaleo2013@gmail.com>
Co-authored-by: Natani L. Mayday <71436458+TaskPuppyNatani@users.noreply.github.com>
Co-authored-by: West <100190545+WestWaters@users.noreply.github.com>
Co-authored-by: aaryamonvikram <aaryamonvikram@gmail.com>
Co-authored-by: aaryamonvikram <96529820+aaryamonvikram@users.noreply.github.com>
2026-10-06 18:42:24 +02:00
..
jinja model : add K2 Horizon dense and MoVA support (#29535) 2026-10-06 18:42:24 +02:00
parsers model : add K2 Horizon dense and MoVA support (#29535) 2026-10-06 18:42:24 +02:00
arg.cpp common, server : report model input/output modalities in GET /models (#29987) 2026-10-05 17:08:29 +02:00
arg.h server : improve startup log messages (#29125) 2026-09-19 15:37:13 +03:00
base64.hpp llava : expose as a shared library for downstream projects (#3613) 2023-11-07 00:36:23 +03:00
build-info.cpp.in common : make build info output stream configurable (#28322) 2026-09-04 09:13:20 +03:00
build-info.h common : make build info output stream configurable (#28322) 2026-09-04 09:13:20 +03:00
chat-auto-parser-generator.cpp common : implement common_schema internal representation for JSON schemas (#28736) 2026-09-12 16:14:50 -05:00
chat-auto-parser-helpers.cpp common: add json.h abstraction (#27511) 2026-08-22 16:28:28 +02:00
chat-auto-parser-helpers.h chat : avoid including json in chat.h (#21306) 2026-04-03 09:07:59 +03:00
chat-auto-parser.h common: add json.h abstraction (#27511) 2026-08-22 16:28:28 +02:00
chat-diff-analyzer.cpp common: add json.h abstraction (#27511) 2026-08-22 16:28:28 +02:00
chat-peg-parser.cpp chat-peg-parser : clear current_tool when pending_tool_call is reset (#29942) 2026-10-04 17:59:21 +02:00
chat-peg-parser.h common: add json.h abstraction (#27511) 2026-08-22 16:28:28 +02:00
chat.cpp model : add K2 Horizon dense and MoVA support (#29535) 2026-10-06 18:42:24 +02:00
chat.h common : implement common_schema internal representation for JSON schemas (#28736) 2026-09-12 16:14:50 -05:00
CMakeLists.txt cmake : remove precompiled headers (#28892) 2026-09-14 16:07:28 +02:00
common.cpp models: support pplx-decider (#30044) 2026-10-06 16:07:46 +02:00
common.h models: support pplx-decider (#30044) 2026-10-06 16:07:46 +02:00
console.cpp cli: exit on stdin EOF and drop the console wide Ctrl+C broadcast (#29722) 2026-09-30 16:24:46 +02:00
console.h cli : add command and file auto-completion (#19985) 2026-03-05 10:47:28 +01:00
debug.cpp common: fix missing exports in llama-common (#22340) 2026-04-27 08:06:39 +03:00
debug.h common: fix missing exports in llama-common (#22340) 2026-04-27 08:06:39 +03:00
download.cpp common : add common_is_tty() helper and fix deprecated warnings on Windows (#29860) 2026-10-03 15:48:24 +02:00
download.h server: add dedup-cache-models preset option (#27346) 2026-08-19 11:04:26 +02:00
fit.cpp Revert "Change max context length for auto-fitting with unified KV (#28849)" (#29437) 2026-09-26 07:59:15 -07:00
fit.h fit: also take into account n_streams (#27496) 2026-08-22 16:16:06 +02:00
hf-cache.cpp common : add fs_write_atomic() (#29642) 2026-09-29 13:46:53 +02:00
hf-cache.h server : improve startup log messages (#29125) 2026-09-19 15:37:13 +03:00
http.h cli : move to HTTP-based implementation (#24948) 2026-07-08 14:52:43 +02:00
imatrix-loader.cpp imatrix: calculate activation-based statistics for new format (GGUF) imatrices (#14891) 2026-10-04 11:24:53 +02:00
imatrix-loader.h imatrix: calculate activation-based statistics for new format (GGUF) imatrices (#14891) 2026-10-04 11:24:53 +02:00
json-schema-to-grammar.cpp json-schema : accept escaped hyphen in regex patterns (#29127) 2026-09-19 14:11:13 +02:00
json-schema-to-grammar.h common : implement common_schema internal representation for JSON schemas (#28736) 2026-09-12 16:14:50 -05:00
json-schema.cpp common : implement common_schema internal representation for JSON schemas (#28736) 2026-09-12 16:14:50 -05:00
json-schema.h common : implement common_schema internal representation for JSON schemas (#28736) 2026-09-12 16:14:50 -05:00
json.cpp common: json.h: fix clang lto (#27575) 2026-08-23 01:11:10 +02:00
json.h json: Fixed json enum handling (#28518) 2026-09-21 10:32:07 +02:00
llguidance.cpp llama : support multi-output backend sampling (#25532) 2026-08-10 16:58:56 +03:00
log.cpp log, server: self contained colors, split child commands from logs in router mode (#29895) 2026-10-05 01:59:37 +02:00
log.h log, server: self contained colors, split child commands from logs in router mode (#29895) 2026-10-05 01:59:37 +02:00
ngram-cache.cpp spec : add self‑speculative decoding (no draft model required) + refactor (#18471) 2026-01-28 19:42:42 +02:00
ngram-cache.h spec : add self‑speculative decoding (no draft model required) + refactor (#18471) 2026-01-28 19:42:42 +02:00
ngram-map.cpp speculative : fix out-of-bounds read in ngram-map on prompt shrink (#23936) 2026-07-07 10:25:04 +03:00
ngram-map.h fix: correct misspellings in code comments (#21217) 2026-03-31 13:50:51 +02:00
ngram-mod.cpp ngram-mod : Add missing include (#23857) 2026-05-29 09:21:37 +03:00
ngram-mod.h ngram-mod : fix build [no ci] (#19216) 2026-01-30 21:27:27 +02:00
peg-parser.cpp common/peg : handle invalid utf-8 sequences in the AST (#29161) 2026-09-20 06:51:40 -05:00
peg-parser.h common/peg : handle invalid utf-8 sequences in the AST (#29161) 2026-09-20 06:51:40 -05:00
preset.cpp common : prepare load_from_models_dir() for path conversion (#29674) 2026-10-04 11:35:33 +03:00
preset.h common : use fs::path for config dir (#29649) 2026-09-29 17:22:49 +02:00
reasoning-budget.cpp llama : support multi-output backend sampling (#25532) 2026-08-10 16:58:56 +03:00
reasoning-budget.h common : add support for multiple end sequences in the reasoning budget sampler (#25544) 2026-07-25 11:58:09 +02:00
sampling.cpp spec : add probabilistic sampling for simple draft and MTP (#27694) 2026-10-02 17:52:54 +03:00
sampling.h spec : add probabilistic sampling for simple draft and MTP (#27694) 2026-10-02 17:52:54 +03:00
speculative.cpp imatrix: calculate activation-based statistics for new format (GGUF) imatrices (#14891) 2026-10-04 11:24:53 +02:00
speculative.h imatrix: calculate activation-based statistics for new format (GGUF) imatrices (#14891) 2026-10-04 11:24:53 +02:00
subproc.cpp common: add subproc.h wrapper, disabled on android/ios (#26102) 2026-07-26 20:54:25 +02:00
subproc.h common: add subproc.h wrapper, disabled on android/ios (#26102) 2026-07-26 20:54:25 +02:00
trie.cpp common : add support for multiple end sequences in the reasoning budget sampler (#25544) 2026-07-25 11:58:09 +02:00
trie.h common : add support for multiple end sequences in the reasoning budget sampler (#25544) 2026-07-25 11:58:09 +02:00
unicode.cpp common/peg : handle invalid utf-8 sequences in the AST (#29161) 2026-09-20 06:51:40 -05:00
unicode.h common/peg : handle invalid utf-8 sequences in the AST (#29161) 2026-09-20 06:51:40 -05:00