LogoLogo
Continuum Knowledge BankContinuum Applications
  • Introduction
  • Creation of Environment
    • Platform Installation
    • Axolotl Dependencies
    • setup.py objectives
      • script analysis
  • Huggingface Hub
  • Download the dataset
    • Types of Dataset Structures
    • Structuring Datasets for Fine-Tuning Large Language Models
    • Downloading Huggingface Datasets
    • Use Git to download dataset
    • Popular Datasets
    • Download cleaned Alpaca dataset
    • Template-free prompt construction
  • Downloading models
    • Phi 2.0 details
    • Downloading Phi 2.0
    • Available Models
  • Configuration for Training
  • Datasets
  • Model Selection - General
  • Phi 2.0
    • Phi 2.0 - Model Configuration
    • Phi 2.0 - Model Quantization
    • Phi 2.0 - Data Loading and Paths
    • Phi 2.0 - Sequence Configuration
    • Phi 2.0 - Lora Configuration
    • Phi 2.0 - Logging
    • Phi 2.0 - Training Configuration
    • Phi 2.0 - Data and Precision
    • Phi 2.0 - Optimisations
    • Phi 2.0 - Extra Hyperparameters
    • Phi 2.0 - All Configurations
    • Phi 2.0 - Preprocessing
    • Phi 2.0 - Training
    • Uploading Models
  • Llama2
    • Llama2 - Model Configuration
    • Llama2 - Model Quantization
    • Llama2 - Data Loading and Paths
    • Llama2 - Sequence Configuration
    • Llama2 - Lora Configuration
    • Llama2 - Logging
    • Llama2 - Training Configuration
    • Llama2 - Data and Precision
    • Llama2 - Optimisations
    • Llama2 - Extra Hyperparameters
    • Llama2- All Configurations
    • Llama2 - Training Configuration
    • Llama2 - Preprocessing
    • Llama2 - Training
  • Llama3
    • Downloading the model
    • Analysis of model files
      • Model Analysis - Configuration Parameters
      • Model Analysis - Safetensors
      • Tokenizer Configuration Files
        • Model Analysis - tokenizer.json
        • Model Analysis - Special Tokens
    • Llama3 - Model Configuration
    • Llama3 - Model Quantization
    • Llama3 - Data Loading and Paths
    • Llama3 - Sequence Configuration
    • Llama3 - Lora Configuration
    • Llama3 - Logging
    • Llama3 - Training Configuration
    • Llama3 - Data and Precision
    • Llama3 - Optimisations
    • Llama3 - Extra Hyperparameters
    • Llama3- All Configurations
    • Llama3 - Preprocessing
    • Llama3 - Training
    • Full Fine Tune
  • Special Tokens
  • Prompt Construction for Fine-Tuning Large Language Models
  • Memory-Efficient Fine-Tuning Techniques for Large Language Models
  • Training Ideas around Hyperparameters
    • Hugging Face documentation on loading PEFT
  • After fine tuning LLama3
  • Merging Model Weights
  • Merge Lora Instructions
  • Axolotl Configuration Files
    • Configuration Options
    • Model Configuration
    • Data Loading and Processing
    • Sequence Configuration
    • Lora Configuration
    • Logging
    • Training Configuration
    • Augmentation Techniques
  • Axolotl Fine-Tuning Tips & Tricks: A Comprehensive Guide
  • Axolotl debugging guide
  • Hugging Face Hub API
  • NCCL
  • Training Phi 1.5 - Youtube
  • JSON (JavaScript Object Notation)
  • General Tips
  • Datasets
Powered by GitBook
LogoLogo

This documentation is for the Axolotl community

On this page
  • LLama2
  • An analysis of the axolotl.clt.train module

Was this helpful?

  1. Llama2

Llama2 - Training

LLama2

To execute the main training script Axolotl provides this command to begin training Phi 2.0

accelerate launch -m axolotl.cli.train examples/llama-2/lora.yml

If you have not already done so, you will be asked to enter your Weights and Biases API Key.

Enter the key at the command line prompt:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

An analysis of the axolotl.clt.train module

Analysis of train.py script

The train.py script in the Axolotl platform is a Command Line Interface (CLI) tool designed for training machine learning models.

This script is structured to provide a user-friendly interface for configuring and executing model training. Here's a detailed analysis:

Script Structure and Functionality

Imports and Logger Setup

  • Essential modules like logging, pathlib.Path, fire, and transformers are imported.

  • The script sets up a logger LOG using the logging module for logging various events and statuses during the script's execution.

do_cli Function

  • Function Definition: The do_cli function is the main entry point of the script. It accepts a config argument (with a default value pointing to an "examples" directory) and **kwargs for additional arguments.

  • ASCII Art Display: print_axolotl_text_art() is called to display ASCII art, likely for aesthetic purposes.

  • Configuration Loading: load_cfg loads configuration details from the provided config path. These configurations are essential for setting up model training parameters.

  • Accelerator and User Token Checks: The script verifies the default configuration for the accelerator (such as a GPU) and checks the user token. These checks are crucial for ensuring that the hardware is correctly set up and the user is authenticated.

  • CLI Arguments Parsing: It uses transformers.HfArgumentParser to parse additional CLI arguments into data classes (TrainerCliArgs). This step allows for dynamic customization of training parameters via the command line.

  • Dataset Loading: load_datasets is called with the parsed configuration and CLI arguments. This function is responsible for loading the dataset as per the configuration, which is a critical step in the training process.

  • Model Training: The train function is invoked with the loaded configuration, CLI arguments, and dataset metadata. This function likely encompasses the core logic for model training.

Main Block

  • The script checks if it's being run as the main program (__name__ == "__main__") and not as a module in another script. If it's the main program, it uses fire.Fire(do_cli) to execute the do_cli function, enabling the script to be interacted with from the command line.

PreviousLlama2 - PreprocessingNextLlama3

Last updated 1 year ago

Was this helpful?

Page cover image