1. Learn
  2. /
  3. Courses
  4. /
  5. Efficient AI Model Training with PyTorch

Connected

Exercise

Define evaluation metrics

You're developing a real-time language translation service in a video conferencing application. To monitor training, you'll define evaluation metrics for accuracy and F1 score, which measure overall model performance.

The evaluate and numpy (np) libraries have been pre-imported.

Instructions

100 XP
  • Load thef1 score using the evaluate library; accuracy has been loaded for you.
  • Extract logits and labels from the input eval_predictions.
  • Convert logits to predictions.
  • Compute the f1 score based on the predictions and labels.