Skip to content

fix(hub): import create_repo from huggingface_hub (transformers dropped the passthrough)#2917

Merged
Qubitium merged 1 commit into
ModelCloud:mainfrom
Anai-Guo:fix/create-repo-from-hf-hub
Jun 4, 2026
Merged

fix(hub): import create_repo from huggingface_hub (transformers dropped the passthrough)#2917
Qubitium merged 1 commit into
ModelCloud:mainfrom
Anai-Guo:fix/create-repo-from-hf-hub

Conversation

@Anai-Guo
Copy link
Copy Markdown
Contributor

@Anai-Guo Anai-Guo commented Jun 3, 2026

Problem

On the latest transformers (main), import gptqmodel raises:

AttributeError: module 'transformers.utils.hub' has no attribute 'create_repo'

gptqmodel/utils/hub.py aliases create_repo = transformers_hub.create_repo, but recent transformers dropped the create_repo passthrough from transformers.utils.hub. This breaks import on a clean install against transformers main.

Fixes #2916.

Fix

transformers.utils.hub.create_repo was only ever a re-export of huggingface_hub.create_repo, so import it from the canonical source instead:

from huggingface_hub import create_repo

This is a 1:1 behavioral replacement (the module-level huggingface_hub.create_repo), and works across all transformers versions since huggingface_hub is already a hard dependency.

The _HF_API-bound helpers (list_repo_tree, list_repo_files, model_info, repo_info) are intentionally left sourced from transformers.utils.hub — line 23 relies on list_repo_tree.__self__ being a bound method of transformers' configured HfApi instance, so those must not change.

Verification

import ast; ast.parse(open("gptqmodel/utils/hub.py").read())  # OK
python -c "import gptqmodel"   # no longer raises on transformers main

🤖 Generated with Claude Code

…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
@Qubitium Qubitium merged commit a726b30 into ModelCloud:main Jun 4, 2026
@Qubitium
Copy link
Copy Markdown
Collaborator

Qubitium commented Jun 4, 2026

@Anai-Guo Thank you!

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.

[BUG] Error with latest transformers: module 'transformers.utils.hub' has no attribute 'create_repo'

2 participants