Skip to content

Fine‐tune LLM

Kannan Ramamoorthy edited this page Nov 10, 2023 · 9 revisions

Initial Setup

This is needed only the first time

python -m pip install --upgrade pip
apt install python3.10-venv # Was needed inside colab container
python -m venv myenv
source myenv/bin/activate 
pip install -r requirements-all.txt
pip install huggingface_hub

Fine-tuning a specific model using 4-bit quantization.

source myenv/bin/activate 
MODEL="codellama/CodeLlama-7b-Instruct-hf"

python scripts/download.py --repo_id $MODEL
python scripts/convert_hf_checkpoint.py --checkpoint_dir checkpoints/$MODEL

python scripts/prepare_ui_gen_data.py --csv_path data.csv --destination_path $MODEL/data/csv --checkpoint_dir checkpoints/$MODEL --test_split_fraction 0.01 --seed 42 --mask_inputs false --ignore_index -1

nohup python finetune/lora.py --precision 32-true --quantize bnb.nf4 --checkpoint_dir checkpoints/$MODEL --out_dir output/code-gen-ui --data_dir $MODEL/data/csv &
Clone this wiki locally