Repository navigation
fix: keep keyword-only kwargs in select_compatible_kwargs - #2039
Merged
jlarson4 merged 1 commit intoNov 19, 2026
Merged
Conversation
select_compatible_kwargs filtered on inspect.getfullargspec(...).args, which lists only positional-or-keyword parameters and does not follow functools.wraps. In huggingface_hub, hf_hub_download takes revision, local_files_only, token and the rest as keyword-only, so download_file_from_hf silently dropped all of them. Filter on inspect.signature(...).parameters and keep both positional-or-keyword and keyword-only names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jlarson4
approved these changes
Nov 19, 2026
jlarson4
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for putting this together @nurlanmnn! It is approved, assuming it passes CI. I will keep an eye on it and ping you if anything comes up that needs your attention. If nothing comes up, I will merge.
1 task done
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.
Description
utils.download_file_from_hfwas quietly throwing away options likerevisionandlocal_files_only, so asking for a pinned revision still downloaded the latest file. The helper that filters the kwargs only looked at positional parameters, and those options are keyword-only inhf_hub_download. This switches the helper toinspect.signature, which sees keyword-only parameters and follows the decorator onhf_hub_download. Unknown keys are still dropped like before.Fixes #2038
Type of change
Checklist:
Tests:
uv run pytest tests/unit/utilities/test_hf_utils.pygives 30 passed. The 3 new tests (keyword-only params kept,functools.wrapsfollowed,download_file_from_hfforwardsrevision/local_files_onlyto a mockedhf_hub_download) fail ondevand pass with this change. No network is used.isort/blackare clean, andmypyon the two files shows no new errors (the 2__func__errors at test_hf_utils.py:147/149 are already ondev).I used an AI coding assistant to help find and fix this, and I reviewed and tested the change myself.
🤖 Generated with Claude Code