Run with NeMo-Run
Run with NeMo-Run
In this guide, you will learn how to launch NeMo AutoModel training jobs using NeMo-Run. NeMo-Run itself supports several executor backends, but AutoModel’s current integration relies on a packaged config at /nemo_run/code/automodel_config.yaml; the Slurm container path is the end-to-end path documented here. The Local execution and Kubernetes executor sections describe current path-staging limitations. For cloud-based training, see Run on Any Cloud with SkyPilot. For direct sbatch usage, see Run on a Cluster (Slurm). For single-node workstation usage, see Run on Your Local Workstation.
NeMo-Run is an open-source tool from NVIDIA that manages job submission across different execution backends. You can define a compute configuration in Python and reuse it across compatible jobs.
Before You Begin
- Install the source checkout and its launcher dependencies. The
allextra includes AutoModel’scliextra, which depends on NeMo-Run:
-
For a named non-local executor, create an executor definitions file at
$NEMORUN_HOME/executors.py.NEMORUN_HOMEdefaults to~/.nemo_run; set the environment variable to use a different location. Each custom executor name referenced by YAML must be defined here.executor: localis constructed directly and does not read this file. See Executor Setup for a complete example. -
Verify connectivity to the target in your executor (e.g. SSH for Slurm, kubeconfig for Kubernetes).
-
Set required environment variables (if needed by your training config):
Executor Setup
For a non-local custom executor, the executor: field in YAML names an entry in $NEMORUN_HOME/executors.py. This file must define a module-level EXECUTOR_MAP dictionary. The Slurm example below matches AutoModel’s current packaged-config path. The Kubeflow example documents its native fields and the additional integration constraints that currently prevent the unmodified AutoModel launcher from being an end-to-end Kubeflow path.
Slurm Executor
Kubernetes Executor
KubeflowExecutor requires an environment with the nemo-run[kubeflow] extra, a working kubeconfig or in-cluster configuration, and an existing workdir_pvc. Without workdir_pvc, NeMo-Run’s Kubeflow package() method returns without copying any work directory. With the PVC, that method syncs the executor’s assigned task directory to the username-scoped executor.code_dir (by default /nemo_run/<username>/code); it does not consume AutoModel’s PatternPackager, and AutoModel does not copy its separately written timestamped config into that task directory. The generated command also still uses /nemo_run/code/automodel_config.yaml. The AutoModel launcher does not make that path equivalent to executor.code_dir, so this executor definition alone is not currently runnable through automodel; config staging and the Kubeflow work directory must first be aligned in the integration.
Multiple Executors
You can define as many executors as you need for different backends, clusters, or resource configurations:
- Keys in
EXECUTOR_MAPare names you reference in YAML (executor: slurm_dev). - Values can be executor instances or zero-argument callables that return one.
- Override fields in YAML are applied on top of executor defaults. Use the executor’s actual field names: for example, Slurm and Local use
ntasks_per_node, while Kubeflow usesnprocs_per_node(falling back togpus_per_node). Adeviceskey is not consumed by these executors.
Quickstart
To submit a compatible AutoModel YAML through the current packaged remote path, add a nemo_run: section that selects a configured Slurm executor. For example, given an existing config that you run locally:
Add a nemo_run: block to submit it to the named Slurm executor instead:
Then run the same command:
The CLI detects the nemo_run: key, strips it from the training config, loads the named Slurm executor from $NEMORUN_HOME/executors.py, and submits the job.
Configuration Reference
All nemo_run: Fields
Examples
Single-Node Fine-Tuning (1 x 8 GPUs)
Multi-Node Distributed Training (2 x 8 GPUs)
AutoModel sets the executor’s launcher to NeMo-Run’s native torchrun launcher; AutoModel does not assemble torchrun rendezvous flags itself. For the generic multi-node path, NeMo-Run generates --nnodes, --nproc-per-node, --node-rank, --rdzv-backend, --rdzv-endpoint, and --rdzv-id. The endpoint uses NeMo-Run’s rank-zero host macro and rendezvous port.
Custom Container Image and Mounts
Local Execution (No Cluster)
The launcher can construct LocalExecutor without an $NEMORUN_HOME/executors.py entry, and its process-count field is ntasks_per_node. However, the current AutoModel script always opens /nemo_run/code/automodel_config.yaml, while LocalExecutor does not stage or mount the PatternPackager output at /nemo_run/code. Therefore the following shape is not currently an end-to-end runnable AutoModel launch:
For a working local two-process launch, omit nemo_run: and use AutoModel’s interactive launcher:
Monitor and Manage Jobs
NeMo-Run stores experiment metadata under $NEMORUN_HOME/experiments/. Set tail_logs: true in the YAML to stream job output after submission.
For Slurm-based executors, standard Slurm commands also work:
For Kubeflow jobs launched after independently resolving the packaging/path constraints above, use kubectl to monitor pods and jobs.
How It Works
- The
automodelCLI detects thenemo_run:key and importsNemoRunLauncher. - The
nemo_run:section is popped from the config, and the remaining training config is passed to the launcher. - For a named non-local executor, the launcher loads a pre-configured executor from
$NEMORUN_HOME/executors.py; forexecutor: local, it directly createsLocalExecutor. Override fields are applied on top of executor defaults. - The launcher writes the training config to
<job_dir>/<timestamp>/automodel_config.yaml. It then assigns a NeMo-RunPatternPackagerto the executor, with the timestamped directory as its relative root. Whether that package is extracted or mounted at the path used by the script is backend-specific; it is not done for Local, and Kubeflow uses its separate PVC-backedcode_dirflow. - AutoModel creates a script that launches the recipe module with
-c /nemo_run/code/automodel_config.yamland selects NeMo-Run’s native torchrun launcher. NeMo-Run, not AutoModel, derives the torchrun arguments fromexecutor.nnodes()andexecutor.nproc_per_node(); the generic path uses--rdzv-endpoint. - The script is submitted via
nemo_run.Experimentwith the requesteddetachvalue. NeMo-Run forcesdetach=Falsefor executor types that do not support detachment, including Local and Kubeflow.
Customize Configuration
Override any training parameter from the command line, same as with local runs: