add Moslora#9331
Merged
Merged
Conversation
|
Thanks for your contribution! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #9331 +/- ##
===========================================
+ Coverage 52.91% 53.10% +0.19%
===========================================
Files 679 685 +6
Lines 108433 108855 +422
===========================================
+ Hits 57378 57810 +432
+ Misses 51055 51045 -10 ☔ View full report in Codecov by Sentry. |
lugimzzz
reviewed
Nov 21, 2024
| return | ||
|
|
||
| weight = state_dict.pop(name + ".weight") | ||
| lora_use_mixer = (lora_state_dict is not None and name + ".lora_AB" in lora_state_dict) or ( |
Contributor
There was a problem hiding this comment.
建议lora_use_mixer直接从lora_config读取不要用state dict的key判断
| lora_AB = lora_AB.astype("float32") | ||
| out = (weight + lora_A @ lora_AB @ lora_B * scaling).astype("bfloat16") | ||
| else: | ||
| out = (weight + lora_A @ lora_B * scaling).astype("bfloat16") |
Contributor
There was a problem hiding this comment.
这里astype改成lora_config里的dtype,原本写的有问题
| lora_plus_scale: float = field(default=1.0, metadata={"help": "Lora B scale in LoRA+ technique"}) | ||
| pissa: bool = field(default=False, metadata={"help": "Whether to use Pissa: https://arxiv.org/pdf/2404.02948.pdf"}) | ||
| lora_use_mixer: bool = field( | ||
| default=False, metadata={"help": "Whether to use MosLoRA: https://arxiv.org/pdf/2406.11909"} |
| pissa=lora_config.pissa, | ||
| bias_attr=False if module.bias is None else None, | ||
| use_quick_lora=lora_config.use_quick_lora, | ||
| lora_use_mixer=lora_config.lora_use_mixer, |
Contributor
There was a problem hiding this comment.
在loramodel的init里if (tensor_parallel_degree >1 or pipeline_parallel_degree > 1) and lora_config.lora_use_mixer: raise NotImplementError("xxx")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
add moslora at peft/lora
Description
add moslora method