Today we will learn how to fine-tune a LLAMA 2 model to write IELTS essays.

Now let’s go to the tutorial! 📕

Dataset

For this task, I will use the IELTS writing essays dataset from kaggle. We also will use google colab to train our model. The model used will be LLAMA 2 7b sharded because this model is optimized to use hugging face accelerate and do operations in the GPU.

For fine-tuning we will use QLoRa and PEFT techniques.

The jupyter notebook can be found here.

Cleaning the dataset

Screenshot from 2023-08-23 21-42-30.png

If you check the dataset, you will see that the data contains essays from a wide range of scores from 1 to 9, where 9 is the best score. Since we want our bot to only produce high-quality essays, I will filter the data to only use essays above the score of 7.

Installing the libraries

For this tutorial, we will use the following libraries:

!pip install -U git+https://github.com/huggingface/transformers@de9255de27abfcae4a1f816b904915f0b1e23cd9
!pip install -q -U trl accelerate git+https://github.com/huggingface/peft.git
!pip install -q datasets bitsandbytes einops wandb
!pip install pandas

Uploading the data csv

Go to Google Colab, click on the folder icon on the left, and click on the icon file to upload the csv data.

Untitled

Dataset cleaning - Code