Skip to content

FIX Issues with transformer weight conversion code - #3127

Merged
BenjaminBossan merged 1 commit into
huggingface:mainfrom
BenjaminBossan:fix-issues-transformers-weight-conversion-qwen
Apr 2, 2026
Merged

BenjaminBossan merged 1 commit into
huggingface:mainfrom
BenjaminBossan:fix-issues-transformers-weight-conversion-qwen

Conversation

@BenjaminBossan

Copy link
Copy Markdown
Member

As notified here:

Two issues:

First we assumed that if get_checkpoint_conversion_mapping returns something, we always have an entry in _MOE_TARGET_MODULE_MAPPING. This assumption is no longer being made.

Second, during handling of an error message, we would subtract a set from a list. This was missed because the type of the first argument used to be a set but was changed to list. Now we correctly subtract sets.

Note that the trl will still fail because the LoRA config is configured to only target the up_proj, not the gate_proj. This no longer works as transformers fuses these two. The aforementioned error message was caused by this inconsistency.

As notified here:

- huggingface/trl#5428
- huggingface/trl#5429

Two issues:

First we assumed that if get_checkpoint_conversion_mapping returns
something, we always have an entry in _MOE_TARGET_MODULE_MAPPING. This
assumption is no longer being made.

Second, during handling of an error message, we would subtract a set
from a list. This was missed because the type of the first argument used
to be a set but was changed to list. Now we correctly subtract sets.

Note that the trl will still fail because the LoRA config is configured
to only target the up_proj, not the gate_proj. This no longer works as
transformers fuses these two. The aforementioned error message was
caused by this inconsistency.
@BenjaminBossan

Copy link
Copy Markdown
Member Author

@albertvillanova

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@BenjaminBossan

Copy link
Copy Markdown
Member Author

Note: failing tests are unrelated.

@albertvillanova albertvillanova left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes.

I confirm that KeyError and TypeError are no longer raised in trl after this fix.

@BenjaminBossan
BenjaminBossan merged commit e7355a3 into huggingface:main Apr 2, 2026
2 of 10 checks passed
@BenjaminBossan
BenjaminBossan deleted the fix-issues-transformers-weight-conversion-qwen branch April 2, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants