SFTTrainer from trl.
We will use Llama3.1 as our large language model (LLM) and train it on the openassistant-guanaco dataset but you can easily choose another model or dataset from the HuggingFace hub.
Connect to GitHub (if needed)
If you haven’t already connected FlexAI to GitHub, you’ll need to set up a code registry connection:This will allow FlexAI to pull repositories directly from GitHub using the
-u flag in training commands.Preparing the Dataset
In this experiment, we will use a pre-processed version of the the
openassistant-guanaco dataset that has been set up for the Llama3.1 model.If you’d like to reproduce the pre-processing steps yourself to use a different dataset or simply to learn more about the process, you can refer to the Manual Dataset Pre-processing section below.Next, push the contents of the
llama-tokenized-oag/ directory as a new FlexAI dataset:Create Secrets
To access the Llama-3.1-8B model, you need to accept the license with your HuggingFace account. To be authenticated within your code, you will use your HuggingFace Token. Use theflexai secret create command to store your HuggingFace Token as a secret. Replace <HF_AUTH_TOKEN_SECRET_NAME> with your desired name for the secret:
Training
To start the Training Job, run the following command:Optional Extra Steps
Manual Dataset Pre-processing
If you’d prefer to perform the dataset pre-processing step yourself, you can follow these instructions. You can run these in a FlexAI Interactive Session or in a local env (e.g.pipenv install --python 3.10), if you have hardware that’s capable of doing inference.
Clone this repository
If you haven’t already, clone this repository on your host machine:Install the dependencies
Depending on your environment, you might need to install - if not already - the experiments’ dependencies by running:Dataset preparation
Prepare the dataset by running the following command:llama-tokenized-oag/ directory.