Finetune the GPT2 model with data about "Jalal the cat", and then serve the new model and old models. The new fine-tuned model should correctly answer questions about Jalal the cat's space adventures, as mentioned in the training data. While the original GPT2 model should not be able to.
- Create a virtual environment:
python3 -m venv llm_training_env
- Activate the virtual environment:
source llm_training_env/bin/activate - Upgrade pip:
pip install --upgrade pip - Run the setup script:
python scripts/setup.py(this installs all the dependencies from the requirements.txt file too)
- Place your training data in:
data/train_data.json - Place your evaluation data in:
data/eval_data.json
- All layers fine-tuning config file:
configs/config.yaml - LoRA config file:
configs/config_lora.yaml
- To download the model, run:
python scripts/download_model.py --config configs/training/config_lora.yaml
- To setup the device, run:
python scripts/setup_device.py --config configs/training/config_lora.yaml
- To train the model, use:
python scripts/train.py --config configs/training/config.yaml
- To verify LoRA setup, run:
python scripts/verify_lora_setup.py - To train with LoRA, use:
python scripts/train_lora.py --config configs/training/config_lora.yaml
- To list all models or outputs, check the
models/andoutputs/directories directly.
- Update the latest finetuned model directory in the serving config file.
- Start the server:
python server.py - Go to:
http://0.0.0.0:8000/docs - Try the two endpoints.
Generateuses the new fine-tuned model, andGenerate_baseuses the original GPT2 model.