koboldcpp/conversion
Daniel Bevenius 7e1e28cae3
mtmd : add Nemotron 3 Nano Omni support (parakeet) (#22520)
* mtmd : add Nemotron 3 Nano Omni support (parakeet)

This commit adds support for the subsampling and encoder part of
Nemotron Nemo 3 omni model.

The Parakeet subsampling/encoder were taken from parakeet.cpp which
is currently a pull request against whisper.cpp. I've tried to copy the
code a close as possible to hopefully enable easy patching between the
these two project later.

Refs: https://github.com/ggml-org/whisper.cpp/pull/3735

* mtmd : generate rel pos tensor in graph instead of in conversion [no ci]

This commit removes the generation of the relative positional tensor in
the model conversion script and instead computes it in the encoder
graph. This is only done for the window of positions required for the
current audio sample.

* mtmd : add clip_get_model to clip API [no ci]

This commit adds a function to get access to the clip_model. It also
removes the two functions clip_get_mel_filter_tensor, and
clip_get_window_tensor(const struct clip_ctx * ctx) which can now use
clip_get_model to access the model tensors that it needs.

* mtmd : read mel_filters and window into hparams

* mtmd : use set_input_f32 lambda [no ci]

* mtmd : add better asserts for mel_filters and hann window [no ci]

* mtmd : add missing size_t cast

* mtmd : change type of pad to size_t

* mtmd : zero initialize samples_padded

* mtmd : remove unsued ctx member from parakeet preprocessor

* mtmd : make log_mel_spectrogram_parakeet_worker_thread private static

* mtmd : sync/update parakeeet impl with latest whisper.cpp

This commit updates the parakeet code in mtmd to reflect the latest
updates to parakeet.cpp in whisper.cpp.

A follow up commit will address the currently hardcoded dw_pad and see
if we can add n_conv_kernel as a model metadata field.

* mtmd : add audio_conv_kernel_size to model conversion

This commit updates the model conversion to read the conv_kernel_size
field from the sound_config section of the models config.json file.
It then uses this field instead of the hardcoded values in parakeet.cpp.

* mtmd : cleanup [no ci]

* conversion : call super().filter_tensors [no ci]

* do not discard result of super filter_tensors

* mtmd : use build_mm instead of ggml_mul_mat

* mtmd : use build_ffn

* mtmd : move and reuse get_vector lambda

* mtmd : use build_inp_raw for parakeet

* mtmd : throw exception in get_scalar instead of assert

* mtmd : fix std::min call

* mtmt : use .c_str in throw clause in get_vector

* mtmd : check for F32 type and non-empty tensor in get_vector

The get_vector lambda is used by get_scalar but also standalone to read
in the mel_filters and the window data. Therefor we are not checking
for 1D tensors but allowing multiple dimensions. We do have a check in
get_scalar to verify the size of the vector.

* mtmd : replace hardcoded 1101 for n_tokens_real

* mtmd : assert subsampling_factor is 8

This commit adds an assert of the parakeet subsampling factor to check
that it is 8.

The motivation for this is that this model currently has three
convolutions with a stride of 2. If the underlying model updates the
subsampling factor these convolution operations will need to be updated
and this will produce and error if this occurs.

* mtmd : remove unused ggml_tensors attn_pos_w and mm_norm_w

* mtmd : remove single thread path

This commit removes the single thread path which was a left over from
the original parakeet.cpp where n_threads is configurable.

* fix some security issues

---------

Co-authored-by: Sigbjørn Skjæret <1629204+CISC@users.noreply.github.com>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
2026-07-28 17:20:25 +02:00
..
__init__.py spec: add DSpark speculative decoding (#25173) 2026-07-28 14:43:27 +03:00
afmoe.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
arctic.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
baichuan.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
bailingmoe.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
base.py model: Add MiniMax-M3 (MSA: MiniMax Sparse Attention) support (#24908) 2026-07-26 19:43:45 +02:00
bert.py conversion: fix non-MoE NomicBert GGUF conversion error (#25996) 2026-07-23 11:01:35 +08:00
bitnet.py conversion: accept BitNetForCausalLM architecture name (#25769) 2026-07-16 16:24:47 +03:00
bloom.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
chameleon.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
chatglm.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
codeshell.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
cogvlm.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
command_r.py Add arch support for cohere2-MoE (#24260) 2026-06-13 19:49:00 +02:00
dbrx.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
deci.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
deepseek.py DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
dots1.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
dotsocr.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
dream.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
ernie.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
exaone.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
falcon.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
falcon_h1.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
gemma.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
glm.py model: add GLM 5.2 Indexer support (#25407) 2026-07-24 20:55:56 +02:00
gpt2.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
gpt_oss.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
gptneox.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
granite.py model: Granite Speech Plus (#24818) 2026-06-23 12:03:31 +02:00
grok.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
grovemoe.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
hunyuan.py convert: fix handle HunyuanVL XD-RoPE config (#25514) 2026-07-22 00:42:35 +02:00
internlm.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
internvl.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
jais.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
jamba.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
januspro.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
kimi_linear.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
kimivl.py mtmd: add GLM-5.2-Vision (#26126) 2026-07-26 20:43:51 +02:00
laguna.py Add support for Laguna XS.2 & M.1 (#25165) 2026-07-22 09:54:08 +08:00
lfm2.py model : Add LFM2.5-ColBERT-350M and LFM2.5-Embedding-350M (#24913) 2026-06-24 09:49:46 +03:00
lighton_ocr.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
llada.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
llama.py spec: add eagle3-v3 support for gpt-oss model (#25794) 2026-07-28 09:58:16 +03:00
llama4.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
llava.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
maincoder.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
mamba.py mamba2: remove hardcoded 2x expansion factor and invalid d_inner % d_state check (#23082) 2026-06-26 08:50:54 +03:00
mellum.py model: add Mellum architecture (#23966) 2026-06-02 22:11:12 +03:00
mimo.py mtmd: support MiMo-V2.5 audio input (RVQ-based model) (#26190) 2026-07-27 23:17:09 +02:00
minicpm.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
minimax.py mtmd: Add Vision Support for Minimax-M3 (#25113) 2026-07-27 01:44:41 +02:00
mistral.py convert : fix conversion for Mistral-Medium-3.5-128B (#24268) 2026-06-07 21:41:39 +02:00
mistral3.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
mpt.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
nanbeige.py model: Add support for Nanbeige4.2 (#25994) 2026-07-27 17:04:18 +02:00
nemotron.py mtmd : add Nemotron 3 Nano Omni support (parakeet) (#22520) 2026-07-28 17:20:25 +02:00
olmo.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
openelm.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
orion.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
pangu.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
phi.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
pixtral.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
plamo.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
plm.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
qwen.py spec: add DSpark speculative decoding (#25173) 2026-07-28 14:43:27 +03:00
qwen3vl.py convert : fix Qwen3 ASR conversion (#23081) 2026-05-15 18:38:39 +02:00
qwenvl.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
refact.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
rwkv.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
sarashina2.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
smallthinker.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
smolvlm.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
stablelm.py convert : more consistent handling of rope_parameters (#24833) 2026-06-20 13:42:36 +03:00
starcoder.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
step3.py convert_hf_to_gguf: support split MTP export for HY V3 (#25641) 2026-07-14 11:43:15 +02:00
t5.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
talkie.py model : add support for talkie-1930-13b (#22596) 2026-05-26 07:57:38 +03:00
ultravox.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
wavtokenizer.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
xverse.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00
youtuvl.py Refactor: convert_hf_to_gguf.py (#17114) 2026-05-15 15:18:12 +02:00