Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/mcore_bridge/bridge/gpt_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ 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:
Expand Down Expand Up @@ -1703,7 +1704,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:
kv = converter(k, v)
if kv is None:
continue
Expand Down
Loading