Skip to main content

When to Use the CLI

The command line interface is ideal for automation and reproducible workflows.

Best For

  • Automation - Script repetitive tasks
  • CI/CD pipelines - Integrate with deployment
  • Remote servers - SSH into cloud instances
  • Batch processing - Train multiple models
  • Reproducibility - Save and share exact commands

What It Looks Like

Type commands in your terminal:
aitraining text-classification \
  --model bert-base-uncased \
  --data train.csv \
  --epochs 5

Workflow Example

# Prepare data
python prepare_data.py

# Train model
aitraining train \
  --task text-classification \
  --data data/train.csv \
  --output models/v1

# Evaluate
aitraining evaluate \
  --model models/v1 \
  --test data/test.csv

# Deploy
aitraining serve --model models/v1

Advantages

  • Scriptable - Automate everything
  • Reproducible - Save exact commands
  • Version control - Track in git
  • Remote friendly - Works over SSH
  • Parallel execution - Run multiple trainings

Limitations

  • Learning curve - Must know command syntax
  • No visual feedback - Text output only
  • Error prone - Typos in commands
  • Less discoverable - Must know options exist

When to Switch

Move to UI when you:
  • Need visual feedback
  • Want to explore options
  • Teaching non-technical users
  • Doing quick experiments
Move to API when you:
  • Need custom logic
  • Building applications
  • Complex preprocessing
  • Dynamic configuration

Common Use Cases

for lr in 1e-5 2e-5 5e-5; do
  aitraining train \
    --learning-rate $lr \
    --output models/lr_$lr
done

Nightly Training

# In cron or scheduler
0 2 * * * /path/to/retrain.sh

Remote Training

ssh gpu-server
screen -S training
aitraining train --data s3://bucket/data.csv
# Detach with Ctrl-A D

CI/CD Integration

# .github/workflows/train.yml
- name: Train model
  run: aitraining train --config config.yaml

Tips for CLI Users

  1. Save commands - Keep a commands.txt file
  2. Use configs - YAML files over long commands
  3. Log output - Redirect to files
  4. Use screen/tmux - For long-running jobs
  5. Write scripts - Combine multiple steps

CLI-Exclusive Features

Things the CLI does best:
  • Pipe data from other commands
  • Integrate with shell scripts
  • Run on headless servers
  • Batch process files
  • Scheduled execution

Essential Commands

# See all options
aitraining --help

# List available models
aitraining models list

# Check training status
aitraining status

# Resume interrupted training
aitraining train --resume

# Convert model formats
aitraining convert --from pytorch --to onnx

Environment Variables

# Set defaults
export AITRAINING_MODEL=bert-base
export AITRAINING_EPOCHS=5

# Now simpler commands
aitraining train --data train.csv

Next Steps