Export LoRA Adapters to GGUF via convert_lora_to_gguf.py
⚠️ Please check that this feature request hasn't been suggested before.
- I searched previous Ideas in Discussions didn't find any similar feature requests.
- I searched previous Issues didn't find any similar feature requests.
Feature description
axolotl export (#3950) only converts a full / merged checkpoint via convert_hf_to_gguf.py. llama.cpp also ships convert_lora_to_gguf.py, which turns a PEFT adapter directory into a standalone GGUF LoRA that runtimes load on top of a base GGUF:
llama-cli -m base-f16.gguf --lora my-adapter.gguf✔️ Solution
Dispatch: in axolotl.cli.export.resolve_model_dir, when output_dir holds an adapter (adapter_config.json present, no merged/), call convert_lora_to_gguf.py <adapter_dir> --base --outfile … --outtype … instead of raising. The script reads base_model_name_or_path from adapter_config.json (which axolotl already writes); pass cfg.base_model as --base when it is a local path so no Hub fetch is needed. Config: auto-detect from the adapter dir, or an explicit export.lora: true so a run that has both merged/ and an adapter can choose which to export. Schema: reject export.quantize for adapter exports — llama-quantize only accepts full models. outtype choices for the LoRA converter are f32 f16 bf16 q8_0 auto (no tq1_0/tq2_0), default f32. Preflight: fail early on adapters llama.cpp cannot convert: lora_modules_to_save / any embed_tokens or lm_head tensors in the adapter — llama.cpp errors with "Embeddings is present in the adapter", typically from adding tokens during fine-tuning. DoRA (peft_use_dora) — the converter only handles lora_A / lora_B tensors. Docs: remove "exporting a LoRA adapter as a standalone GGUF" from the Known gaps list in docs/export.qmd; document that the adapter must be paired with a GGUF of the same base at runtime.
❓ Alternatives
na
Additional Context
na
Acknowledgements
- My issue title is concise, descriptive, and in title casing.
- I have searched the existing issues to make sure this feature has not been requested yet.
- I have provided enough information for the maintainers to understand and evaluate this request.
Source: axolotl-ai-cloud/axolotl