Repository navigation
fix(load): accept the Hub staging options a quantized load forwards (#5007) - #5016
Merged
Merged
Conversation
…5007) #4972 rejected every keyword left in `kwargs_without_internal` after the explicit pops, but the Hub staging options (`token`, `max_workers`, `local_dir`, `endpoint`, `headers`, `etag_timeout`, `allow_patterns`, `ignore_patterns`, `repo_type`, ...) are forwarded un-popped to `snapshot_download` while the remote checkpoint is resolved. They were also listed as accepted in the error message, so `GPTQModel.load(repo, token=...)` always failed with the self-contradicting unexpected keyword argument(s) ...: `token` (did you mean `token`?) ... A quantized load accepts ..., `max_workers`, ..., `token`, ... The leftover set is now compared against the same accepted set the message prints, so a keyword that is forwarded is accepted and a real typo still raises. `token` also joins `CONFIG_SELECTION_KWARGS`: model-type detection reads the config before the loader stages the checkpoint, so a private or gated repository needed the credential there too.
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.
Summary
Fixes #5007. #4972 made a quantized
GPTQModel.load()reject every keyword leftafter the explicit pops, but the Hub staging options are never popped: they are
forwarded to
snapshot_downloadwhile the remote checkpoint is resolved, andthey are also listed as accepted by the error message. So the load failed with a
self-contradicting error:
GPTQModel.load("<org>/<private-gptq-repo>", token=...)worked before #4972 andalways raised after it;
max_workers,local_dir,endpoint,headers,etag_timeout,allow_patterns,ignore_patternsandrepo_typefailed thesame way.
What Changed
gptqmodel/models/loader.py: the leftover set is compared against the sameaccepted set the error message prints
(
_accepted_quantized_load_kwargs, which derives the names fromfrom_quantized's signature, the recorded pops, andinspect.signature(snapshot_download)). A forwarded option is accepted; areal typo is still rejected.
gptqmodel/utils/hf.py:tokenjoinsCONFIG_SELECTION_KWARGS. Model-typedetection reads the config before the loader stages the checkpoint, so a
private or gated repository needs the same credential there.
Noneis stillskipped by
get_config_selection_kwargs, so an unset token is not forced intothe HF call.
tests/test_load_strict_kwargs_4945.py: four parametrized Hub-option cases(
token,max_workers,etag_timeout,repo_type), a Hub-option typo case(
tokn=-> "did you meantoken?"), and a unit test for the config-selectionforwarding.
Tests
On unmodified
origin/main(24a46e337, test file copied into a separateworktree): 5 failed, 8 passed — all four Hub-option cases raise the
self-contradicting
TypeError, andtokenis missing from the config-selectionset. The typo case already passes there, which is the point: accepting the Hub
options must not accept a misspelling.
On this branch: 13 passed. Neighbouring loader suites
(
test_hf_gptqmodel_load_bridge.py,test_loader.py,test_loader_offload_staging_4385.py,test_loader_double_contract_4941.py,test_loader_tokenizer_flag_4941.py,test_docs_contract_refs.py): 73passed.
tests/test_local_model_paths.py: 29 passed.ruff checkclean onall changed files.
Notes
snapshot_downloadoption is accepted automatically and a newfrom_quantizedparameter or popped key keeps working — the existing
test_new_load_options_are_accepted_from_the_signature_and_popsstill coversthat.
tokenwas added to the config-selection set: the other Hub options(
max_workers,local_dir,endpoint, ...) affect the download, not whichconfig file is read.