Skip to content

llama : make loras compatible with repacking#12593

Merged
ggerganov merged 3 commits into
masterfrom
gg/lora-with-repack
Mar 27, 2025
Merged

llama : make loras compatible with repacking#12593
ggerganov merged 3 commits into
masterfrom
gg/lora-with-repack

Conversation

@ggerganov

Copy link
Copy Markdown
Member

fix #12587
ref #12181 (comment)

When a LoRA adapter requires to be loaded to an extra buffer type (such as repacked bufts), load in to the default CPU buffer type instead.

@ggerganov

Copy link
Copy Markdown
Member Author

@giladgd @amakropoulos Could you test if this change fixes the LoRA usage with Q4_K?

@amakropoulos

Copy link
Copy Markdown
Contributor

@ggerganov yes that fixed it!

I get these warnings but otherwise works as expected:

llama_adapter_lora_init_impl: loading lora adapter from '/home/benuix/.config/LLMUnity/models/Qwen2-0.5B-Instruct-ru-lora.gguf' ...
llama_adapter_lora_init_impl: lora for 'blk.11.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.12.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.14.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.15.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.17.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.18.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.2.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.20.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.22.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.23.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.4.ffn_down.weight' cannot use buft 'CPU_AARCH64'
llama_adapter_lora_init_impl: lora for 'blk.5.ffn_down.weight' cannot use buft 'CPU_AARCH64'

@ggerganov

Copy link
Copy Markdown
Member Author

Yes, the warnings are expected.

@ggerganov ggerganov requested a review from slaren March 26, 2025 16:30
@giladgd

giladgd commented Mar 26, 2025

Copy link
Copy Markdown
Contributor

@ggerganov I've run some tests and this seems to solve the issue.

@slaren slaren left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work for now. Ideally we would use the same process as the model weights to determine the buffer type. I think this could be done by extracting to a function the relevant parts of the create_tensor lambda in llama_model::load_tensors, and keeping a mapping of each weight to its LLM_TN_IMPL object in llama_model.

@ggerganov ggerganov merged commit f28bc4c into master Mar 27, 2025
@ggerganov ggerganov deleted the gg/lora-with-repack branch March 27, 2025 06:24
@amakropoulos

Copy link
Copy Markdown
Contributor

Thank you for the quick fix!

Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
phibya pushed a commit to ziee-ai/llama.cpp that referenced this pull request May 29, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
* llama : make loras compatible with repacking

ggml-ci

* cont : simplify

ggml-ci

* cont : add TODO [no ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: Server crash with use of lora on CPU

4 participants