1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00
Files
diffusers/docs/source/en/api/logging.md
camenduru c6ae9b7df6 Where did this 'x' come from, Elon? (#4277)
* why mdx?

* why mdx?

* why mdx?

* no x for kandinksy either

---------

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-07-26 18:18:14 +02:00

3.6 KiB

Logging

🤗 Diffusers has a centralized logging system to easily manage the verbosity of the library. The default verbosity is set to WARNING.

To change the verbosity level, use one of the direct setters. For instance, to change the verbosity to the INFO level.

import diffusers

diffusers.logging.set_verbosity_info()

You can also use the environment variable DIFFUSERS_VERBOSITY to override the default verbosity. You can set it to one of the following: debug, info, warning, error, critical. For example:

DIFFUSERS_VERBOSITY=error ./myprogram.py

Additionally, some warnings can be disabled by setting the environment variable DIFFUSERS_NO_ADVISORY_WARNINGS to a true value, like 1. This disables any warning logged by [logger.warning_advice]. For example:

DIFFUSERS_NO_ADVISORY_WARNINGS=1 ./myprogram.py

Here is an example of how to use the same logger as the library in your own module or script:

from diffusers.utils import logging

logging.set_verbosity_info()
logger = logging.get_logger("diffusers")
logger.info("INFO")
logger.warning("WARN")

All methods of the logging module are documented below. The main methods are [logging.get_verbosity] to get the current level of verbosity in the logger and [logging.set_verbosity] to set the verbosity to the level of your choice.

In order from the least verbose to the most verbose:

Method Integer value Description
diffusers.logging.CRITICAL or diffusers.logging.FATAL 50 only report the most critical errors
diffusers.logging.ERROR 40 only report errors
diffusers.logging.WARNING or diffusers.logging.WARN 30 only report errors and warnings (default)
diffusers.logging.INFO 20 only report errors, warnings, and basic information
diffusers.logging.DEBUG 10 report all information

By default, tqdm progress bars are displayed during model download. [logging.disable_progress_bar] and [logging.enable_progress_bar] are used to enable or disable this behavior.

Base setters

autodoc logging.set_verbosity_error

autodoc logging.set_verbosity_warning

autodoc logging.set_verbosity_info

autodoc logging.set_verbosity_debug

Other functions

autodoc logging.get_verbosity

autodoc logging.set_verbosity

autodoc logging.get_logger

autodoc logging.enable_default_handler

autodoc logging.disable_default_handler

autodoc logging.enable_explicit_format

autodoc logging.reset_format

autodoc logging.enable_progress_bar

autodoc logging.disable_progress_bar