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

Train parameters exclusively in specific ranges #1390

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

seungduk-yanolja
Copy link
Contributor

@seungduk-yanolja seungduk-yanolja commented Mar 11, 2024

Train parameters exclusively in specific ranges

Description

This PR enables the freezing configuration to specify parameter ranges so that we can ignore gradients for specific tokens.
For more details, please take a look at this technical report.
https://arxiv.org/abs/2402.14714

Motivation and Context

When some tokens are added to the vocab, we may want to train only those specific tokens. For example, while fine-tuning, imagine you want to train specific control tokens only.
This technique can be also used when expanding the vocabulary for non-English languages.

How has this been tested?

I wrote unit tests for it.

Screenshots (if appropriate)

N/A

Types of changes

New feature (non-breaking change which adds functionality)

@@ -16,12 +16,12 @@ output_dir: ./qlora-out

## You can optionally freeze the entire model and unfreeze a subset of parameters
unfrozen_parameters:
# - lm_head.*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous example was technically wrong (but worked) because this becomes the following:
lm_head\.* and checks if the dot repeats 0+ times

Copy link
Collaborator

@winglian winglian left a comment

Choose a reason for hiding this comment

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

thanks!

@winglian winglian merged commit 05bcc9e into axolotl-ai-cloud:main Mar 14, 2024
6 checks passed
seungduk-yanolja added a commit to Y-IAB/axolotl that referenced this pull request Mar 19, 2024
* Train parameters exclusively in specific ranges

* Fix the style and update docs

* Update yaml example
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