Training procedure

The following bitsandbytes quantization config was used during training:

The following bitsandbytes quantization config was used during training:

Framework versions

Goal

The goal of this project is to fine-tune the Llama2-7b language model for code generation using the QLORA method. The model will take natural language as input, and should return code as output. We're first going to iterate on a base Llama-2-7b model with prompting, and finally instruction-fine-tune the model.

As an example, if we prompt the model with this instruction:

Instruction: Create an array of length 5 which contains all even numbers between 1 and 10.

We want the model to produce exactly this response:

Response: array = [2, 4, 6, 8, 10]

QLORA Method for Fine-Tuning

The QLORA method for fine-tuning large language models (LLMs) is a parameter-efficient approach that uses 4-bit quantization to reduce the memory and computational requirements of fine-tuning. QLORA is implemented in the PEFT library, which is built on top of the Hugging Face Transformers library.

Ludwig Data Format

Ludwig requires data to be in a specific format. The main components of the data format are:

Here is an example of a simple Ludwig config:

input_features:
  - name: instruction
    type: text
output_features:
  - name: output
    type: text

This config tells Ludwig to use the column called instruction in the dataset as an input feature and the output column as an output feature.

Prerequisites

Setup and Installation

  1. Clone the repository:
    git clone https://github.com/omid-sar/Llama2-7B-Fine-Tuning--Google-Colab-.git
    
  2. Open the notebook Fine_Tuning_Llama2_7b(_Ludwig).ipynb in Google Colab or a local Jupyter environment.
  3. Install the required libraries:
    pip install ludwig
    
  4. Follow the instructions in the notebook to download any additional datasets or models.

Usage

  1. Run the cells in the notebook sequentially, following the instructions and comments provided.
  2. Modify the model configuration, training parameters, or input data as needed to suit your use case.