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

Support finetuning with LoRA #431

Merged
merged 9 commits into from
Sep 6, 2023
Merged

Conversation

katalinic-gc
Copy link
Collaborator

@katalinic-gc katalinic-gc commented Jun 26, 2023

What does this PR do?

To enable it, apply below, which is basically identical to upstream.

config = LoraConfig(
    r=16, 
    lora_alpha=32, 
    target_modules=["q_proj", "v_proj"], 
    lora_dropout=0.05, 
    bias="none"
)
model = get_peft_model(model, config)
model.print_trainable_parameters()

Some online finetuning walkthroughs also include

    remove_unused_columns=False,  # required as the PeftModel forward doesn't have the signature of the wrapped model's forward
    label_names=["labels"],  # same reason as above

to the training args, e.g. (IPU)Seq2SeqTrainingArguments.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@katalinic-gc katalinic-gc changed the title Minimal support for Whisper finetuning with LoRA Whisper finetuning with LoRA Jul 5, 2023
@rrva
Copy link

rrva commented Aug 20, 2023

@katalinic-gc I would like to use this to finetune whisper-large-v2 on a fairly large dataset (700k examples). Is this usable as is (if I fix the merge conflicts)? What steps from https://www.graphcore.ai/posts/fine-tune-openais-whisper-automatic-speech-recognition-asr-model would need to be different with this approach?

@katalinic-gc
Copy link
Collaborator Author

@katalinic-gc I would like to use this to finetune whisper-large-v2 on a fairly large dataset (700k examples). Is this usable as is (if I fix the merge conflicts)? What steps from https://www.graphcore.ai/posts/fine-tune-openais-whisper-automatic-speech-recognition-asr-model would need to be different with this approach?

It won't be usable for large on IPUs due to OOM. We are internally working on supporting that; if and when available, we'll announce it.

@katalinic-gc katalinic-gc marked this pull request as ready for review September 6, 2023 17:15
@katalinic-gc katalinic-gc changed the title Whisper finetuning with LoRA Support finetuning with LoRA Sep 6, 2023
@katalinic-gc katalinic-gc merged commit 8c4a1dd into huggingface:main Sep 6, 2023
2 of 3 checks passed
@katalinic-gc katalinic-gc deleted the lora branch September 6, 2023 18:40
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.

3 participants