1
0
Fork 0
mirror of https://github.com/p-e-w/heretic.git synced 2026-12-03 18:42:57 +07:00

[GH-ISSUE #145] [Release blocker] Merging LoRA adapter on export fails for gpt-oss-20b #87

Closed
opened 2026-11-01 04:17:22 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @p-e-w on GitHub (Feb 11, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/145

Originally created by @p-e-w on GitHub (Feb 11, 2026). Original GitHub issue: https://github.com/p-e-w/heretic/issues/145
bsakaguchi 2026-11-01 04:17:22 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@p-e-w commented on GitHub (Feb 11, 2026):

Root cause:

│ /usr/local/lib/python3.12/dist-packages/heretic/main.py:755 in run                               │
│                                                                                                  │
│   752 │   │   │   │   │   │   │   else:                                                          │
│   753 │   │   │   │   │   │   │   │   print("Saving merged model...")                            │
│   754 │   │   │   │   │   │   │   │   merged_model = model.get_merged_model()                    │
│ ❱ 755 │   │   │   │   │   │   │   │   merged_model.save_pretrained(save_directory)               │
│   756 │   │   │   │   │   │   │   │   del merged_model                                           │
│   757 │   │   │   │   │   │   │   │   empty_cache()                                              │
│   758                                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.12/dist-packages/transformers/modeling_utils.py:3302 in save_pretrained   │
│                                                                                                  │
│   3299 │   │                                                                                     │
│   3300 │   │   # Revert all renaming and/or weight operations                                    │
│   3301 │   │   if save_original_format and not _hf_peft_config_loaded:                           │
│ ❱ 3302 │   │   │   state_dict = revert_weight_conversion(model_to_save, state_dict)              │
│   3303 │   │                                                                                     │
│   3304 │   │   # Shard the model if it is too big.                                               │
│   3305 │   │   if not _hf_peft_config_loaded:                                                    │
│                                                                                                  │
│ /usr/local/lib/python3.12/dist-packages/transformers/core_model_loading.py:1254 in               │
│ revert_weight_conversion                                                                         │
│                                                                                                  │
│   1251 │   │   return state_dict                                                                 │
│   1252 │                                                                                         │
│   1253 │   # Reverse all Transform to correctly match keys                                       │
│ ❱ 1254 │   reverse_weight_conversion = [conversion.reverse_transform() for conversion in weight  │
│   1255 │   # If we are still here, we need to create the (reverse) conversion mapping from scra  │
│   1256 │   renamings = [entry for entry in reverse_weight_conversion if isinstance(entry, Weigh  │
│   1257 │   converters = [entry for entry in reverse_weight_conversion if isinstance(entry, Weig  │
│                                                                                                  │
│ /usr/local/lib/python3.12/dist-packages/transformers/core_model_loading.py:616 in                │
│ reverse_transform                                                                                │
│                                                                                                  │
│    613 │   │   # Add the reverse ops if applicable (it needs to be provided at __init__)         │
│    614 │   │   if hasattr(self, "operations"):                                                   │
│    615 │   │   │   # All reverse ops, in reverse order                                           │
│ ❱  616 │   │   │   kwargs["operations"] = [op.reverse_op for op in self.operations[::-1]]        │
│    617 │   │                                                                                     │
│    618 │   │   reverse_transform = self.__class__(                                               │
│    619 │   │   │   source_patterns=self.target_patterns, target_patterns=self.source_patterns,   │
│                                                                                                  │
│ /usr/local/lib/python3.12/dist-packages/transformers/core_model_loading.py:100 in reverse_op     │
│                                                                                                  │
│     97 │                                                                                         │
│     98 │   @property                                                                             │
│     99 │   def reverse_op(self) -> ConversionOps:                                                │
│ ❱  100 │   │   raise NotImplementedError                                                         │
│    101                                                                                           │
│    102                                                                                           │
│    103 class Chunk(ConversionOps):                                                               │

NotImplementedError

This looks bad. I hope this doesn't mean LoRAs just don't work with MXFP4 weights.

<!-- gh-comment-id:3884074459 --> @p-e-w commented on GitHub (Feb 11, 2026): Root cause: ``` │ │ /usr/local/lib/python3.12/dist-packages/heretic/main.py:755 in run │ │ │ │ 752 │ │ │ │ │ │ │ else: │ │ 753 │ │ │ │ │ │ │ │ print("Saving merged model...") │ │ 754 │ │ │ │ │ │ │ │ merged_model = model.get_merged_model() │ │ ❱ 755 │ │ │ │ │ │ │ │ merged_model.save_pretrained(save_directory) │ │ 756 │ │ │ │ │ │ │ │ del merged_model │ │ 757 │ │ │ │ │ │ │ │ empty_cache() │ │ 758 │ │ │ │ /usr/local/lib/python3.12/dist-packages/transformers/modeling_utils.py:3302 in save_pretrained │ │ │ │ 3299 │ │ │ │ 3300 │ │ # Revert all renaming and/or weight operations │ │ 3301 │ │ if save_original_format and not _hf_peft_config_loaded: │ │ ❱ 3302 │ │ │ state_dict = revert_weight_conversion(model_to_save, state_dict) │ │ 3303 │ │ │ │ 3304 │ │ # Shard the model if it is too big. │ │ 3305 │ │ if not _hf_peft_config_loaded: │ │ │ │ /usr/local/lib/python3.12/dist-packages/transformers/core_model_loading.py:1254 in │ │ revert_weight_conversion │ │ │ │ 1251 │ │ return state_dict │ │ 1252 │ │ │ 1253 │ # Reverse all Transform to correctly match keys │ │ ❱ 1254 │ reverse_weight_conversion = [conversion.reverse_transform() for conversion in weight │ │ 1255 │ # If we are still here, we need to create the (reverse) conversion mapping from scra │ │ 1256 │ renamings = [entry for entry in reverse_weight_conversion if isinstance(entry, Weigh │ │ 1257 │ converters = [entry for entry in reverse_weight_conversion if isinstance(entry, Weig │ │ │ │ /usr/local/lib/python3.12/dist-packages/transformers/core_model_loading.py:616 in │ │ reverse_transform │ │ │ │ 613 │ │ # Add the reverse ops if applicable (it needs to be provided at __init__) │ │ 614 │ │ if hasattr(self, "operations"): │ │ 615 │ │ │ # All reverse ops, in reverse order │ │ ❱ 616 │ │ │ kwargs["operations"] = [op.reverse_op for op in self.operations[::-1]] │ │ 617 │ │ │ │ 618 │ │ reverse_transform = self.__class__( │ │ 619 │ │ │ source_patterns=self.target_patterns, target_patterns=self.source_patterns, │ │ │ │ /usr/local/lib/python3.12/dist-packages/transformers/core_model_loading.py:100 in reverse_op │ │ │ │ 97 │ │ │ 98 │ @property │ │ 99 │ def reverse_op(self) -> ConversionOps: │ │ ❱ 100 │ │ raise NotImplementedError │ │ 101 │ │ 102 │ │ 103 class Chunk(ConversionOps): │ NotImplementedError ``` This looks bad. I hope this doesn't mean LoRAs just don't work with MXFP4 weights.
Author
Owner

@mspark0 commented on GitHub (Feb 12, 2026):

Now I'm not guru, but, I think the guys from Unsloth had this issue a while back... Maybe their github threads could shed some light?

<!-- gh-comment-id:3888488902 --> @mspark0 commented on GitHub (Feb 12, 2026): Now I'm not guru, but, I think the guys from Unsloth had this issue a while back... Maybe their github threads could shed some light?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
p-e-w/heretic#87
No description provided.