Fix: prevent load_in_fp8 kwarg from reaching Qwen3MoeForCausalLM constructor (Fix #3649) #3654
+2
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
This PR fixes the issue reported in #3649 where calling:
TypeError: Qwen3MoeForCausalLM.init() got an unexpected keyword argument 'load_in_fp8'
The problem was that load_in_fp8 was an internal flag for Unsloth, but it was still being passed to the Hugging Face model constructor and models like Qwen3MoeForCausalLM do not accept that argument -->which caused the crash.
What I changed
The parameter is now removed from the location where the model is passed to the HF loader:
load_in_fp8 = kwargs.pop("load_in_fp8", None)I kept the value around if it's needed later, but it no longer gets to the HF constructor.
Notes
I don’t have FP8 hardware to perform a full training run, so the fix is based on the reading the execution path and matching it with the similar logic that’s already implemented in the codebase fixes (like the change in PR #3621).
if additional adjustments are needed, I’m happy to update the PR.
Fixes #3649