# 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(ctx, config, launcher, **kwargs)

Evaluate a model.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
ctx | click.Context | Click context for extra args. | required
config | str | Path to `axolotl` config YAML file. | required
launcher | str | Launcher to use for multi-GPU evaluation (“accelerate”, “torchrun”, or “python”). | 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(ctx, config, launcher, gradio, **kwargs)

Run inference with a trained model.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
ctx | click.Context | Click context for extra args. | required
config | str | Path to `axolotl` config YAML file. | required
launcher | str | Launcher to use for multi-GPU inference (“accelerate”, “torchrun”, or “python”). | 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(ctx, config, launcher, **kwargs)

Merge sharded FSDP model weights.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
ctx | click.Context | Click context for extra args. | required
config | str | Path to `axolotl` config YAML file. | required
launcher | str | Launcher to use for weight merging (“accelerate”, “torchrun”, or “python”). | 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(
        ctx,
        config,
        launcher='accelerate',
        cloud=None,
        sweep=None,
        **kwargs,
    )

Train or fine-tune a model.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
ctx | click.Context | Click context for extra args. | required
config | str | Path to `axolotl` config YAML file. | required
launcher | Literal['accelerate', 'torchrun', 'python'] | Launcher to use for multi-GPU training (“accelerate”, “torchrun”, or “python”). | `'accelerate'`
cloud | str | None | Path to a cloud accelerator configuration file | `None`
sweep | str | None | Path to YAML config for sweeping hyperparameters. | `None`
kwargs |  | Additional keyword arguments which correspond to CLI args or `axolotl` config options. | `{}`