huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
2.02k stars 531 forks source link

Define cache errors in errors.py #2456

Closed 010kim closed 1 month ago

010kim commented 1 month ago

Below is the list of descriptions for this PR.

  1. Defined two errors (CacheNotFound, CorruptedCacheExcpetion) in errors.py

    • imported typing and pathlib package to keep the original definition of CacheNotFound
  2. Adjusted the import paths in init.py

  3. Removed the original definitions of the errors in _cache_manager.py

    • added "from huggingface_hub.errors import CacheNotFound, CorruptedCacheException" for API support

2069

010kim commented 1 month ago

@Wauplin Hello! I have a question about the definition for CacheNotFound class. I imported pathlib and typing packages in errors.py to keep the original definition of CacheNotFound. But I found in the previous comments of yours that you want to keep errors.py as simple as possible. Do you have any suggestions?

HuggingFaceDocBuilderDev commented 1 month ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Wauplin commented 1 month ago

There seems to be styling issues. Could you install dev dependencies locally (see here) and then run make style (see here) to fix them. You can then test with make quality and commit the changes.

010kim commented 1 month ago

I closed the PR to sync with the newest main branch. I will create another PR with the original fix.

Wauplin commented 1 month ago

It's also possible to update click on "update branch" on the PR page to get the latest update on your branch :wink: