Set DeepChem Logging Level

When writing a DeepChem application it’s very useful to be able to control the logging level. DeepChem classes and utilities all follow standard logging practices to report useful information at controllable intervals. If you’re featurizing a large dataset or training a large model, being able to control logging as your app needs can be really helpful.

Here’s a standard snippet I stick at the top of my scripts/notebooks to set the logging level to INFO:

import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
import deepchem as dc

You can change the logging level as desired and point the output to different streams. A useful pattern is to log all output from a job to a file. In case of unexpected behavior this can prove very useful for debugging after the fact

2 Likes