Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add corresponding lora finetuning with config scripts #343

Merged
merged 9 commits into from
Oct 23, 2024

Conversation

notoookay
Copy link
Contributor

Hi, I don't know if it's necessary. I added the corresponding lora fine-tune scripts with config. These scripts work for the same purpose as scripts/finetune_with_accelerate_config.sh. The main changes include:

  • Add lora and qlora fine-tune scripts with the config file.
  • merge_lora is modified to be compatible with both scripts using config and old scripts, so the old scripts like scripts/finetune_lora_with_accelerate.sh still work.
  • During merging, base_model will be loaded as bfloat16 if it was trained by lora. I found merged model dtype changed from bfloat16 to float32. The dtype is normal for qlora. I think you forgot to add torch_dtype=torch.bfloat16 for lora.
  • Add config files (tulu2_7b_lora.yaml and tulu2_7b_qlora.yaml) as examples.

I have tested scripts using lora, qlora was not tested but should work fine.

@notoookay
Copy link
Contributor Author

notoookay commented Sep 11, 2024

Please don't merge, there’s a bug during qlora merge. Working on it.

@notoookay
Copy link
Contributor Author

Now it should work for both lora and qlora settings.

  • Modify default pad_to_multiple_of to 8 in merge_lora.py, aligning with the setting in fine_tune.py.

@notoookay notoookay changed the title add corresponding lora finetuning with config scripts Add corresponding lora finetuning with config scripts Sep 12, 2024
Copy link
Collaborator

@natolambert natolambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for helping with maitenance!

@natolambert natolambert merged commit 6bd9da6 into allenai:main Oct 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants