Skip to main content

Lightweight PyTorch tensor diagnostics hooks for training loops

Project description

NN diagnostics

A useful tool to dump diagnostics info from checkpoint.

Install

pip install nndiagnostics

Quick Start

  1. Integrate diagnostics in your training loop
from diagnostics import maybe_attach_diagnostics

diag = maybe_attach_diagnostics(model)

for step, batch in enumerate(train_loader):
    loss = train_step(batch)
    loss.backward()
    optimizer.step()
    optimizer.zero_grad()

    if diag and diag.should_stop(step, stop_after_steps=5):
        diag.print(f"{args.exp_dir}/diagnostics-step-{step}.txt")
        break
  1. Dump diagnostics information (by setting env DUMP_DIAGNOSTICS)
DUMP_DIAGNOSTICS=1 python train.py

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

nndiagnostics-0.1.3.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

nndiagnostics-0.1.3-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file nndiagnostics-0.1.3.tar.gz.

File metadata

  • Download URL: nndiagnostics-0.1.3.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.20

File hashes

Hashes for nndiagnostics-0.1.3.tar.gz
Algorithm Hash digest
SHA256 74454d35a134885e3748e93aec0e536be987abdfd7e2a7db61b4480f0f52d5d4
MD5 1a9115be89f16e1c0b525fe7aad04f3f
BLAKE2b-256 24597f8213cfe8f0e60e130806433c5ca3bf9d8a581c75b33660397bb6f20c45

See more details on using hashes here.

File details

Details for the file nndiagnostics-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nndiagnostics-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.20

File hashes

Hashes for nndiagnostics-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5fdd306cf407e80122e8f67839c4bccb86a8ab3b5e5e1b7ba9acc800d24df7d
MD5 f9cb3ce13862fa0be7a73165d1ca0827
BLAKE2b-256 cbc05e3de69e9e7b18f145c31d55f693b9c76f4d8bcc7cc07e47ea9e1b81e838

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