CLI Reference
KladML includes a command-line interface for common tasks.
Hierarchy Overview
KladML organizes work in a 4-level hierarchy:
- Project: Top-level container (e.g.,
sentinella) - Family: Groups related experiments (e.g.,
glucose_forecasting) - Experiment: A specific model/approach (e.g.,
gluformer_v4) - Run: Single training execution with specific params
Global Commands
kladml ui
Launch the interactive Terminal User Interface (TUI). This provides a visual workspace to explore: - Projects, Families, and Experiments (Tree View) - Datasets (List and details) - Configs (File viewer) - Run Details (Parameters and Metrics)
kladml version
Show the installed version.
kladml --help
Show all available commands.
Project Commands
kladml project create
Create a new project.
kladml project list
List all projects.
kladml project show
Show project details.
kladml project delete
Delete a project.
Family Commands
Families group related experiments within a project.
kladml family create
Create a new family under a project.
Example:
kladml family list
List families in a project.
kladml family delete
Delete a family.
Experiment Commands
kladml experiment create
Create a new experiment under a family.
Example:
kladml experiment list
List experiments (grouped by family).
kladml experiment runs
List runs in an experiment.
Run Commands
kladml run native
Run a training script using your local Python environment.
Options:
| Option | Default | Description |
|---|---|---|
--experiment, -e |
default |
Experiment name for tracking |
Example:
kladml run local
Run a training script inside a Docker/Podman container.
Arguments:
| Argument | Description |
|---|---|
script |
Path to the Python script to run |
Options:
| Option | Default | Description |
|---|---|---|
--experiment, -e |
default |
Experiment name for tracking |
Example:
Training Commands
kladml train quick
Recommended - Quick training without database setup.
Options:
| Option | Required | Description |
|---|---|---|
--config, -c |
Yes | Path to YAML config file |
--train, -t |
Yes | Path to training data (.pkl or .h5) |
--val, -v |
No | Path to validation data |
--model, -m |
No | Model name (default: gluformer) |
--device, -d |
No | Device: auto, cpu, cuda, mps |
--resume, -r |
No | Resume from latest checkpoint |
Examples:
# Basic training
kladml train quick -c data/configs/my_config.yaml -t train.pkl -v val.pkl
# Resume interrupted training
kladml train quick -c data/configs/my_config.yaml -t train.pkl --resume
kladml train single
Full training with project and experiment tracking (requires database setup).
Options:
| Option | Required | Description |
|---|---|---|
--model, -m |
Yes | Model architecture name (e.g., gluformer) |
--data, -d |
Yes | Path to training data |
--val |
No | Path to validation data |
--project, -p |
Yes | Project name |
--family, -f |
No | Family name (default: default) |
--experiment, -e |
Yes | Experiment name |
--config, -c |
No | Path to YAML config file |
Example:
kladml train grid
Run a grid search over hyperparameters.
The configuration file must define lists of values for grid search.
Example:
Evaluation Commands
kladml eval run
Evaluate a trained model on test data.
Options:
| Option | Required | Description |
|---|---|---|
--checkpoint |
Yes | Path to model checkpoint (.pt file) |
--data |
Yes | Path to test data |
--model |
No | Model type (default: auto-detect) |
--output |
No | Output directory for results |
--device |
No | Device: auto, cpu, cuda |
Example:
Output includes: - Metrics (MAE, RMSE, MAPE, Coverage) - Plots (predictions, error distribution, scatter) - JSON metrics file and markdown report
kladml eval info
Show available evaluators for each model type.
Data Commands
kladml data inspect
Analyze a .pkl dataset file.
kladml data convert
Convert a dataset to efficient formats (Parquet, HDF5).
Options:
| Option | Required | Description |
|---|---|---|
--input, -i |
Yes | Input .pkl file path |
--output, -o |
Yes | Output file path (.parquet or .h5) |
--format, -f |
No | Format: parquet, hdf5 (default: hdf5) |
--compression |
No | Compression (gzip, zstd). Default: gzip/zstd |
Example:
Configuration Management
kladml config create
Generate a 'smart' configuration file for a model using dataset heuristics.
Options:
| Option | Required | Description |
|---|---|---|
--model, -m |
Yes | Model name (e.g. gluformer) |
--data, -d |
No | Path to training data for auto-tuning |
--output, -o |
No | Output path (default: config.yaml) |
Example:
# Generate config tailored to your dataset
kladml config create --model gluformer --data data/train.parquet
Environment Variables
KladML respects these environment variables:
| Variable | Description |
|---|---|
KLADML_TRAINING_DEVICE |
Override default device (cpu, cuda, mps) |
KLADML_STORAGE_ARTIFACTS_DIR |
Directory for saving artifacts |
KLADML_EXPERIMENT |
Default experiment name |
Hyperparameter Tuning
kladml tune
Run automated hyperparameter tuning using Optuna.
Options:
| Option | Required | Description |
|---|---|---|
--config, -c |
Yes | Path to YAML config file |
--n-trials, -n |
No | Number of trials (default: 50) |
--timeout |
No | Maximum tuning time in seconds |
--pruner |
No | Pruning strategy: median, hyperband (default: median) |
--study-name |
No | Name for the Optuna study |
--storage |
No | Database URL for distributed tuning |
Examples:
# Basic tuning
kladml tune --config config.yaml --n-trials 50
# With timeout
kladml tune --config config.yaml --n-trials 100 --timeout 3600
# Distributed tuning with shared database
kladml tune --config config.yaml --storage sqlite:///optuna.db --study-name my-study
Output:
- Best configuration saved to best_config.yaml
- Optimization history plot
- Parameter importance plot
Run Comparison
kladml compare
Compare multiple training runs visually.
Options:
| Option | Required | Description |
|---|---|---|
--runs, -r |
Yes | Comma-separated list of run IDs |
--metric, -m |
No | Metric to compare (default: val_loss) |
--output, -o |
No | Output directory for comparison plots |
Examples:
# Compare two runs
kladml compare --runs run_001,run_002 --metric val_loss
# Compare multiple runs
kladml compare --runs run_001,run_002,run_003 --metric accuracy --output comparisons/
Output: - Tabular comparison of Metrics (all logged metrics) - Tabular comparison of Parameters (hyperparameters, config) - Side-by-side view for direct analysis
Component Registration
kladml registry add
Register custom components (architectures, preprocessors, evaluators).
Component Types:
| Type | Description |
|---|---|
model |
Custom model architecture |
preprocessor |
Custom data preprocessor |
evaluator |
Custom evaluator |
Options:
| Option | Required | Description |
|---|---|---|
--name, -n |
Yes | Name for the component |
--path, -p |
Yes | Path to artifact file/dir |
--type, -t |
Yes | Type (model, preprocessor, etc.) |
--tag |
No | Tags to attach |
Examples:
# Register a custom architecture
kladml registry add --name MyTransformer --path src/models/my_transformer.py --type model --tag experimental
# Register a custom preprocessor
kladml registry add --name MyScaler --path src/data/scaler.pkl --type preprocessor
kladml registry list
List registered artifacts.
Examples:
kladml registry show
Show details of a registered artifact.