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

[LLM] Add Prefix Tuning, PTuning, LoRA, AdaLoRA and Adaption Prompt for LLM fine-tuning #3386

Merged
merged 38 commits into from
May 16, 2023

Conversation

tgaddair
Copy link
Collaborator

@tgaddair tgaddair commented May 6, 2023

This PR adds support for parameter efficient fine-tuning strategies like Prefix Tuning, PTuning, LoRA, AdaLoRA and Adaption Prompt.

To use them in Ludwig with the LLM model types, you need to specify the strategy name in the adapter config:

  • Prompt Tuning: prompt_tuning
  • Prefix Tuning: prefix_tuning
  • P-Tuning: p_tuning
  • LoRA: lora
  • AdaLoRA: adalora
  • Adaption Prompt: adaption_prompt

Here's an example config:

model_type: llm
model_name: facebook/opt-66b
tuner: lora

Things to note:

  1. Prompt Tuning, Prefix Tuning and PTuning require the num_virtual_tokens parameter to be set to a non-zero value
  2. Lora is only supported for the following model types: t5, mt5, bart, opt, roberta and deberta-v2
  3. Adaption Prompt is only supported for Llama model types and requires adapter_len and adapter_layers parameters to be set.

Co-authored by @arnavgarg1

@github-actions
Copy link

github-actions bot commented May 7, 2023

Unit Test Results

    6 files  ±0    6 suites  ±0   1h 31m 56s ⏱️ + 16m 12s
  33 tests ±0  28 ✔️  - 1    4 💤 ±0  0 ±0  1 🔥 +1 
100 runs  +1  87 ✔️ ±0  12 💤 ±0  0 ±0  1 🔥 +1 

For more details on these errors, see this check.

Results for commit 29b6b0c. ± Comparison against base commit e2cde3a.

♻️ This comment has been updated with latest results.

@arnavgarg1 arnavgarg1 changed the title Added LoRA for LLM fine-tuning Added Prefix Tuning, PTuning, LoRA, AdaLoRA and Adaption Prompt for LLM fine-tuning May 8, 2023
@arnavgarg1 arnavgarg1 self-requested a review May 8, 2023 17:49
@arnavgarg1 arnavgarg1 changed the title Added Prefix Tuning, PTuning, LoRA, AdaLoRA and Adaption Prompt for LLM fine-tuning [LLM] Added Prefix Tuning, PTuning, LoRA, AdaLoRA and Adaption Prompt for LLM fine-tuning May 9, 2023
@arnavgarg1 arnavgarg1 changed the title [LLM] Added Prefix Tuning, PTuning, LoRA, AdaLoRA and Adaption Prompt for LLM fine-tuning [LLM] Add Prefix Tuning, PTuning, LoRA, AdaLoRA and Adaption Prompt for LLM fine-tuning May 15, 2023
@tgaddair
Copy link
Collaborator Author

LGTM!

@tgaddair tgaddair merged commit cf250bc into master May 16, 2023
13 of 15 checks passed
@tgaddair tgaddair deleted the llm-lora branch May 16, 2023 00:09
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.

None yet

2 participants