> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/automodel/_mcp/server.

# nemo_automodel.cli.app

Unified CLI entry-point for NeMo AutoModel.

## Usage

::

# Recommended — the CLI handles torchrun internally:

automodel \<config.yaml> \[--nproc-per-node N] \[--key.subkey=override ...]

# Also supported — external torchrun launch:

torchrun --nproc-per-node N -m nemo\_automodel.cli.app \<config.yaml> \[--key.subkey=override ...]

# Convenience wrapper for development (not installed):

python app.py \<config.yaml> \[--nproc-per-node N] \[--key.subkey=override ...]

The YAML config must specify which recipe class to instantiate.  All three
forms are accepted::

recipe: TrainFinetuneRecipeForNextTokenPrediction        # bare class name
recipe: nemo\_automodel.recipes.llm.train\_ft.TrainFin...  # fully-qualified
recipe:
*target*: nemo\_automodel.recipes.llm.train\_ft.Trai...  # Hydra-style

For SLURM clusters, use `sbatch slurm.sub` directly (see the reference
script at the repo root).  Add a `skypilot:` or `nemo_run:` section
in the YAML for those launchers.

When launched via `torchrun`, the CLI detects the existing distributed
environment and runs the recipe in-process on each worker instead of
re-spawning torchrun.

## Module Contents

### Functions

| Name                                                   | Description                                  |
| ------------------------------------------------------ | -------------------------------------------- |
| [`build_parser`](#nemo_automodel-cli-app-build_parser) | Build the CLI argument parser.               |
| [`main`](#nemo_automodel-cli-app-main)                 | CLI for running recipes with NeMo-AutoModel. |

### Data

[`logger`](#nemo_automodel-cli-app-logger)

### API

```python
nemo_automodel.cli.app.build_parser() -> argparse.ArgumentParser
```

Build the CLI argument parser.

**Returns:** `argparse.ArgumentParser`

argparse.ArgumentParser

```python
nemo_automodel.cli.app.main()
```

CLI for running recipes with NeMo-AutoModel.

Supports interactive (local), SkyPilot, and NeMo-Run launchers.
For SLURM, use `sbatch slurm.sub` directly.

**Returns:**

Job's exit code.

```python
nemo_automodel.cli.app.logger = logging.getLogger(__name__)
```