Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Filtering models by tags using ModelFilter doesn't work #1668

Closed
Wauplin opened this issue Sep 15, 2023 · 4 comments · Fixed by #1673
Closed

[Bug] Filtering models by tags using ModelFilter doesn't work #1668

Wauplin opened this issue Sep 15, 2023 · 4 comments · Fixed by #1673
Labels
bug Something isn't working

Comments

@Wauplin
Copy link
Contributor

Wauplin commented Sep 15, 2023

Originally reported by @thomwolf on Slack (private):

Model filtering by tags using ModelFilter doesn't work:

>>> from huggingface_hub import list_models, ModelFilter

>>> filter = ModelFilter(author="HuggingFaceBR4", tags=["tensorboard"])
>>> models = list(list_models(filter=filter))
>>> models[0]   # <= doesn't have a "tensorboard" tag
ModelInfo: { 
  {'_id': '63ff7c00ea1782e758c69b5d',
   'author': 'HuggingFaceBR4',
   'id': 'HuggingFaceBR4/gpt2-20b',
   (...)
   'tags': ['transformers', 'gpt2', 'text-generation', 'text-generation-inference', 'region:us']}
}

A workaround is to use list_models(author="HuggingFaceBR4", filter="tensorboard") directly without ModelFilter. Would still be good to investigate.

@martinbrose
Copy link
Contributor

I shouldn't have closed my PR. @Wauplin, could you please reopen it?

The problem here is that the /api/models GET endpoint does not seem to have an additional parameter for tags.
It needs to be provided as part of the "filter" parameter, similar to the language filter, which is also just a language code within ModelInfo.tags. The original code erroneously provided the tags within ModelFilter as a "tags" parameter to the API endpoint.

@Wauplin
Copy link
Contributor Author

Wauplin commented Sep 18, 2023

Hi @martinbrose, thanks for investigating the bug and finding the cause! So this means the tags filter most probably never worked before 😬 I re-opened the PR you've created and will have a look at it soon.

@martinbrose
Copy link
Contributor

Yes, seems to have never worked. There also wasn't a test case for it.

On the other hand, not many people seem to have complained about it. So maybe this functionality isn't really used anyway.

@Wauplin
Copy link
Contributor Author

Wauplin commented Sep 18, 2023

So maybe this functionality isn't really used anyway.

I think this is the key take-away! I've created #1676 to definitely deprecate/remove those. We still need to find a way to do it without breaking too much stuff but it's definitely the direction we want to take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants