-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[bugfix] fix megatron seq_cls lora bridge #7054
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 all commits
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 |
|---|---|---|
|
|
@@ -1432,6 +1432,8 @@ def save_weights(self, mg_models, output_dir: str, is_peft_format: bool = False) | |
| if is_peft_format: | ||
| from swift.llm import get_multimodal_target_regex | ||
| peft_config = copy(mg_models[0].peft_config[self._adapter_name]) | ||
| if args.task_type == 'seq_cls': | ||
| peft_config.task_type = 'SEQ_CLS' | ||
|
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. For better maintainability and to avoid potential issues with string literals, it's recommended to use the To implement this, you would add peft_config.task_type = TaskType.SEQ_CLS |
||
| if args.is_multimodal and 'all-linear' in args.target_modules: | ||
| peft_config.target_modules = get_multimodal_target_regex( | ||
| self.hf_model, | ||
|
|
||
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.
This log message will be printed by all ranks in a distributed environment, which can lead to cluttered logs. It's better to guard this with a rank check, similar to the log message on line 135 (
logger.info_if(..., cond=is_last_rank())), to ensure the message is printed only once.