Skip to content

nexuml.cli.main

nexuml.cli.main

NexuML CLI — entry point for all pipeline operations.

scenario_resolve

scenario_resolve(
    name: str = typer.Argument(help="Scenario name"),
    output: Optional[Path] = typer.Option(
        None, "--output", "-o", help="Output YAML path"
    ),
)

Resolve a named scenario to a YAML config file.

build

build(
    config_path: Path = typer.Argument(
        help="Path to resolved YAML config"
    ),
)

Compile and validate a pipeline from a resolved YAML config.

train_cmd

train_cmd(
    scenario_name: Optional[str] = typer.Argument(
        None, help="Scenario name"
    ),
    config_path: Optional[Path] = typer.Option(
        None, "--config", "-c", help="Config YAML path"
    ),
    scenario_file: Optional[Path] = typer.Option(
        None,
        "--scenario-file",
        help="Trusted Python file exposing scenario() -> ScenarioSpec",
    ),
    artifact_dir: Optional[Path] = typer.Option(
        None,
        "--artifact-dir",
        help="Optional directory for scenario-file provenance snapshots",
    ),
    max_epochs: Optional[int] = typer.Option(
        None, "--max-epochs", help="Override max epochs"
    ),
    trainer_checkpoint: Optional[Path] = typer.Option(
        None,
        "--trainer-checkpoint",
        help="Optional Lightning Trainer checkpoint to resume from.",
    ),
    override: Optional[list[str]] = typer.Option(
        None,
        "--override",
        "-O",
        help="Override a scenario field: key.path=value. Repeatable.",
    ),
)

Train a pipeline from a scenario name or config file.

Raises:

Type Description
Exit

If input validation fails or training encounters an error.

export_dataset_cmd

export_dataset_cmd(
    scenario_name: Optional[str] = typer.Argument(
        None, help="Scenario name"
    ),
    config_path: Optional[Path] = typer.Option(
        None, "--config", "-c", help="Config YAML path"
    ),
    output: str = typer.Option(
        "exported_dataset",
        "--output",
        "-o",
        help="Path or s3:// URI",
    ),
    backend: str = typer.Option(
        "numpy", "--backend", help="Dataset export backend"
    ),
    split: list[str] | None = typer.Option(
        None,
        "--split",
        help="Split to export. Repeat the option to export multiple splits.",
    ),
    preprocess: bool = typer.Option(
        False,
        "--preprocess/--no-preprocess",
        help="Run the compiled pipeline until the requested preprocessing keys exist.",
    ),
    preprocess_until_key: list[str] | None = typer.Option(
        None,
        "--preprocess-until-key",
        help="TensorDict x key marking the preprocessing boundary. Repeatable.",
    ),
    x_key: list[str] | None = typer.Option(
        None,
        "--x-key",
        help="x TensorDict keys to persist. Repeatable. Default: all.",
    ),
    y_key: list[str] | None = typer.Option(
        None,
        "--y-key",
        help="label TensorDict keys to persist. Repeatable. Default: all.",
    ),
    include_labels: bool = typer.Option(
        True,
        "--labels/--no-labels",
        help="Include labels from the batch y TensorDict.",
    ),
    dtype: str | None = typer.Option(
        None,
        "--dtype",
        help="Optional storage dtype passed to the export backend, e.g. float16.",
    ),
    samples_per_shard: int = typer.Option(
        256,
        "--samples-per-shard",
        help="Samples per WebDataset tar shard",
    ),
    s3_endpoint_url: str | None = typer.Option(
        None,
        "--s3-endpoint-url",
        help="Optional S3-compatible endpoint",
    ),
    s3_region: str | None = typer.Option(
        None, "--s3-region", help="Optional S3 region"
    ),
    s3_profile: str | None = typer.Option(
        None,
        "--s3-profile",
        help="Optional AWS credential profile name",
    ),
)

Export a dataset view to disk or S3 from a scenario or config.

Raises:

Type Description
Exit

If preprocessing is enabled without --preprocess-until-key.

export_cmd

export_cmd(
    scenario_name: str = typer.Argument(
        help="Scenario name to train and export"
    ),
    output: Path = typer.Option(
        Path("exported_model"),
        "--output",
        "-o",
        help="Export directory",
    ),
    checkpoint: Optional[Path] = typer.Option(
        None,
        "--checkpoint",
        help="Optional checkpoint to export",
    ),
)

Export a trained pipeline to a portable model package.

smoke

smoke(
    scenario_name: str = typer.Argument(
        default="synthetic-linear-ae-reconstruction",
        help="Scenario name",
    ),
    max_epochs: int = typer.Option(
        3, "--max-epochs", help="Training epochs"
    ),
    download: bool = typer.Option(
        False,
        "--download",
        help="Download datasets before training",
    ),
)

Run a full smoke-test: resolve → build → train → export → reload → infer.

tune_cmd

tune_cmd(
    scenario_name: Optional[str] = typer.Argument(
        None, help="Scenario name"
    ),
    scenario_file: Optional[Path] = typer.Option(
        None,
        "--scenario-file",
        help="Trusted Python file exposing scenario() -> ScenarioSpec",
    ),
    artifact_dir: Optional[Path] = typer.Option(
        None,
        "--artifact-dir",
        help="Optional directory for scenario-file provenance snapshots",
    ),
    n_trials: Optional[int] = typer.Option(
        None, "--n-trials", help="Number of Optuna trials"
    ),
    metric_key: Optional[str] = typer.Option(
        None,
        "--metric",
        help="Metric to optimise (default: tuning_spec.metric_key or val/loss)",
    ),
    direction: Optional[str] = typer.Option(
        None,
        "--direction",
        help="Optuna direction: minimize or maximize (default: from tuning_spec)",
    ),
    storage: Optional[str] = typer.Option(
        None, "--storage", help="Optuna storage path"
    ),
    prune: Optional[bool] = typer.Option(
        None,
        "--prune/--no-prune",
        help="Enable Optuna pruning",
    ),
    override: Optional[list[str]] = typer.Option(
        None,
        "--override",
        "-O",
        help="Override a scenario field: key.path=value. Repeatable.",
    ),
)

Tune a scenario's hyperparameters with Optuna using a default search space.

Raises:

Type Description
Exit

If scenario input is ambiguous or loading fails.

registry_list

registry_list(
    kind: str = typer.Argument(
        "layers",
        help="Kind to list: layers, data, scenarios, eval",
    ),
    verbose: bool = typer.Option(
        False,
        "--verbose",
        "-v",
        help="Show full tracebacks for discovery errors",
    ),
)

List registered items by kind (layers, data, scenarios, eval).

Raises:

Type Description
Exit

If kind is not one of the recognised values.

backend_list

backend_list(
    category: Optional[str] = typer.Argument(
        None,
        help="Optional category filter, e.g. data-export, data-loader, training",
    ),
)

List available backend implementations.

Raises:

Type Description
Exit

If category does not match any registered backends.

library_add

library_add(
    path: Path = typer.Argument(
        ...,
        help="Path to local library root",
        exists=True,
        file_okay=False,
        dir_okay=True,
    ),
)

Add a local library root path to the NexuML config.

library_delete

library_delete(
    path: Path = typer.Argument(
        ..., help="Path to local library root"
    ),
)

Remove a local library root path from the NexuML config.

Raises:

Type Description
Exit

If the path is not currently configured as a library root.

library_list

library_list()

List all available library sources (installed and local).