Skip to main content

A minimal library for plotting training progress in Jupyter/Colab

Project description

tinyGraphs

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

Installation

pip install tinyGraphs

Usage

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
    plot_training_progress(train_losses, val_losses, epoch, y_max = 0.5)

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-0.0.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

tinygraphs-0.0.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tinygraphs-0.0.2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for tinygraphs-0.0.2.tar.gz
Algorithm Hash digest
SHA256 328701d038ec5e86b8df92f0f4b9ebb648790a80b1721964f11602eed1ebb1bc
MD5 ce9a8bffcaf57e5b521bdcc5019dbaa8
BLAKE2b-256 d3ad6986079c76b91007f9c3f7cf9d3b1f7fc4132b796e1492556960f4499c1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tinygraphs-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for tinygraphs-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cf50063d296c8feab8a93a58779a1640de282eadab424b063779aa5eba639fe2
MD5 14dc420dd7cdeadd384eb5d62e1d6a8b
BLAKE2b-256 32126a824eb20be20f10a363cc001c0ac50572bac3ae23dcdf29cbb71745b4a7

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