fix(hub): import create_repo from huggingface_hub (transformers dropped the passthrough)#2917
Merged
Merged
Conversation
…ed the passthrough) Latest transformers removed create_repo from transformers.utils.hub, so `import gptqmodel` raises AttributeError. transformers.utils.hub.create_repo was always a re-export of huggingface_hub.create_repo, so import it from the canonical source. The _HF_API-bound helpers stay on transformers hub. Fixes ModelCloud#2916
Collaborator
|
@Anai-Guo Thank you! |
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.
Problem
On the latest
transformers(main),import gptqmodelraises:gptqmodel/utils/hub.pyaliasescreate_repo = transformers_hub.create_repo, but recenttransformersdropped thecreate_repopassthrough fromtransformers.utils.hub. This breaks import on a clean install against transformers main.Fixes #2916.
Fix
transformers.utils.hub.create_repowas only ever a re-export ofhuggingface_hub.create_repo, so import it from the canonical source instead:This is a 1:1 behavioral replacement (the module-level
huggingface_hub.create_repo), and works across all transformers versions sincehuggingface_hubis already a hard dependency.The
_HF_API-bound helpers (list_repo_tree,list_repo_files,model_info,repo_info) are intentionally left sourced fromtransformers.utils.hub— line 23 relies onlist_repo_tree.__self__being a bound method of transformers' configuredHfApiinstance, so those must not change.Verification
🤖 Generated with Claude Code