Repository navigation
test(hf): pin the import-order-independent Optimum GPTQ bridge (#4749) - #4779
Merged
Merged
Conversation
#4771 fixed #4749 - the Optimum GPTQ bridge is now retried from Transformers' `GptqHfQuantizer` hooks instead of being latched off when `optimum.gptq` is observed mid-initialization - but it shipped without a test. Nothing in the suite distinguishes "Optimum is not installed" from "optimum.gptq is importing gptqmodel right now", which is exactly the state that silently decoded every `dynamic` override with the global bits (NLL 3.45 -> 16.49, no error, no warning). Three tests pin the contract of `_ensure_optimum_gptqmodel_load_bridge`: * a stand-in `optimum.gptq` that has no `GPTQQuantizer` yet (the real import window) must return `False` and must **not** set `_OPTIMUM_GPTQ_BRIDGE_UNAVAILABLE`, so the retry stays possible; * once the class appears, the same call must install the bridge, set `_OPTIMUM_GPTQ_BRIDGE_INSTALLED`, wrap `convert_model`/`post_init_model`, and stay idempotent on a second call; * a genuinely missing Optimum (find_spec -> None) must set the sticky `_OPTIMUM_GPTQ_BRIDGE_UNAVAILABLE` latch so a load does not retry the failed import. Verified: all three fail on the pre-#4771 tree (`9a63019a8`, where the retry path and its state flags do not exist yet) and `tests/test_hf_gptqmodel_load_bridge.py` passes 30/30 on current main. Test-only, no production change.
Qubitium
force-pushed
the
root/optimum-bridge-4749
branch
from
November 17, 2026 14:49
59c9a92 to
eec605b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
test(hf): pin the import-order-independent Optimum GPTQ bridge (#4749)
#4771 fixed #4749 - the Optimum GPTQ bridge is now retried from Transformers'
GptqHfQuantizerhooks instead of being latched off whenoptimum.gptqisobserved mid-initialization - but it shipped without a test. Nothing in the
suite distinguishes "Optimum is not installed" from "optimum.gptq is importing
gptqmodel right now", which is exactly the state that silently decoded every
dynamicoverride with the global bits (NLL 3.45 -> 16.49, no error, nowarning).
Three tests pin the contract of
_ensure_optimum_gptqmodel_load_bridge:optimum.gptqthat has noGPTQQuantizeryet (the real importwindow) must return
Falseand must not set_OPTIMUM_GPTQ_BRIDGE_UNAVAILABLE, so the retry stays possible;_OPTIMUM_GPTQ_BRIDGE_INSTALLED, wrapconvert_model/post_init_model, andstay idempotent on a second call;
_OPTIMUM_GPTQ_BRIDGE_UNAVAILABLElatch so a load does not retry the failedimport.
Verified: all three fail on the pre-#4771 tree (
9a63019a8, where the retrypath and its state flags do not exist yet) and
tests/test_hf_gptqmodel_load_bridge.pypasses 30/30 on current main. Test-only, no production change.