cli.merge_lora

cli.merge_lora

CLI to merge a trained LoRA into a base model.

Functions

Name Description
do_cli Parses axolotl config, CLI args, and calls do_merge_lora. Note that various
do_merge_lora Merges LoRA adapters with base model using either memory-efficient or legacy approach.

do_cli

cli.merge_lora.do_cli(
    config=Path('examples/'),
    dequant=False,
    override_quantizer=False,
    **kwargs,
)

Parses axolotl config, CLI args, and calls do_merge_lora. Note that various config values will be overwritten to allow the LoRA merge logic to work as expected (load_in_8bit=False, load_in4bit=False, flash_attention=False, etc.).

Parameters

Name Type Description Default
config Union[Path, str] Path to axolotl config YAML file. Path('examples/')
dequant bool If set (--dequant), dequantize a quantized base to bf16 in the merged checkpoint. Default keeps the base’s quantized dtypes (fp8/nvfp4) intact. False
override_quantizer bool If set (--override-quantizer), merge a merge-aware adapter despite a quantizer-identity mismatch (e.g. different torchao version than the one trained with) instead of hard-erroring. False
kwargs Additional keyword arguments to override config file values. {}

Raises

Name Type Description
ValueError If target directory for LoRA merged model does not exist.

do_merge_lora

cli.merge_lora.do_merge_lora(cfg)

Merges LoRA adapters with base model using either memory-efficient or legacy approach.

Parameters

Name Type Description Default
cfg DictDefault Dictionary mapping axolotl config keys to values. required