-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
[Misc][LoRA] Add --lora-target-modules to restrict LoRA to specific modules #34984
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
Changes from 7 commits
255125d
2ac7621
18d2edc
8dce456
1af3a6d
c183eec
5aba606
c61fbc3
8a51df3
40c77b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,6 +130,32 @@ def _load_adapter(self, lora_request: LoRARequest) -> LoRAModel: | |
| skip_prefixes=lora_skip_prefixes, | ||
| ) | ||
|
|
||
| # Warn about adapter modules that will be ignored. | ||
| # Use the same suffix-matching logic as _match_target_modules: | ||
| # take the last segment of the dot-separated module name. | ||
| target_modules = self.lora_config.target_modules | ||
| for module_name in lora.loras: | ||
| module_suffix = module_name.split(".")[-1] | ||
| if module_suffix not in supported_lora_modules: | ||
| logger.warning_once( | ||
| "LoRA module '%s' in adapter '%s' is not in the " | ||
| "model's supported LoRA target modules [%s]. " | ||
| "These parameters will be ignored, which may " | ||
| "cause abnormal model behavior.", | ||
| module_name, | ||
| lora_request.lora_path, | ||
| ", ".join(sorted(supported_lora_modules)), | ||
| ) | ||
| elif target_modules is not None and module_suffix not in target_modules: | ||
| logger.warning_once( | ||
| "LoRA module '%s' in adapter '%s' is not in the " | ||
| "deployment-time target_modules restriction [%s]. " | ||
| "These parameters will be ignored.", | ||
| module_name, | ||
| lora_request.lora_path, | ||
| ", ".join(sorted(target_modules)), | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the refactor @bhoomit . can we introduce a utility to do this check ? something like, this doesn't let us differentiate between what is not-supported and what is ignored. but I think that is fine. wdyt ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can do that. If we want to have two diff warnings, we will need two utility function. And they will be used by both these files. Will update with that change. Thanks |
||
|
|
||
| except FileNotFoundError as e: | ||
| # FileNotFoundError should be raised if both | ||
| # - No adapter found to download from huggingface (or in | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.