hc99's picture
Add files using upload-large-folder tool
abeebae verified
Raw
History Blame Contribute Delete
2.08 kB
# Utilities
## Controlling the logging of `huggingface_hub`
The `huggingface_hub` package exposes a `logging` utility to control the logging level of the package itself.
You can import it as such:
```py
from huggingface_hub import logging
```
Then, you may define the verbosity in order to update the amount of logs you'll see:
```python
from huggingface_hub import logging
logging.set_verbosity_error()
logging.set_verbosity_warning()
logging.set_verbosity_info()
logging.set_verbosity_debug()
logging.set_verbosity(...)
```
The levels should be understood as follows:
- `error`: only show critical logs about usage which may result in an error or unexpected behavior.
- `warning`: show logs that aren't critical but usage may result in unintended behavior.
Additionally, important informative logs may be shown.
- `info`: show most logs, including some verbose logging regarding what is happening under the hood.
If something is behaving in an unexpected manner, we recommend switching the verbosity level to this in order
to get more information.
- `debug`: show all logs, including some internal logs which may be used to track exactly what's happening
under the hood.
[[autodoc]] logging.get_verbosity
[[autodoc]] logging.set_verbosity
[[autodoc]] logging.set_verbosity_info
[[autodoc]] logging.set_verbosity_debug
[[autodoc]] logging.set_verbosity_warning
[[autodoc]] logging.set_verbosity_error
[[autodoc]] logging.disable_propagation
[[autodoc]] logging.enable_propagation
### Repo-specific helper methods
The methods exposed below are relevant when modifying modules from the `huggingface_hub` library itself.
Using these shouldn't be necessary if you use `huggingface_hub` and you don't modify them.
[[autodoc]] logging.get_logger
## Custom errors
See below for all custom errors thrown by different methods across the package.
[[autodoc]] huggingface_hub.utils.RepositoryNotFoundError
[[autodoc]] huggingface_hub.utils.RevisionNotFoundError
[[autodoc]] huggingface_hub.utils.EntryNotFoundError
[[autodoc]] huggingface_hub.utils.LocalEntryNotFoundError