[GH-ISSUE #4904] Need Support: Local Model Parameters Override Like Llama.cpp #3098

Open
opened 2026-04-12 13:32:25 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @DirtyKnightForVi on GitHub (Jun 7, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4904

In llama.cpp, when running a model, I can update the model parameters using --override-kv.

How can this be achieved in ollama?
Should I modify a certain file?
Or PARAMETER to the Modlefile?
Or is there some other similar command?

Here is a situation that i have to override some parameters.
It works at llama.cpp, but i am not sure in ollama.

Metadata KV overrides (pass them using --override-kv, can be specified multiple times):

deepseek2.attention.q_lora_rank=int:1536
deepseek2.attention.kv_lora_rank=int:512
deepseek2.expert_shared_count=int:2
deepseek2.expert_feed_forward_length=int:1536
deepseek2.expert_weights_scale=float:16
deepseek2.leading_dense_block_count=int:1
deepseek2.rope.scaling.yarn_log_multiplier=float:0.0707
Originally created by @DirtyKnightForVi on GitHub (Jun 7, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4904 In llama.cpp, when running a model, I can update the model parameters using `--override-kv`. How can this be achieved in ollama? Should I modify a certain file? Or `PARAMETER` to the Modlefile? Or is there some other similar command? [Here](https://huggingface.co/leafspark/DeepSeek-V2-Chat-GGUF) is a situation that i have to override some parameters. It works at llama.cpp, but i am not sure in ollama. ``` Metadata KV overrides (pass them using --override-kv, can be specified multiple times): deepseek2.attention.q_lora_rank=int:1536 deepseek2.attention.kv_lora_rank=int:512 deepseek2.expert_shared_count=int:2 deepseek2.expert_feed_forward_length=int:1536 deepseek2.expert_weights_scale=float:16 deepseek2.leading_dense_block_count=int:1 deepseek2.rope.scaling.yarn_log_multiplier=float:0.0707 ```
Author
Owner

@kanishkaditya commented on GitHub (Jan 30, 2025):

hey any way to pass kv overrides to ollama yet?
i have been puzzeled whole day due to this, specifically i want to increase the number of expert but its a kv overide. Not sure how to do it yet.

<!-- gh-comment-id:2624709010 --> @kanishkaditya commented on GitHub (Jan 30, 2025): hey any way to pass kv overrides to ollama yet? i have been puzzeled whole day due to this, specifically i want to increase the number of expert but its a kv overide. Not sure how to do it yet.
Author
Owner

@rick-github commented on GitHub (Jan 30, 2025):

hey any way to pass kv overrides to ollama yet?

No. My change languished without being merged so I closed it. The runners that are now built for ollama no longer support the --override-kv flag.

<!-- gh-comment-id:2624776156 --> @rick-github commented on GitHub (Jan 30, 2025): > hey any way to pass kv overrides to ollama yet? No. My change languished without being merged so I closed it. The runners that are now built for ollama no longer support the `--override-kv` flag.
Author
Owner

@ProjectMoon commented on GitHub (Feb 1, 2025):

What is the best way to achieve the overrides then? Is it possible to set values in the config json when importing from safe tensors?

<!-- gh-comment-id:2628816013 --> @ProjectMoon commented on GitHub (Feb 1, 2025): What is the best way to achieve the overrides then? Is it possible to set values in the config json when importing from safe tensors?
Author
Owner

@rick-github commented on GitHub (Feb 1, 2025):

I expect that modifying the config.json and building a new model would work. The runner architecture that ollama uses is undergoing a lot of changes at the moment, when the transition to the new system is complete there may be an opportunity to add a KV override mechanism. Until then, modifying the model is the only way to achieve this.

<!-- gh-comment-id:2628910810 --> @rick-github commented on GitHub (Feb 1, 2025): I expect that modifying the config.json and building a new model would work. The runner architecture that ollama uses is undergoing a lot of changes at the moment, when the transition to the new system is complete there may be an opportunity to add a KV override mechanism. Until then, modifying the model is the only way to achieve this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#3098