Feature request: Check if repo / file exists
See original GitHub issueHi, not sure if these functions are already implement, but I was not able to find them. It would be nice to have the following two methods:
- a function that checks if a repository exists. I provide a name, it checks if huggingface.co/[model_name] exists. Returns True / False.
- a function that checks if a specific file in a repository exists. For sentence-transformers, I check if there is a sentence-transformers specific file (modules.json) in that repositoryand depending on it I execute different code. Currently I do this with
cached_download(url_to_modules_json_file)
and catching a 404 exception. But having a function that just checks if the file exists (without downloading) and return True / False would have been nice.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
enabling API users to check if a file exists, before requesting ...
Problem to solve. Whenever you want to know how if or if not a file exists with a certain name in a specified...
Read more >Command to check if repository exists · Issue #1690 - GitHub
Feature request It would be nice if there was an option to check if a repository exists. This is particularly useful when restic...
Read more >Repo File Checks | Checks | OpsLevel Docs
With the Repo File Check, you can verify the existence or contents of a file in your repo. Repo File Checks by default...
Read more >Github Action : Stop the action if PR already exists
I want to change: If already a PR exists ( master <- dev ) no need to run this action, so how can...
Read more >Build Azure Repos Git repositories - Azure Pipelines
You create a new pipeline by first selecting a repository and then a YAML file in that repository. The repository in which the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yes, we return a 404 (cc @Pierrci)
I am also wondering what the response would be for a private model if the user is not authenticated? 404 or 401 Unauthorized?
404 would be more secure (so you cannot probe names from privat models), 401 Unauthorized would be more informative for users.
The hf_api.list_models() approach will not scale, e.g. once there are 100k models, the names for 100k models must be downloaded just to check if one name exists. So I think the 404 approach is much nicer.