Skip to content

Fine‐tune LLM

Kannan Ramamoorthy edited this page Oct 31, 2023 · 9 revisions

Initial Setup

This is needed only the first time

python -m pip install --upgrade pip
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="openlm-research/open_llama_3b"

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 data/csv --checkpoint_dir checkpoints/$MODEL --test_split_fraction 0.1 --seed 42 --mask_inputs false --ignore_index -1

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