Skip to content

Observability: logs and monitoring

Observability is key to getting clearer, more verbose output during the tuning process. This page covers the logging level and the TORCH_TWEAK_CONSOLE_OUTPUT environment variable (with hardware monitoring to come).

Logging level: logging.INFO

Torch Tweak emits progress messages at INFO level (strategy steps, backend selection, build status, validation, etc.). If the root or torch_tweak logger is left at its default level (often WARNING), those messages are not shown.

Enable INFO for better verbosity:

import logging

logging.basicConfig(level=logging.INFO, force=True)

With INFO (or DEBUG for more detail), you will see messages such as:

  • Which strategy and backend are running
  • Build and validation progress
  • Selected backend and high-level timing

Environment variable: TORCH_TWEAK_CONSOLE_OUTPUT

During tuning, backend builds (e.g. OpenVINO) run inside an output control context. By default, their stdout, stderr, and logging are not printed to the console; they are redirected to a build log file (e.g. build.log in the backend cache directory). That keeps the terminal quiet and avoids flooding it with compiler/build logs.

To see that backend output live on the console as well, set:

export TORCH_TWEAK_CONSOLE_OUTPUT=1

Accepted values (case-insensitive): 1, true, yes. If unset or any other value, console output from the build phase remains disabled (output only in the log file).

Behavior summary:

TORCH_TWEAK_CONSOLE_OUTPUT Console during backend build Build log file
Unset / 0 / false No backend output Yes (e.g. build.log)
1 / true / yes Backend output shown Yes (tee: console + file)

So:

  • Default (unset): Cleaner terminal; inspect build.log under the backend cache dir if you need build details.
  • Set to 1: More verbose terminal; same content is also written to the log file.

Using both for maximum verbosity

For the most visible tuning process:

  1. Set the logging level to INFO (or DEBUG) in your script so Torch Tweak’s own messages are shown.
  2. Set TORCH_TWEAK_CONSOLE_OUTPUT=1 in the environment so backend build output (e.g. OpenVINO) is shown on the console and still captured in the build log.
export TORCH_TWEAK_CONSOLE_OUTPUT=1
python your_tuning_script.py
import logging

logging.basicConfig(level=logging.INFO, force=True)

# ... your tuning code ...

See also torch_tweak.utils.setup_logging / control_output in the API.