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.1.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.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tinygraphs-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4c0a50a6fbc29df7b71d063963d692645ed7af437a91aab93a9f621d13f4037d
MD5 ea80454812f0b8356512aa1097dff200
BLAKE2b-256 ae564faa401ed5b3147800b0aa88febacc1806be0d0cdf9714850ddf48e4286c

See more details on using hashes here.

File details

Details for the file tinyGraphs-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tinyGraphs-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54f094492977c77ee59a9122ee9a9c52a4edbd099f4f00f5b8883e52338ab4a5
MD5 d0c1f83fdd643e24d7dc2490cdeb00f2
BLAKE2b-256 365ff6a182645e393d7022f30ed56872f7509cbb0b0997e90cb1eef1957db5b2

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