nemo_automodel.components.launcher.interactive

View as Markdown

Module Contents

Classes

NameDescription
InteractiveLauncherLaunch a recipe locally on the current node using torchrun or in-process.

Functions

NameDescription
_get_repo_rootReturn the repository root. If CWD looks like an editable checkout,
_recipe_module_pathConvert a dotted recipe target into an absolute filesystem path.
resolve_recipe_clsImport and return the recipe class from a dotted path.

Data

_INSTALL_MSG

logger

API

class nemo_automodel.components.launcher.interactive.InteractiveLauncher()

Bases: Launcher

Launch a recipe locally on the current node using torchrun or in-process.

nemo_automodel.components.launcher.interactive.InteractiveLauncher._is_torchrun_worker() -> bool
staticmethod

Return True when this process was already spawned by torchrun.

torchrun (torch.distributed.run) sets both LOCAL_RANK and TORCHELASTIC_RUN_ID in the environment of every worker it spawns. We check for both to avoid false positives from environments (e.g. SLURM) that may set LOCAL_RANK without an active torchrun session.

When the user launches the CLI via torchrun --nproc-per-node N -m nemo_automodel.cli.app config.yaml, each worker must run the recipe in-process instead of re-launching torchrun.

nemo_automodel.components.launcher.interactive.InteractiveLauncher._run_recipe_in_process(
recipe_target: str,
config: typing.Dict[str, typing.Any]
) -> int

Instantiate and run a recipe in the current process.

nemo_automodel.components.launcher.interactive.InteractiveLauncher.launch(
config: typing.Dict[str, typing.Any],
config_path: pathlib.Path,
recipe_target: str,
launcher_config: typing.Any = None,
extra_args: typing.Optional[typing.List[str]] = None
) -> int
nemo_automodel.components.launcher.interactive._get_repo_root() -> pathlib.Path

Return the repository root. If CWD looks like an editable checkout, prepend it to PYTHONPATH so the local source takes precedence.

nemo_automodel.components.launcher.interactive._recipe_module_path(
recipe_target: str,
repo_root: pathlib.Path
) -> pathlib.Path

Convert a dotted recipe target into an absolute filesystem path.

nemo_automodel.components.launcher.interactive.resolve_recipe_cls(
target_str: str
)

Import and return the recipe class from a dotted path.

” pip install nemo-automodel # CPU/basic ” ” pip install nemo-automodel[all] # with CUDA & all extras

nemo_automodel.components.launcher.interactive._INSTALL_MSG = 'Local/interactive execution requires PyTorch and the full nemo_automodel packag...
nemo_automodel.components.launcher.interactive.logger = logging.getLogger(__name__)