cli.main

cli.main

Click CLI definitions for various axolotl commands.

Functions

Name Description
agent_docs Show agent-optimized documentation.
cli Axolotl CLI - Train and fine-tune large language models
config_schema Dump the full config JSON schema.
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.

agent_docs

cli.main.agent_docs(topic, list_topics)

Show agent-optimized documentation.

Prints reference docs designed for AI coding agents. These docs are bundled with the package — no network access needed.

 Examples: axolotl agent-docs # overview (start here) axolotl agent-docs grpo # GRPO reference axolotl agent-docs sft # SFT reference axolotl agent-docs –list # list all topics

cli

cli.main.cli()

Axolotl CLI - Train and fine-tune large language models

config_schema

cli.main.config_schema(output_format, field)

Dump the full config JSON schema.

Useful for AI agents and tooling to discover all available config options, their types, defaults, and descriptions.

 Examples: axolotl config-schema # full JSON schema axolotl config-schema –format yaml # YAML format axolotl config-schema –field adapter # single field

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 - docs: Full documentation (Quarto markdown files)

Parameters

Name Type Description Default
directory str One of examples, deepspeed_configs, docs. 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. {}