# 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 | Calls `transformers`’ `merge_and_unload` on the model given in the `axolotl` config

### do_cli

    cli.merge_lora.do_cli(config=Path('examples/'), **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/')`
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)

Calls `transformers`’ `merge_and_unload` on the model given in the `axolotl` config along with the LoRA adapters to combine them into a single base model.

#### Parameters

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