Skip to content

Feature request: export to GGUF LoRA (not merging) #1546

Closed

Description

@ngxson

Hi, I'm one of the maintainer working on LoRA support on llama.cpp

FYI, we already had a script convert_lora_to_gguf.py that can convert any PEFT-compatible LoRA adapter into GGUF, without merging into base model.

I would like to discuss if we can take advantage of this feature to convert fine-tuned adapter directly into GGUF. An idea could be:

# add save_method = "lora" to export just the adapter, not merging
model.save_pretrained_gguf("dir", tokenizer, save_method = "lora", quantization_method = "f16")

For demo, here is a list of GGUF LoRA adapter: https://huggingface.co/collections/ggml-org/gguf-lora-adapters-677c49455d8f7ee034dd46f1

Happy to discuss more if you find this interesting.

Thank you.

Activity

  1. danielhanchen commented on Jan 16, 2025

    @danielhanchen
    Member

    Yes that would be very cool indeed! There was a code path to convert to GGUF LoRA, but it's not maintained that well.

    I'm currently working on refactoring saving to GGUF in https://github.com/unslothai/unsloth-zoo/blob/nightly/unsloth_zoo/llama_cpp.py

    But having direct LoRA exporting would be very cool!

  2. jerpint commented on Oct 7, 2025

    @jerpint

    following up to see if there is any progress on this, this would indeed be really useful to export only LoRA adaptors when exporting models, saving tons of space in the process

  3. rolandtannous commented on Oct 15, 2025

    @rolandtannous
    Contributor

    Hello we just fixed save_to_gguf() but have not integrated exporting to GGUF Lora yet. Might do this next .

  4. danielhanchen commented on Sep 6, 2026

    @danielhanchen
    Member

    Yes this works now!

    model.save_pretrained_gguf(dir, tokenizer, save_method = "lora", quantization_method = "f16")

    exports just the adapter through llama.cpp's convert_lora_to_gguf.py.

    Please update Unsloth: uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir (if it's not in the current release yet it'll be in the next one). Reopen if it still happens!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions