Skip to content

fix(contrib): stop passing direction to list_models - #691

Open
shlok007 wants to merge 1 commit into
modelpack:mainfrom
shlok007:fix/top-models-list-models-direction
Open

shlok007 wants to merge 1 commit into
modelpack:mainfrom
shlok007:fix/top-models-list-models-direction

Conversation

@shlok007

Copy link
Copy Markdown

Fixes #534

huggingface_hub 1.6.0 removed the direction argument from HfApi.list_models, so select-top-models.py fails with a TypeError. The weekly Build Top HuggingFace Models workflow has failed every run since 2026-03-08, two days after 1.6.0 came out. The argument was already deprecated ("Sorting is always descending") and the Hub rejects any other direction, so dropping it doesn't change the ordering.

I also fixed the comment on the else branch. ModelFilter was removed in huggingface_hub 0.24, so that's the branch current versions take, not the older one.

Tested locally on Python 3.13 with huggingface_hub 2.2.0, the version CI installs now. With the workflow's arguments (--limit 10 --max-size 10 --sort-by downloads) it picks 10 models and the workflow's jq steps parse the output. --sort-by likes runs fine too, and so does huggingface_hub 0.20.0 (the minimum in requirements.txt), which goes through the ModelFilter branch.

Separately, --sort-by trending gets a 400 from the Hub ("Invalid sort parameter: trending"). huggingface_hub calls that sort trending_score. I left that out of this PR and can send a follow-up.

🤖 Generated with Claude Code

huggingface_hub 1.6.0 removed the direction argument from
HfApi.list_models, so select-top-models.py fails with a TypeError and
the weekly Build Top HuggingFace Models workflow can't select any
models. The argument was already deprecated ("Sorting is always
descending") and the Hub rejects any other direction, so dropping it
keeps the same ordering.

Also fix the comment on the else branch: ModelFilter was removed in
huggingface_hub 0.24, so that is the branch current versions take.

Fixes modelpack#534

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: shlok007 <14155445+shlok007@users.noreply.github.com>

This branch has not been deployed

No deployments
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: Build Top HuggingFace Models workflow fails with unsupported list_models direction argument

1 participant