Edit on GitHub


DVCLive allows you to easily add experiment tracking capabilities to your Pytorch projects.

About PyTorch

PyTorch is a Python package that provides two high-level features:

  • Tensor computation (like NumPy) with strong GPU acceleration
  • Deep neural networks built on a tape-based autograd system


To start using DVCLive you just need to add few modifications to your training code in any PyTorch project.

You need to add Live.log() calls to each place where you would like to log metrics and one single Live.next_step() call to indicate that the epoch has ended.

To ilustrate with some code, extracted from the official PyTorch ImageNet example:

+ from dvclive import Live

+ live = Live()

for epoch in range(args.start_epoch, args.epochs):
    lr = adjust_learning_rate(optimizer, epoch, args)
+    live.log("learning_rate", lr)

    train_acc1 = train(
        train_loader, model, criterion, optimizer, epoch, args)
+    live.log("train/accuracy", train_acc1)

    val_acc1 = validate(val_loader, model, criterion, args)
+    live.log("validation/accuracy", val_acc1)

    is_best = val_acc1 > best_acc1
    best_acc1 = max(val_acc1, best_acc1)

        'epoch': epoch + 1,
        'arch': args.arch,
        'state_dict': model.state_dict(),
        'best_acc1': best_acc1,
        'optimizer' : optimizer.state_dict(),
    }, is_best)

+    live.next_step()

This will generate the metrics logs and summaries as described in the Get Started.

💡Without requiring additional modifications to your training code, you can use DVCLive alongside DVC. See DVCLive with DVC for more info.


🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat