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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nndiagnostics-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 c33572903daf72e71e0310d34e9897f66665288a64ae1891bed1258c83fcf471
MD5 c756bc715bb68ea7156f7f1cb3731e8a
BLAKE2b-256 d8f0c30955ddd62a69ea9e0b76c792dae7398c2181071862ec8025a70ddf422d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nndiagnostics-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 12.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3135ccb5a073800e8858ac431e2c95596d1630b35828298fe2effef7a9b08643
MD5 00960ac7e4247f70ff1af0286c4afc1a
BLAKE2b-256 cdc94b9983e4a0b3bee510e5647c9ccb3d034dd680792120cd1a97817f4e37d3

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