AlphaLoRA: Assigning LoRA Experts Based on Layer Training Quality
Welcome to the official GitHub repository for our paper, "AlphaLoRA: Assigning LoRA Experts Based on Layer Training Quality."
Clone the repository
git clone https://github.com/peijunallin/alphalora.git cd alphaloraInstall dependencies
conda create -n alphalora python=3.10 -y conda activate alphalora pip install -r requirements.txtDetermine number of experts and Top K
Run the
expert_number.pyscript to get the number of experts and the top_k parameters:CUDA_VISIBLE_DEVICES=3 python expert_number.py \ --model "mistralai/Mistral-7B-v0.1" \ --target_sum 160 \ --beta 2.5Train on six datasets
bash run_all.shBefore running the script, ensure to adjust the following hyperparameters in
run_all.sh:Hyperparameters Description base_modelThe path to the base model. root_data_pathThe path to the six datasets. number_expertsThe number of experts for each layer (32 numbers). top_kThe top K value for each layer (32 numbers). output_dirThe directory path to save the LoRA experts' weights. Evaluate on six datasets
Ensure that
mola_weightscorresponds to theoutput_dirused during training, and keep the expert number and top_K settings consistent.bash eval_all.sh
Acknowlegements
Our code is based on MoLA and TempBalance.