nemo-automodel-launcher-config
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLauncher Configuration
启动器配置
NeMo AutoModel supports three launch methods: interactive (torchrun), Slurm (HPC clusters), and SkyPilot (cloud-agnostic).
NeMo AutoModel支持三种启动方式:交互式(torchrun)、Slurm(HPC集群)和SkyPilot(云无关)。
Instructions
说明
For launcher questions, answer directly from this skill without inspecting the
repository unless the user asks you to edit files. Keep the answer focused on
the relevant launch YAML, required fields, and the expected runtime behavior.
Use these compact answer patterns for common questions:
- Slurm multi-node: show a YAML block with
slurm:,job_name,nodes,ntasks_per_node,timeoraccount,partition,container_image, optionalhf_home,extra_mounts, andenv_vars; explain that the launcher derivesmaster_portand setsWORLD_SIZE = nodes * ntasks_per_nodeandMASTER_ADDR.MASTER_PORT - SkyPilot spot: show a YAML block with
skypilot:,cloud,accelerators,num_nodes,use_spot: true,disk_size,region, andsetup; warn that spot instances can be preempted, set a shortenv_vars, and resume withstep_scheduler.checkpoint_interval.restore_from.path - Nsight Systems on Slurm: show alongside normal Slurm fields, say the launcher wraps the training command with
slurm.nsys_enabled: true, and state that it produces ansys profilereport file. Treat profiling as diagnostic-only: use short profiling runs and disable it for normal production training because it adds overhead and large artifacts..nsys-rep
For Slurm answers, start with this minimal template and then adjust only the
fields the user asked about:
yaml
slurm:
job_name: llm_finetune
nodes: 2
ntasks_per_node: 8
time: "04:00:00"
account: my_account
partition: batch
container_image: nvcr.io/nvidia/nemo:dev
hf_home: ~/.cache/huggingface
master_port: 13742
env_vars:
HF_TOKEN: "${HF_TOKEN}"For Slurm-only questions, do not discuss SkyPilot or profiling unless the user
asks. For profiling questions, say the report is written in the
Slurm job working or output directory, using the launcher's Nsys output setting
when one is configured.
.nsys-rep针对启动器相关问题,请直接基于本技能内容作答,无需查看代码仓库,除非用户要求编辑文件。回答需聚焦于相关启动YAML配置、必填字段以及预期运行时行为。
对于常见问题,使用以下简洁回答模板:
- Slurm多节点:展示包含、
job_name、nodes、ntasks_per_node、time或account、partition、container_image、可选hf_home、extra_mounts和env_vars的master_portYAML块;说明启动器会自动计算slurm:并设置WORLD_SIZE = nodes * ntasks_per_node和MASTER_ADDR。MASTER_PORT - SkyPilot抢占式实例:展示包含、
cloud、accelerators、num_nodes、use_spot: true、disk_size、region和setup的env_varsYAML块;提醒抢占式实例可能会被收回,需设置较短的skypilot:,并通过step_scheduler.checkpoint_interval恢复训练。restore_from.path - Slurm上的Nsight Systems:在常规Slurm字段旁添加,说明启动器会用
slurm.nsys_enabled: true包裹训练命令,并生成nsys profile报告文件。仅将性能分析用于诊断场景:使用短时间的分析运行,在常规生产训练中禁用该功能,因为它会带来额外开销并生成大型文件。.nsys-rep
针对Slurm相关问题,从以下最小模板开始,仅调整用户询问的字段:
yaml
slurm:
job_name: llm_finetune
nodes: 2
ntasks_per_node: 8
time: "04:00:00"
account: my_account
partition: batch
container_image: nvcr.io/nvidia/nemo:dev
hf_home: ~/.cache/huggingface
master_port: 13742
env_vars:
HF_TOKEN: "${HF_TOKEN}"仅针对Slurm的问题,除非用户询问,否则不要讨论SkyPilot或性能分析。针对性能分析问题,说明报告将写入Slurm作业的工作目录或输出目录,若配置了启动器的Nsys输出设置则遵循该设置。
.nsys-repRouting Boundary
路由边界
Use this skill only for launch mechanics: interactive execution, Slurm, SkyPilot, containers, mounts, environment variables, rendezvous settings, and profiling.
Do not use this skill for implementing or registering new model architectures, Hugging Face state-dict adapters, model files, or capability flags. Those are model onboarding tasks, not launcher configuration tasks.
本技能仅用于启动机制相关内容:交互式执行、Slurm、SkyPilot、容器、挂载、环境变量、rendezvous设置以及性能分析。
请勿将本技能用于实现或注册新模型架构、Hugging Face状态字典适配器、模型文件或功能标志。这些属于模型接入任务,而非启动器配置任务。
Launch Methods
启动方式
- Interactive (default): runs torchrun on the current node. Suitable for single-node development and debugging.
- Slurm: submits a batch job to an HPC cluster scheduler. Handles multi-node setup, container management, and environment configuration.
- SkyPilot: cloud-agnostic job submission to AWS, GCP, Azure, Lambda, or Kubernetes. Supports spot instances.
- 交互式(默认):在当前节点运行torchrun。适用于单节点开发和调试。
- Slurm:向HPC集群调度器提交批处理作业。处理多节点设置、容器管理和环境配置。
- SkyPilot:与云无关的作业提交,支持AWS、GCP、Azure、Lambda或Kubernetes。支持抢占式实例。
Interactive Launch
交互式启动
bash
undefinedbash
undefinedSingle GPU
单GPU
automodel finetune llm -c config.yaml
automodel finetune llm -c config.yaml
Multi-GPU (all GPUs on current node)
多GPU(当前节点所有GPU)
torchrun --nproc_per_node=8 -m nemo_automodel._cli.app finetune llm -c config.yaml
No additional YAML section is needed for interactive mode. The CLI routes to torchrun automatically when no `slurm:` or `skypilot:` section is present in the config.torchrun --nproc_per_node=8 -m nemo_automodel._cli.app finetune llm -c config.yaml
交互式模式无需额外的YAML配置段。当配置文件中不存在`slurm:`或`skypilot:`段时,CLI会自动路由到torchrun。Slurm Configuration
Slurm配置
The dataclass generates an SBATCH script from a template.
SlurmConfigSlurmConfigYAML Example
YAML示例
yaml
slurm:
job_name: llm_finetune
nodes: 2
ntasks_per_node: 8
time: "04:00:00"
account: my_account
partition: batch
container_image: nvcr.io/nvidia/nemo:dev
hf_home: ~/.cache/huggingface
extra_mounts:
- source: /data
dest: /data
env_vars:
WANDB_API_KEY: "${WANDB_API_KEY}"
HF_TOKEN: "${HF_TOKEN}"yaml
slurm:
job_name: llm_finetune
nodes: 2
ntasks_per_node: 8
time: "04:00:00"
account: my_account
partition: batch
container_image: nvcr.io/nvidia/nemo:dev
hf_home: ~/.cache/huggingface
extra_mounts:
- source: /data
dest: /data
env_vars:
WANDB_API_KEY: "${WANDB_API_KEY}"
HF_TOKEN: "${HF_TOKEN}"Key Fields
关键字段
- : Slurm job identifier
job_name - : number of nodes to request
nodes - : number of tasks (GPUs) per node
ntasks_per_node - : wall-time limit in HH:MM:SS format
time - ,
account: Slurm scheduling parameterspartition - : Enroot/Pyxis container image path
container_image - : mount point for NeMo AutoModel source inside the container
nemo_mount - : HuggingFace cache directory path
hf_home - : list of
extra_mountsfor additional container bind mountsVolumeMapping(source, dest) - : port for distributed communication (default 13742)
master_port - : environment variables passed into the job
env_vars - : when true, wraps the training command with
nsys_enabledfor Nsight Systems profilingnsys profile
- : Slurm作业标识符
job_name - : 请求的节点数量
nodes - : 每个节点的任务(GPU)数量
ntasks_per_node - : 运行时间限制,格式为HH:MM:SS
time - ,
account: Slurm调度参数partition - : Enroot/Pyxis容器镜像路径
container_image - : NeMo AutoModel源码在容器内的挂载点
nemo_mount - : HuggingFace缓存目录路径
hf_home - : 额外容器绑定挂载的
extra_mounts列表VolumeMapping(source, dest) - : 分布式通信端口(默认13742)
master_port - : 传递给作业的环境变量
env_vars - : 设为true时,用
nsys_enabled包裹训练命令以进行Nsight Systems性能分析nsys profile
SkyPilot Configuration
SkyPilot配置
The dataclass defines cloud job parameters.
SkyPilotConfigSkyPilotConfigYAML Example
YAML示例
yaml
skypilot:
cloud: aws
accelerators: "H100:8"
num_nodes: 2
use_spot: true
disk_size: 200
region: us-east-1
setup: "pip install nemo-automodel"
env_vars:
HF_TOKEN: "${HF_TOKEN}"yaml
skypilot:
cloud: aws
accelerators: "H100:8"
num_nodes: 2
use_spot: true
disk_size: 200
region: us-east-1
setup: "pip install nemo-automodel"
env_vars:
HF_TOKEN: "${HF_TOKEN}"Key Fields
关键字段
- : target cloud provider (
cloud,aws,gcp,azure,lambda)kubernetes - : GPU type and count (e.g.,
accelerators,"H100:8")"A100-80GB:4" - : number of cloud instances
num_nodes - : use preemptible/spot instances for cost savings
use_spot - : disk size in GB per node
disk_size - : cloud region for instance placement
region - : shell commands to run before the training job (e.g., install dependencies)
setup - : environment variables for the job
env_vars
- : 目标云提供商(
cloud、aws、gcp、azure、lambda)kubernetes - : GPU类型和数量(例如
accelerators、"H100:8")"A100-80GB:4" - : 云实例数量
num_nodes - : 使用可抢占/抢占式实例以节省成本
use_spot - : 每个节点的磁盘大小(GB)
disk_size - : 实例部署的云区域
region - : 训练作业前运行的shell命令(例如安装依赖)
setup - : 作业的环境变量
env_vars
SkyPilot spot checklist
SkyPilot抢占式实例检查清单
When using spot or preemptible instances:
- Set in the
use_spot: truesection.skypilot: - Include ,
accelerators,num_nodes,disk_size,region, and requiredsetup.env_vars - Use short checkpoint intervals in the recipe, for example , because spot instances can be preempted.
step_scheduler.checkpoint_interval - Resume from the most recent checkpoint after preemption with the recipe's setting.
restore_from
Minimal spot-resume recipe keys:
yaml
step_scheduler:
checkpoint_interval: 100
restore_from:
path: /checkpoints/latest使用抢占式或可抢占实例时:
- 在段中设置
skypilot:。use_spot: true - 包含、
accelerators、num_nodes、disk_size、region以及必填的setup。env_vars - 在训练配置中设置较短的检查点间隔,例如,因为抢占式实例可能会被收回。
step_scheduler.checkpoint_interval - 抢占后通过训练配置的设置从最近的检查点恢复训练。
restore_from
最小化的抢占恢复训练配置项:
yaml
step_scheduler:
checkpoint_interval: 100
restore_from:
path: /checkpoints/latestMulti-Node Environment
多节点环境
For multi-node training (both Slurm and SkyPilot), the launcher automatically configures:
- : hostname of the first node
MASTER_ADDR - : port for rendezvous (default 13742)
MASTER_PORT - : total number of processes (
WORLD_SIZE)nodes * ntasks_per_node - NCCL environment variables for optimized collective communication
对于多节点训练(Slurm和SkyPilot均适用),启动器会自动配置:
- : 第一个节点的主机名
MASTER_ADDR - : rendezvous端口(默认13742)
MASTER_PORT - : 总进程数(
WORLD_SIZE)nodes * ntasks_per_node - 用于优化集合通信的NCCL环境变量
Nsys Profiling
Nsys性能分析
Enable Nsight Systems profiling in Slurm jobs:
yaml
slurm:
job_name: llm_profile
nodes: 1
ntasks_per_node: 8
time: "00:30:00"
account: my_account
partition: batch
container_image: nvcr.io/nvidia/nemo:dev
nsys_enabled: trueThis is a Slurm launcher setting. Normal Slurm fields such as ,
, , , or , and
still apply.
job_namenodesntasks_per_nodetimeaccountpartitioncontainer_imageWhen , the launcher wraps the training command with
and writes a report file for performance analysis
in the Slurm job working or output directory.
Profiling is diagnostic-only: run it for a short investigation, expect overhead
and large artifacts, and turn it off for normal production training.
nsys_enabled: truensys profile.nsys-rep在Slurm作业中启用Nsight Systems性能分析:
yaml
slurm:
job_name: llm_profile
nodes: 1
ntasks_per_node: 8
time: "00:30:00"
account: my_account
partition: batch
container_image: nvcr.io/nvidia/nemo:dev
nsys_enabled: true这是Slurm启动器的设置。常规Slurm字段如、、、、或以及仍然适用。
job_namenodesntasks_per_nodetimeaccountpartitioncontainer_image当时,启动器会用包裹训练命令,并在Slurm作业的工作目录或输出目录中写入报告文件用于性能分析。性能分析仅用于诊断场景:仅在短时间调查中使用,会带来额外开销并生成大型文件,常规生产训练中需关闭该功能。
nsys_enabled: truensys profile.nsys-repCode Anchors
代码锚点
- - SlurmConfig dataclass, VolumeMapping
components/launcher/slurm/config.py - - SBATCH script template generation
components/launcher/slurm/template.py - - Slurm submission utilities
components/launcher/slurm/utils.py - - SkyPilotConfig dataclass
components/launcher/skypilot/config.py - - CLI entry point and launcher routing logic
_cli/app.py
- - SlurmConfig数据类、VolumeMapping
components/launcher/slurm/config.py - - SBATCH脚本模板生成
components/launcher/slurm/template.py - - Slurm提交工具
components/launcher/slurm/utils.py - - SkyPilotConfig数据类
components/launcher/skypilot/config.py - - CLI入口点和启动器路由逻辑
_cli/app.py
Pitfalls
注意事项
- Port collisions: if the default (13742) is in use by another job on the same node, change it to avoid connection failures.
master_port - Container mounts: the path in
sourcemust exist on all nodes in the allocation. Missing paths cause container startup failures.extra_mounts - Slurm fault tolerance: the fault tolerance plugin is Slurm-specific and does not work with SkyPilot or interactive mode.
- SkyPilot spot preemption: spot instances () may be preempted by the cloud provider. Enable checkpointing with short intervals to minimize lost work.
use_spot: true - Environment variable syntax: use syntax in YAML for shell variable expansion. Bare variable names will not be expanded.
${VAR} - Time limit vs async checkpoint: if the Slurm limit is too short, an in-progress async checkpoint write may be killed before completion, resulting in a corrupted checkpoint. Leave at least 5-10 minutes of margin.
time
- 端口冲突:如果默认(13742)被同一节点上的其他作业占用,请修改端口以避免连接失败。
master_port - 容器挂载:中的
extra_mounts路径必须在分配的所有节点上存在。路径缺失会导致容器启动失败。source - Slurm容错:容错插件是Slurm专用的,不适用于SkyPilot或交互式模式。
- SkyPilot抢占式实例收回:抢占式实例()可能会被云提供商收回。启用短间隔检查点以减少工作损失。
use_spot: true - 环境变量语法:在YAML中使用语法进行shell变量展开。裸变量名不会被展开。
${VAR} - 时间限制与异步检查点:如果Slurm的限制过短,正在进行的异步检查点写入可能会在完成前被终止,导致检查点损坏。请预留至少5-10分钟的余量。
time