Skip to content

fix(loader): treat a None placement kwarg as absent - #6676

Merged
Qubitium merged 1 commit into
mainfrom
fix/none-placement-kwargs
Dec 1, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/none-placement-kwargs

Conversation

@Qubitium

@Qubitium Qubitium commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

_reject_accelerate_placement_kwargs rejected any occurrence of the removed
Accelerate keys, including None. A None value is not a placement request,
and integrations pass their defaults through unconditionally: evalution 0.0.17
calls

GPTQModel.load(..., device_map=None, revision=None)

from evalution.engines.gptqmodel_engine, so every evalution-backed evaluation
failed before the model was read:

TypeError: GPTQModel.load() does not accept `device_map`: GPT-QModel does not
consume Accelerate's placement arguments.

This is red on main for tests/test_eval_runtime.py::TestEvalRuntime::test_eval_direct
and for the evalution-backed integration tests (test_simple_quant.py,
test_eval.py, test_mmlupro.py, test_quant_and_eora.py).

What Changed

  • gptqmodel/models/loader.py: keep the loud TypeError for every actual
    placement value, but drop None entries instead of rejecting them, so the
    removed vocabulary never reaches Transformers.
  • tests/test_accelerate_isolation.py: pin both halves: None keys are
    removed, and each non-None value still raises.

No behavior changes for real placement requests; device_map=None is
equivalent to not passing the argument.

Tests

New regression test, red on main and green on the PR:

PYTHONPATH=$PWD CUDA_VISIBLE_DEVICES="" \
  /root/venv/bin/python -P -m pytest -p no:cacheprovider -q \
  tests/test_accelerate_isolation.py::test_none_placement_kwargs_are_not_accelerate_requests
# main: 1 failed (TypeError from _reject_accelerate_placement_kwargs)
# PR:   1 passed

With the fix, test_eval_runtime.py::TestEvalRuntime::test_eval_direct gets
past the device_map rejection and reaches dataset loading (it then fails in
this offline sandbox because allenai/ai2_arc is not cached under the temporary
HF home; no GPU is available here either). The TypeError is gone.

Full affected sets on the PR head:

PYTHONPATH=$PWD CUDA_VISIBLE_DEVICES="" \
  /root/venv/bin/python -P -m pytest -p no:cacheprovider -q \
  tests/test_accelerate_isolation.py tests/test_local_model_paths.py \
  tests/test_eval_loader_args.py tests/test_eval_batch_size.py
# 60 passed

bash format/check.sh   # All checks passed! (ruff 0.14.2)
  • Unit tests have been executed and passed, or the reason they are not applicable is documented.
  • I added a new simple/fast unit test for this change, or documented why that is not applicable.

Measured Impact

Not applicable: no VRAM, performance, or accuracy path changed.

Model Support / Module Plan

Not applicable: no model definition or module plan changed.

AWQ onboarding safety

Not applicable: no AWQ code changed.

Logic Flow Documentation

Not applicable: the change only narrows an argument guard; it does not alter a
resolution or selection flow.

Review Requirements

  • Reviewed this PR.
  • Checked that the code matches existing project structure, APIs, and conventions.
  • Avoided unnecessary monkeypatching and used the project's normal extension points where possible.
  • Minimized and compacted the impacted code surface.
  • Considered and eliminated potential regressions.

Kernel Accuracy Requirements

Not applicable: no kernel changed.

Notes

The alternative was to change evalution, but it is an external package and the
None default is a reasonable wrapper convention. The existing docstring in
tests/test_local_model_paths.py already describes the intended contract as
"any non-None map".

🤖 Generated with Claude Code

_reject_accelerate_placement_kwargs rejected any occurrence of device_map/max_memory/offload_* even when the value was None. None is not a placement request, and evalution's GPTQModel engine passes its default device_map=None unconditionally, so every evalution-backed evaluation failed before loading the model.

Keep the loud TypeError for real values and drop the None entries so they never reach Transformers. The existing docstring already describes the contract as "any non-None map".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Qubitium
Qubitium marked this pull request as ready for review December 1, 2026 17:47
@Qubitium
Qubitium merged commit c68c092 into main Dec 1, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/none-placement-kwargs branch December 1, 2026 17:47
Qubitium added a commit that referenced this pull request Dec 1, 2026
…#6682)

The test requires chat-template ARC-Challenge acc_norm >= 0.34, but the same checkpoint has scored 0.3378839590443686 on GPU 3 since at least 4c5d902 (Oct 1): identical at aff56aa (parent of the device_map=None rejection), d2dfb93 (Transformers 5.23 port), 0071b1a (pre-port) and with #6676. The 0.34 floor is 0.15 binomial SE above the observed score (n=1172, SE=0.0138), so it is not a meaningful quality gate.

The commented 0.3515 is the raw-prompt acc, not the chat-template acc_norm: the same checkpoint scores 0.3771 acc_norm without the chat template and 0.3379 with it; the backend spread with the chat template is only 0.17 points (Marlin 0.3379 vs ExLlamaV2/Torch 0.3396).

Set the floor to 0.32 (1.3 SE below the observed score, just above the 95% one-sided lower bound 0.315) and record the measurements so the next adjustment is evidence-based.

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant