-
Notifications
You must be signed in to change notification settings - Fork 687
Add lora for mlp and unsloth #15132
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 lora for mlp and unsloth #15132
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15132
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Cancelled Job, 5 Unrelated FailuresAs of commit 4a7ba4d with merge base 6e0c9f6 ( NEW FAILURE - The following job has failed:
CANCELLED JOB - The following job was cancelled. Please retry:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
ab7e5f8
to
777dbd2
Compare
class LoRAFeedForward(nn.Module): | ||
def __init__(self, dim: int, hidden_dim: int, args: ModelArgs): | ||
super().__init__() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate that args.r and args.lora_alpha must be specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we inherit from FeedForward instead and just overwrite the constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have ConditionalFeedForward
and MOEFeedForward
as separate nn.Modules (inside llama_transformer.py), so it seemed fitting to have this separate, but let me know what you think. @jackzhxng
class LoRAFeedForward(nn.Module): | ||
def __init__(self, dim: int, hidden_dim: int, args: ModelArgs): | ||
super().__init__() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we inherit from FeedForward instead and just overwrite the constructor?
} | ||
|
||
|
||
def unsloth_to_meta(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like the file name is okay since this function is specifically named unsloth actually, follows the pattern for other models
f14397c
to
17c2df9
Compare
17c2df9
to
1770576
Compare
1770576
to
57977e0
Compare
57977e0
to
4a7ba4d
Compare
Summary
This PR introduces two features:
Test plan
Tested locally with unsloth-trained adapters.
Export:
Run with executorch fine-tune
Run with nobel prize winners finetune
Note: Llama 3.2 1B model was released on September 25, 2024, so it should not have this information.