Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.monostate.ai/llms.txt

Use this file to discover all available pages before exploring further.

Installing AI Training

This guide will walk you through installing AI Training on your computer. The process takes about 5-10 minutes.

What You’ll Get

When you install AI Training with pip or uv, you get:
  • Command Line Interface - The aitraining command for training models
  • Chat Interface - Test and interact with your trained models via browser
  • Python API - Import and use in your Python scripts
All interfaces are included in a single package installation.

Prerequisites

Before installing AI Training, you need Python on your system. Python is a programming language that AI Training runs on.

Check if Python is Installed

Open your terminal (Mac) or Command Prompt (Windows) and type:
python --version
If you see a version number like Python 3.8.0 or higher, you’re good to go. AI Training requires Python 3.8 or newer (3.10+ recommended). If you get an error or have an older version, follow the installation steps below.

Installing Python

Windows Installation

  1. Download Python
  2. Run the Installer
    • Double-click the downloaded file
    • Important: Check “Add Python to PATH” at the bottom
    • Click “Install Now”
    • Wait for installation to complete
  3. Verify Installation
    • Open Command Prompt (search for “cmd” in Start menu)
    • Type: python --version
    • You should see the Python version
  4. Install pip (if needed)
    • pip usually comes with Python, but verify:
    pip --version
    
    • If not found, run:
    python -m ensurepip --upgrade
    

Installing AI Training

Once Python is ready, you have two options for installing AI Training. We recommend using uv for faster installation. uv is a modern Python package installer that’s much faster than pip and handles virtual environments automatically.

Install uv first:

# Using PowerShell (as administrator)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Then install AI Training:

# uv automatically creates and manages a virtual environment
uv pip install aitraining
That’s it! uv handles the virtual environment for you automatically.

Option 2: Using pip (Traditional method)

If you prefer the traditional approach or can’t install uv:

Step 1: Create a Virtual Environment

A virtual environment keeps AI Training’s files separate from other Python projects.
python -m venv aitraining-env
aitraining-env\Scripts\activate
You’ll see (aitraining-env) in your terminal when the environment is active.

Step 2: Install AI Training

pip install aitraining
This downloads and installs AI Training from PyPI with all its dependencies (including PyTorch).

Step 3: Verify Installation

Check that everything installed correctly:
aitraining --version
You should see the AI Training version number.

Choose Your Interface

AI Training offers three ways to work:

Command Line

Best for trainingTrain models with commands. Good for scripts and automation.Start with: aitraining --help

Chat Interface

Best for testingTest your trained models interactively in a browser.Start with: aitraining chat

Python API

Best for developersIntegrate training into your Python applications.Start with: from autotrain.trainers.clm.params import LLMTrainingParams

Optional Dependencies

Some features require additional packages:
FeaturePackageInstallPlatform
Faster LoRA trainingunslothpip install unslothLinux (SFT only, llama/mistral/gemma/qwen2)
Flash Attention 2flash-attnpip install flash-attnLinux (CUDA)
Distributed trainingaccelerateIncludedLinux/Mac/Windows
DeepSpeed Zero-3deepspeedpip install deepspeedLinux
4/8-bit quantizationbitsandbytesIncludedLinux only
Accelerate is required for multi-GPU and distributed training. It is included with AITraining. DeepSpeed is optional and provides Zero-3 memory optimization for very large models.
Quantization (int4/int8) only works on Linux. The bitsandbytes library required for --quantization int4 or --quantization int8 is not available on Windows or macOS.

GPU Setup (Optional)

For NVIDIA GPU training, you may want to reinstall PyTorch with your specific CUDA version:
# CUDA 11.8
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

# CUDA 12.1
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

Weights & Biases Setup (Optional)

AITraining uses W&B for logging by default. To enable:
pip install wandb
wandb login
Or set the environment variable: WANDB_API_KEY=your_key

Common Issues

Python isn’t in your system PATH. Try:
  • Use python3 instead of python
  • Reinstall Python and check “Add Python to PATH”
  • Manually add Python to PATH in System Environment Variables
On Mac/Linux, you might need to use sudo:
sudo pip install aitraining
Or better, use a virtual environment (shown above).
pip didn’t install with Python. Install it:
python -m ensurepip --upgrade
Or on Linux:
sudo apt install python3-pip
  • Make sure you have enough disk space (PyTorch is large)
  • Try upgrading pip first: pip install --upgrade pip
  • For GPU support, ensure CUDA drivers are installed

Next Steps

Installation complete! Now you’re ready to train your first model:

Quick Start Tutorial

Train your first AI model in 10 minutes

Need Help?