Repository navigation
Forward the model argument through update_weight_conversions overrides (transformers 5.21+) - #16559
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
[skip ci]
…ers does [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
transformers 5.21 changed the quantizer hook to
HfQuantizer.update_weight_conversions(self, weight_conversions, model), andconversion_mapping.get_model_conversion_mappingnow passes the model on every quantized load. Three Unsloth overrides still took one argument, so on transformers 5.21+ they raiseTypeError: ... takes 2 positional arguments but 3 were given:UnslothBnb4BitHfQuantizer(compressed_tensors_bnb.py) andUnslothFp8ToNf4Bnb4BitHfQuantizer(fp8_to_nf4.py):bitsandbytes_4biton the first compressed-tensors or fp8-to-NF4 load, and stay registered;mistral_format.py.The current
transformers<=5.17.0pin hides this; anyone on 5.21+ hits it.Change
Each override now takes
(weight_conversions, *args, **kwargs)and passes the extra arguments on to the parent. transformers 5.8 to 5.20, which call the hook with one argument, behave exactly as before.Three existing tests called the hook with one argument, which is the pre-5.21 contract, so they failed on 5.21+ on main as well. They now call it the way the installed transformers does:
test_compressed_tensors_bnb.py::test_the_planner_pass_does_not_consume_the_plantest_compressed_tensors_bnb.py::test_armed_conversions_still_run_a_composed_subclass_hooktest_k3_mxfp4_stacked_experts.py::test_a_kept_packed_load_registers_no_decompress_opTests
New
tests/test_quantizer_update_weight_conversions_model.py(CPU):TypeErrorabove)The three updated tests pass on 5.17 and 5.22 with compressed-tensors 0.19 installed.
Real GPU, one Kaggle T4, base vs this branch, one fresh process per arm,
Qwen3-0.6Bcheckpoints:2.3597, 2.3664, 2.1877) give identical results on main and this branch.Not covered