Git Product home page Git Product logo

finetuning_llm's Introduction

LLM Training Project

This project demonstrates how to train a large language model (LLM) using the autotrain library and various deep learning tools and techniques. Prerequisites

Before running the training commands, ensure you have the following:

Python 3.11 or higher
Docker and Docker Compose

Setup

Clone this repository and navigate to the project directory.
Build the Docker image and start the containers:

docker-compose up --build

Install the required Python dependencies:

pip install -r requirements.txt

Update PyTorch:

autotrain setup --update-torch

Training

To train the LLM, use the following command:

autotrain llm --train --project_name my-llm --model meta-llama/Llama-2-7b-hf --data_path . --use-peft --use_int4 --learning_rate 2e-4 --train_batch_size 6 --num_train_epochs 3 --trainer sft

Explanation of the command arguments:

--train: Indicates that we want to train the model.
--project_name: Specifies the name of the project.
--model: Specifies the pre-trained model to use (in this case, meta-llama/Llama-2-7b-hf).
--data_path: Specifies the path to the training data.
--use-peft: Enables the use of Parameter-Efficient Fine-Tuning (PEFT) technique.
--use_int4: Enables the use of INT4 quantization for reduced memory usage.
--learning_rate: Sets the learning rate for training.
--train_batch_size: Specifies the batch size for training.
--num_train_epochs: Sets the number of training epochs.
--trainer: Specifies the trainer to use (in this case, sft for Supervised Fine-Tuning).

For more information on available options, run:

autotrain llm --help

Project Structure

docker-compose.yml: Docker Compose configuration file for setting up the required services.
Dockerfile: Dockerfile for building the training environment.
requirements.txt: List of required Python dependencies.
main.py: Python script for preprocessing the training data.

Note

The training data (data.csv) is not included in this repository. You need to provide your own training data in the specified format. Acknowledgments

This project utilizes the following libraries and frameworks:

autotrain
PyTorch
Hugging Face Transformers
PEFT
bitsandbytes

And this repo:

https://github.com/huggingface/autotrain-advanced

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.