Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

💻CLI Reference

The slm-lab CLI is your primary interface for running experiments. For hands-on tutorials, start with Train: PPO on CartPole.

Getting Help

The CLI has built-in help for all commands:

slm-lab --help              # List all commands
slm-lab run --help          # Help for specific command
slm-lab run-remote --help   # Help for remote training

The --help flag is the authoritative reference. This documentation mirrors the CLI help—when in doubt, check --help for the latest options.

Commands Overview

╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ run          Run SLM-Lab experiments locally                                 │
│ run-remote   Launch experiment on dstack with auto HF upload                 │
│ pull         Pull experiment results from HuggingFace                        │
│ push         Push local experiment to HuggingFace                            │
│ list         List experiments available on HuggingFace                       │
│ plot         Plot benchmark comparison graphs                                │
│ plot-list    List available experiments in data folder                       │
╰──────────────────────────────────────────────────────────────────────────────╯

slm-lab run

Run experiments locally.

Arguments

Argument
Default
Description

SPEC_FILE

slm_lab/spec/benchmark/ppo/ppo_cartpole.json

Spec file path (JSON or YAML)

SPEC_NAME

ppo_cartpole

Spec name within the file

MODE

dev

Execution mode: dev, train, search, enjoy, eval

Modes

Mode
Sessions
Rendering
Saves
Use Case

dev

1

Yes

No

Development/debugging

train

4 (configurable)

No

Yes

Full training runs

search

1 per trial

No

Yes

Hyperparameter search

enjoy@{path}

1

Yes

No

Replay trained model

eval@{path}

1

No

No

Evaluate model (no rendering)

train@{path}

From checkpoint

No

Yes

Resume training

Options

Option
Description

-s, --set KEY=VALUE

Set spec variables (can use multiple times)

--render

Enable environment rendering

--log-level LEVEL

Logging: DEBUG, INFO, WARNING, ERROR

--cuda-offset N

GPU device offset (default: 0)

--upload-hf

Upload to HuggingFace after training

--keep N

Trials to keep after search (default: 3, -1 to disable)

--profile

Enable performance profiling

--log-extra

Enable extra metrics (strength, stability, efficiency)

--stop-ray

Stop all Ray processes

--no-optimize-perf

Disable auto CPU/GPU optimization

Examples

slm-lab run-remote

Launch experiments on cloud GPUs via dstack with automatic HuggingFace upload.

Supported modes: run-remote only supports train and search modes. Use local run for dev, enjoy, and eval modes.

Hardware Configuration

The CLI auto-selects hardware based on mode and --gpu flag:

Config
Hardware
Cost
Use Case

cpu-train

4-8 CPUs, 16-32GB

~$0.13/hr

MLP envs validation

cpu-search

8-16 CPUs, 32-64GB

~$0.20/hr

MLP envs ASHA search

gpu-train

L4 GPU

~$0.39/hr

Image envs validation

gpu-search

L4 GPU + 8-16 CPUs

~$0.50/hr

Image envs ASHA search

Options

Option
Description

-n, --name NAME

Run name (default: spec_name)

-s, --set KEY=VALUE

Set spec variables

--gpu

Use GPU hardware (default: CPU)

Examples

Monitoring Remote Runs

slm-lab list

List experiments available on HuggingFace.

Examples

slm-lab pull

Download experiment results from HuggingFace to local data/ folder.

Options

Option
Description

-l, --list

List matching experiments without downloading

Examples

slm-lab push

Upload local experiment to HuggingFace.

Examples

slm-lab plot

Generate benchmark comparison graphs from experiment data.

Options

Option
Description

-f, --folders FOLDERS

Comma-separated data folder names (required)

-t, --title TITLE

Plot title (auto-detected from spec if omitted)

-d, --data-folder PATH

Base data folder (default: data)

-o, --output PATH

Output folder (default: docs/plots)

--no-legend

Hide legend

Examples

slm-lab plot-list

List experiments in data folder that have metrics ready for plotting.

Options

Option
Description

-d, --data-folder PATH

Data folder path (default: data)

Variable Substitution

Template specs use ${var} placeholders for flexibility:

In the spec file:

On the command line:

Common Variables
Example

Environment name

-s env=Hopper-v5

Training budget

-s max_frame=1e7

Hyperparameters

-s gamma=0.99 -s lam=0.95

Type handling: Numeric values (including scientific notation like 1e7) are automatically converted.

Output Structure

Results are saved to data/{spec_name}_{timestamp}/:

Naming: {spec_name}_t{trial}_s{session}_{type}.{ext}

Common Workflows

Train and Evaluate

Cloud Training Workflow

Batch Benchmarking

Last updated

Was this helpful?