Skip to main content

A minimal library for plotting training progress in Jupyter/Colab

Project description

A minimal library for plotting training progress in Jupyter/COLAB notebooks.

Installation

pip install tinygraphs

Options

train_losses: (Required) List of training loss values to plot

val_losses: (Required) List of validation loss values to plot

epoch: (Required) Current epoch number for updating the plot

legend_loc: Location of the legend on the plot (default: "upper right")

updating_title: Boolean flag to indicate if the title should update with epoch progress (default: True)

legend: Boolean flag to show/hide the legend (default: True)

x_label: Label for the x-axis

y_label: Label for the y-axis

title: Main title of the plot

dark_mode: Boolean flag to switch between light and dark themes (default: True)

Usage

import tinygraphs as tg

train_losses, val_losses = [], []
epochs = 3

for epoch in range(epochs):
    # Training
    model.train()
    running_train_loss = 0
    for x, y in train_loader:
        x, y = x.to(device), y.to(device)
        optimizer.zero_grad()
        loss = criterion(model(x), y)
        loss.backward()
        optimizer.step()
        running_train_loss += loss.item()
    train_losses.append(running_train_loss / len(train_loader))

    # Validation
    model.eval()
    running_val_loss = 0
    with torch.no_grad():
        for x, y in val_loader:
            x, y = x.to(device), y.to(device)
            loss = criterion(model(x), y)
            running_val_loss += loss.item()
    val_losses.append(running_val_loss / len(val_loader))

    # Plot using tinygraphs
    tg.plot(train_losses, val_losses, epoch, legend_loc = "upper right", updating_title = False, legend = True, x_label = "x title", y_label = "y title", title = "title", dark_mode = False)

Other Usage Options

    tg.plot(train_losses, val_losses, epoch, legend_loc = "upper right", updating_title = False, legend = True, x_label = "Epoch", y_label = "Loss", title = "Loss Graph", dark_mode = True)

Dark Mode is Awesome!

    tg.plot(train_losses, val_losses, epoch, theme = 'jet')

Beautiful Loss Graph With Barely Any Code!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinygraphs-2.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tinygraphs-2.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file tinygraphs-2.0.1.tar.gz.

File metadata

  • Download URL: tinygraphs-2.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tinygraphs-2.0.1.tar.gz
Algorithm Hash digest
SHA256 977abe73216bb63fc5a059fd56ab8f5196e2b6b81e8dc1763bbd9be3b8118465
MD5 7a7fb665751995de74e5ad9bae4c0949
BLAKE2b-256 4939c1d57db977010375db8cf61fb33f70cc963aecb1dde882bc217e08866658

See more details on using hashes here.

File details

Details for the file tinygraphs-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: tinygraphs-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tinygraphs-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4d85b5c073c6e074d6816749008dc3b9acf476c8f0a9af8895218488b2837a7
MD5 e63be18c83c5065ccb516f6c72b03898
BLAKE2b-256 3bc7327b3c03c1105cc21e4d01e524a93d8089f2bc79768c7f35bf8bde6e5be2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page