hanxuhu / SeqIns

The repository of the project "Fine-tuning Large Language Models with Sequential Instructions", code base comes from open-instruct and LAVIS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SIT

SIT: Fine-tuning Large Language Models with Sequential Instructions

[Project Page] [Data] [Model Zoo]

This is the code to replicate the sequential instruction tuning experiments in the paper SIT: Fine-tuning Large Language Models with Sequential Instructions. [cite]

Our implementation is based on the Open-Instruct and LAVIS repository.

SIT

Setup

For text-only experiments

#Prepare enviornment
conda create -n seq_ins python=3.8
conda activate seq_ins
bash setup.sh

For vision-language experiments

cd LAVIS
conda create -n seq_ins_vl python=3.8
conda activate seq_ins_vl
pip install -e .

Next, prepare train and eval data: You can download sequential instruction data for training here, then move it to self-seq/data/ And you can download evaluation data by running:

bash scripts/prepare_eval_data.sh

for vision-langauge data:

cd LAVIS
bash download_vqa.sh

Generation SIT data

Convert original instruction tuning dataset to sequential version:

bash self-seq/scripts/generation_flancot_llama_70b.sh

Train

To train both sequential instruction and original instruction data, you can specify your preferred LLM, path of training dataset at scripts/alpaca/finetune_accelerate_sit_llama_70b.sh and running:

bash scripts/alpaca/finetune_accelerate_sit_llama_70b.sh

Train on vision-langauge data, you can first specify the pre-trained checkpoint at ./LAVIS/lavis/configs/models/blip2

then you can firstly specify the output models path at ./LAVIS/lavis/projects/instructblip/caption_coco_vicuna7b_train.yaml, then

bash run_scripts/blip2/train/eval_instruct_caption_coco.sh

Eval

First, you should prepare evaluation datasets:

bash scripts/prepare_eval_data.sh

Then, you can run eval of all general and sequential tasks, please replace YOUR_MODEL_NAME as the path of your trained models

bash scripts/evaluation.sh YOUR_MODEL_NAME

Citation

Please consider citing us if you use our materials.

@article{hu2024fine,
  title={Fine-tuning Large Language Models with Sequential Instructions},
  author={Hu, Hanxu and Yu, Simon and Chen, Pinzhen and Ponti, Edoardo M},
  journal={arXiv preprint arXiv:2403.07794},
  year={2024}
}

About

The repository of the project "Fine-tuning Large Language Models with Sequential Instructions", code base comes from open-instruct and LAVIS


Languages

Language:Jupyter Notebook 82.0%Language:Python 17.8%Language:Shell 0.2%Language:Batchfile 0.0%Language:Makefile 0.0%