code: def score_dev_set(model, dev_set, dev_eval_scoring):
      predictions = dataset_predictions(model, dev_set)
      confusion_matrix = confusion_dataset(
          predictions, dev_set, model.labels
      )
      logger.info(
          "Dev set confusion matrix:\n{}".format(
              format_confusion(confusion_matrix, model.labels)
          )
      )
      correct, total = confusion_to_accuracy(confusion_matrix)
      macro_f1 = confusion_to_macro_f1(confusion_matrix)
      logger.info(
          "Dev set: %d correct of %d examples.  Accuracy: %f"
          % (correct, len(dev_set), correct / len(dev_set))
      )
      logger.info("Macro f1: {}".format(macro_f1))
  
      accuracy = correct / total
      if dev_eval_scoring is DevScoring.ACCURACY:
          return accuracy, accuracy, macro_f1
      elif dev_eval_scoring is DevScoring.WEIGHTED_F1:
          return macro_f1, accuracy, macro_f1
      else:
          raise ValueError(
              "Unknown scoring method {}".format(dev_eval_scoring)
          )
  
imports: import argparse
  import ast
  import logging
  import os
  import random
  import re
  from enum import Enum
  import torch
  import torch.nn
  from stanza.models.common import loss
  from stanza.models.common import utils
  from stanza.models.pos.vocab import CharVocab
  import stanza.models.classifiers.data
  from stanza.models.classifiers.trainer import Trainer
  from stanza.models.classifiers.utils import WVType, ExtraVectors, ModelType
  from stanza.utils.confusion import format_confusion, confusion_to_accuracy, confusion_to_macro_f1
label_desc: Use image node_id 7 for calling a global function with example usage: score_dev_set(model, dev_set, dev_eval_scoring) and returns: accuracy,  accuracy,  macro_f1, macro_f1,  accuracy,  macro_f1