VisualDL

2.5.3 · active · verified Thu Apr 16

VisualDL is a deep learning visualization tool from PaddlePaddle that helps design and debug deep learning jobs. It offers features for visualizing scalars, parameter distributions, model structures, images, audio, text, high-dimensional data, and more. It is actively developed, with new features continuously added.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart code demonstrates how to initialize a `LogWriter` and record scalar data over multiple steps for both 'train' and 'eval' modes. After running this script, launch the VisualDL board from your terminal using the provided command to view the generated visualizations.

import random
from visualdl import LogWriter
import os

# Create a log directory
logdir = os.path.join(os.environ.get('VISUALDL_LOGDIR', './visualdl_logs'))
os.makedirs(logdir, exist_ok=True)

# Initialize LogWriter
# The sync_cycle parameter specifies how often data should be written to disk.
logger = LogWriter(logdir=logdir, sync_cycle=1000)

# Log scalar data
with logger.mode("train"):
    scalar_writer = logger.scalar("scalars/loss")
    for step in range(100):
        scalar_writer.add_record(step, random.random() * 10)

with logger.mode("eval"):
    scalar_writer = logger.scalar("scalars/accuracy")
    for step in range(100):
        scalar_writer.add_record(step, random.random())

print(f"VisualDL logs saved to: {logdir}")
print(f"To view, run in your terminal: visualdl --logdir {logdir}")

view raw JSON →