tbparse

0.0.9 · active · verified Fri Apr 17

tbparse is a Python library that allows users to load TensorBoard event logs directly into pandas DataFrames. It provides an easy way to read, parse, and plot TensorBoard data, simplifying analysis for machine learning experiments. The current version is 0.0.9, and the library maintains an active release cadence with frequent updates and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

Initialize a SummaryReader with your TensorBoard log directory and access event types like 'scalars' or 'histograms' as pandas DataFrames. The example includes a basic check for log directory existence.

import os
from tbparse import SummaryReader

# Create a dummy log directory for demonstration
log_dir = './logs/example_run'
if not os.path.exists(log_dir):
    os.makedirs(log_dir)
    # In a real scenario, TensorBoard logs would be generated here
    # For this quickstart, we'll assume logs exist or will be generated later

# Example usage:
# Replace 'path/to/your/log_dir' with your actual TensorBoard log directory
try:
    reader = SummaryReader(log_dir)
    df = reader.scalars
    print("Scalars DataFrame (first 5 rows):")
    print(df.head())

    if not df.empty:
        # Access specific columns
        print(f"\nAvailable tags: {df['tag'].unique()}")
except FileNotFoundError:
    print(f"Warning: Log directory '{log_dir}' not found or empty. Please ensure TensorBoard logs are present.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →