Datasets
  • 🌍GET STARTED
    • Datasets
    • Quickstart
    • Installation
  • 🌍TUTORIALS
    • Overview
    • Load a dataset from the Hub
    • Know your dataset
    • Preprocess
    • Evaluate predictions
    • Create a data
    • Share a dataset to the Hub
  • 🌍HOW-TO GUIDES
    • Overview
    • 🌍GENERAL USAGE
      • Load
      • Process
      • Stream
      • Use with TensorFlow
      • Use with PyTorch
      • Use with JAX
      • Use with Spark
      • Cache management
      • Cloud storage
      • Search index
      • Metrics
      • Beam Datasets
    • 🌍AUDIO
      • Load audio data
      • Process audio data
      • Create an audio dataset
    • 🌍VISION
      • Load image data
      • Process image data
      • Create an image dataset
      • Depth estimation
      • Image classification
      • Semantic segmentation
      • Object detection
    • 🌍TEXT
      • Load text data
      • Process text data
    • 🌍TABULAR
      • Load tabular data
    • 🌍DATASET REPOSITORY
      • Share
      • Create a dataset card
      • Structure your repository
      • Create a dataset loading script
  • 🌍CONCEPTUAL GUIDES
    • Datasets with Arrow
    • The cache
    • Dataset or IterableDataset
    • Dataset features
    • Build and load
    • Batch mapping
    • All about metrics
  • 🌍REFERENCE
    • Main classes
    • Builder classes
    • Loading methods
    • Table Classes
    • Logging methods
    • Task templates
Powered by GitBook
On this page
  • Logging methods
  • Functions
  • Levels
  1. REFERENCE

Logging methods

PreviousTable ClassesNextTask templates

Last updated 1 year ago

Logging methods

🌍 Datasets strives to be transparent and explicit about how it works, but this can be quite verbose at times. We have included a series of logging methods which allow you to easily adjust the level of verbosity of the entire library. Currently the default verbosity of the library is set to WARNING.

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

Copied

import datasets
datasets.logging.set_verbosity_info()

You can also use the environment variable DATASETS_VERBOSITY to override the default verbosity, and set it to one of the following: debug, info, warning, error, critical:

Copied

DATASETS_VERBOSITY=error ./myprogram.py

All the methods of this logging module are documented below. The main ones are:

  • to get the current level of verbosity in the logger

  • to set the verbosity to the level of your choice

In order from the least to the most verbose (with their corresponding int values):

  1. logging.CRITICAL or logging.FATAL (int value, 50): only report the most critical errors.

  2. logging.ERROR (int value, 40): only report errors.

  3. logging.WARNING or logging.WARN (int value, 30): only reports error and warnings. This the default level used by the library.

  4. logging.INFO (int value, 20): reports error, warnings and basic information.

  5. logging.DEBUG (int value, 10): report all information.

Functions

datasets.utils.logging.get_verbosity

( )

Return the current level for the BOINC AI datasets library’s root logger.

BOINC AI datasets library has following logging levels:

  • datasets.logging.CRITICAL, datasets.logging.FATAL

  • datasets.logging.ERROR

  • datasets.logging.WARNING, datasets.logging.WARN

  • datasets.logging.INFO

  • datasets.logging.DEBUG

datasets.utils.logging.set_verbosity

( verbosity: int )

Set the level for the BOINC AI Datasets library’s root logger.

datasets.utils.logging.set_verbosity_info

( )

Set the level for the BOINC AI datasets library’s root logger to INFO.

This will display most of the logging information and tqdm bars.

Shortcut to datasets.logging.set_verbosity(datasets.logging.INFO).

datasets.utils.logging.set_verbosity_warning

( )

Set the level for the BOINC AI datasets library’s root logger to WARNING.

This will display only the warning and errors logging information and tqdm bars.

Shortcut to datasets.logging.set_verbosity(datasets.logging.WARNING).

datasets.utils.logging.set_verbosity_debug

( )

Set the level for the BOINC AI datasets library’s root logger to DEBUG.

This will display all the logging information and tqdm bars.

Shortcut to datasets.logging.set_verbosity(datasets.logging.DEBUG).

datasets.utils.logging.set_verbosity_error

( )

Set the level for the BOINC AI datasets library’s root logger to ERROR.

This will display only the errors logging information and tqdm bars.

Shortcut to datasets.logging.set_verbosity(datasets.logging.ERROR).

datasets.utils.logging.disable_propagation

( )

Disable propagation of the library log outputs. Note that log propagation is disabled by default.

datasets.utils.logging.enable_propagation

( )

Enable propagation of the library log outputs. Please disable the BOINC AI datasets library’s default handler to prevent double logging if the root logger has been configured.

datasets.utils.logging.get_logger

( name: typing.Optional[str] = None )

Return a logger with the specified name. This function can be used in dataset scripts.

datasets.enable_progress_bar

( )

Enable tqdm progress bar.

datasets.disable_progress_bar

( )

Disable tqdm progress bar.

datasets.is_progress_bar_enabled

( )

Return a boolean indicating whether tqdm progress bars are enabled.

Levels

datasets.logging.CRITICAL

datasets.logging.CRITICAL = 50

datasets.logging.DEBUG

datasets.logging.DEBUG = 10

datasets.logging.ERROR

datasets.logging.ERROR = 40

datasets.logging.FATAL

datasets.logging.FATAL = 50

datasets.logging.INFO

datasets.logging.INFO = 20

datasets.logging.NOTSET

datasets.logging.NOTSET = 0

datasets.logging.WARN

datasets.logging.WARN = 30

datasets.logging.WARNING

datasets.logging.WARNING = 30

By default, tqdm progress bars will be displayed during dataset download and preprocessing. and can be used to suppress or unsuppress this behavior.

🌍
logging.get_verbosity()
logging.set_verbosity()
logging.disable_progress_bar()
logging.enable_progress_bar()
<source>
<source>
<source>
<source>
<source>
<source>
<source>
<source>
<source>
<source>
<source>
<source>