-
Notifications
You must be signed in to change notification settings - Fork 11
Test #26
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
Test #26
Changes from 2 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -267,7 +267,7 @@ def _set_module(self, mg_module, hf_state_dict, hf_prefix: str, to_mcore: bool): | |||||
| new_state_dict = {} | ||||||
| for k, v in hf_state_dict.items(): | ||||||
| if self._peft_format: | ||||||
| if '.lora_A.' in k or '.lora_B.' in k or '.modules_to_save.' in k: | ||||||
| if ('.lora_A.' in k or '.lora_B.' in k or '.modules_to_save.' in k) and f'{self._adapter_name}.' in k: | ||||||
| k = k.replace(f'{self._adapter_name}.', '') | ||||||
| new_state_dict[k] = v | ||||||
| else: | ||||||
|
|
@@ -1703,7 +1703,7 @@ def export_weights( | |||||
| self.config = mg_models[0].config | ||||||
| with torch.no_grad(): | ||||||
| for k, v in self._convert(mg_models, {}, hf_prefix, False, tqdm_desc=tqdm_desc): | ||||||
| if converter: | ||||||
| if converter and v is not None: | ||||||
|
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. Skipping the
Suggested change
|
||||||
| kv = converter(k, v) | ||||||
| if kv is None: | ||||||
| continue | ||||||
|
|
||||||
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.
The check
f'{self._adapter_name}.' in kis potentially too broad and could lead to incorrect matches if one adapter name is a prefix of another (e.g.,defaultanddefault_new). Since keys are dot-separated, it is safer to include the leading dot in the check to ensure it matches the specific adapter component.