1. Learn
  2. /
  3. Courses
  4. /
  5. Scalable AI Models with PyTorch Lightning

Connected

Exercise

Evaluate model accuracy using Torchmetrics

Evaluating how well your model performs is essential - especially when preparing it for deployment! Let's smoothly integrate accuracy calculation using Torchmetrics right into the validation_step(). Don't forget to log the results, so you can easily monitor your model's progress.

Instructions

100 XP
  • Import Accuracy from torchmetrics.
  • Instantiate the accuracy metric inside __init__().
  • Calculate accuracy within validation_step() and log it as 'val_acc'.