# cli.main

`cli.main`

Click CLI definitions for various axolotl commands.

## Functions

Name | Description
--- | ---
cli | Axolotl CLI - Train and fine-tune large language models
evaluate | Evaluate a model.
fetch | Fetch example configs or other resources.
inference | Run inference with a trained model.
merge_lora | Merge trained LoRA adapters into a base model.
merge_sharded_fsdp_weights | Merge sharded FSDP model weights.
preprocess | Preprocess datasets before training.
train | Train or fine-tune a model.

### cli

    cli.main.cli()

Axolotl CLI - Train and fine-tune large language models

### evaluate

    cli.main.evaluate(config, accelerate, **kwargs)

Evaluate a model.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
config | str | Path to `axolotl` config YAML file. | required
accelerate | bool | Whether to use `accelerate` launcher. | required
kwargs |  | Additional keyword arguments which correspond to CLI args or `axolotl` config options. | `{}`

### fetch

    cli.main.fetch(directory, dest)

Fetch example configs or other resources.

Available directories: - examples: Example configuration files - deepspeed_configs: DeepSpeed configuration files

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
directory | str | One of `examples`, `deepspeed_configs`. | required
dest | Optional[str] | Optional destination directory. | required

### inference

    cli.main.inference(config, accelerate, gradio, **kwargs)

Run inference with a trained model.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
config | str | Path to `axolotl` config YAML file. | required
accelerate | bool | Whether to use `accelerate` launcher. | required
gradio | bool | Whether to use Gradio browser interface or command line for inference. | required
kwargs |  | Additional keyword arguments which correspond to CLI args or `axolotl` config options. | `{}`

### merge_lora

    cli.main.merge_lora(config, **kwargs)

Merge trained LoRA adapters into a base model.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
config | str | Path to `axolotl` config YAML file. | required
kwargs |  | Additional keyword arguments which correspond to CLI args or `axolotl` config options. | `{}`

### merge_sharded_fsdp_weights

    cli.main.merge_sharded_fsdp_weights(config, accelerate, **kwargs)

Merge sharded FSDP model weights.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
config | str | Path to `axolotl` config YAML file. | required
accelerate | bool | Whether to use `accelerate` launcher. | required
kwargs |  | Additional keyword arguments which correspond to CLI args or `axolotl` config options. | `{}`

### preprocess

    cli.main.preprocess(config, cloud=None, **kwargs)

Preprocess datasets before training.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
config | str | Path to `axolotl` config YAML file. | required
cloud | Optional[str] | Path to a cloud accelerator configuration file. | `None`
kwargs |  | Additional keyword arguments which correspond to CLI args or `axolotl` config options. | `{}`

### train

    cli.main.train(config, accelerate, cloud=None, sweep=None, **kwargs)

Train or fine-tune a model.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
config | str | Path to `axolotl` config YAML file. | required
accelerate | bool | Whether to use `accelerate` launcher. | required
cloud | Optional[str] | Path to a cloud accelerator configuration file | `None`
sweep | Optional[str] | Path to YAML config for sweeping hyperparameters. | `None`
kwargs |  | Additional keyword arguments which correspond to CLI args or `axolotl` config options. | `{}`