Skip to content

lora : fix llama conversion script with model having ROPE_FREQS#9117

Merged
ngxson merged 1 commit into
ggml-org:masterfrom
ngxson:xsn/fix_llama_lora
Aug 23, 2024
Merged

lora : fix llama conversion script with model having ROPE_FREQS#9117
ngxson merged 1 commit into
ggml-org:masterfrom
ngxson:xsn/fix_llama_lora

Conversation

@ngxson

@ngxson ngxson commented Aug 21, 2024

Copy link
Copy Markdown
Collaborator

Resolve #9114


@ngxson
ngxson requested a review from compilade August 21, 2024 12:55
@github-actions github-actions Bot added testing Everything test related python python script changes labels Aug 21, 2024
@Ujjawal-K-Panchal

Copy link
Copy Markdown
Contributor

This fixes the issue #9114 I raised. Please look at the final output log here.

Comment thread convert_hf_to_gguf.py
Comment on lines +1598 to +1599
if not self.is_lora:
self.gguf_writer.add_tensor(self.format_tensor_name(gguf.MODEL_TENSOR.ROPE_FREQS), np.array(rope_factors, dtype=np.float32))

@compilade compilade Aug 21, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For Phi-3, vocab-only conversion is also affected by these rope_freqs tensors, because this is in set_gguf_parameters. (which makes vocab-only Phi-3-128k models produce invalid GGUF files (this is already a problem on master))

A more general solution to both LoRA and vocab-only conversions should be possible.

Maybe some kind of self.generate_extra_tensors() which would be called by self.prepare_tensors() before it calls self.get_tensors(). And LoraModel could simply override generate_extra_tensors() to a no-op (and vocab-only conversion does not call prepare_tensors). It can be done in a follow-up PR, though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK I'll merge this now and will let you refactor this further in a follow-up PR.
Thank you for the help!

@ngxson
ngxson merged commit 3ba780e into ggml-org:master Aug 23, 2024
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Nov 15, 2024
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Nov 18, 2024
Nexesenex pushed a commit to Nexesenex/croco.cpp that referenced this pull request Feb 25, 2025
Nexesenex pushed a commit to Nexesenex/croco.cpp that referenced this pull request Feb 25, 2025
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
phibya pushed a commit to ziee-ai/llama.cpp that referenced this pull request May 29, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python python script changes testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Converted HF LoRA adapter on Llama 3.1 not loading.

3 participants