From 3f9d861fe3dd1de0f4cbd373003f5caabec8ed45 Mon Sep 17 00:00:00 2001 From: shlok007 <14155445+shlok007@users.noreply.github.com> Date: Sat, 17 Oct 2026 02:44:54 +0530 Subject: [PATCH] fix(contrib): stop passing direction to list_models 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 #534 Co-Authored-By: Claude Opus 5.5 Signed-off-by: shlok007 <14155445+shlok007@users.noreply.github.com> --- contrib/scripts/select-top-models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/scripts/select-top-models.py b/contrib/scripts/select-top-models.py index 05d3fbda..5d293ee8 100644 --- a/contrib/scripts/select-top-models.py +++ b/contrib/scripts/select-top-models.py @@ -241,15 +241,13 @@ def select_top_models( models = api.list_models( filter=model_filter, sort=sort_by, - direction=-1, limit=fetch_limit, ) else: - # Older API without ModelFilter + # Newer API without ModelFilter (removed in huggingface_hub 0.24) models = api.list_models( filter=task, sort=sort_by, - direction=-1, limit=fetch_limit, )