code: def eval_model(args):
      # set up trainer
      trainer_config = {
          "model_path": None,
          "load_name": args.load_name,
          "batch_size": args.batch_size,
      }
      trainer = Trainer(
          trainer_config, load_model=True, device=args.device
      )
      # load test data
      test_data = DataLoader(args.device)
      test_files = [
          f"{args.data_dir}/{x}"
          for x in os.listdir(args.data_dir)
          if args.eval_set in x
      ]
      test_data.load_data(
          args.batch_size,
          test_files,
          trainer.model.char_to_idx,
          trainer.model.tag_to_idx,
          randomize=False,
          max_length=args.eval_length,
      )
      (
          curr_accuracy,
          curr_confusion_matrix,
          curr_precisions,
          curr_recalls,
          curr_f1s,
      ) = eval_trainer(
          trainer,
          test_data,
          batch_mode=args.batch_mode,
          fine_grained=not args.merge_labels_for_eval,
      )
      logger.info(
          f"{datetime.now()}\t{args.eval_set} accuracy: {curr_accuracy}"
      )
      eval_save_path = (
          args.save_name
          if args.save_name
          else score_log_path(args.load_name)
      )
      if not os.path.exists(eval_save_path) or args.save_name:
          with open(eval_save_path, "w") as score_log_file:
              for score_log in [
                  {"dev_accuracy": curr_accuracy},
                  curr_confusion_matrix,
                  curr_precisions,
                  curr_recalls,
                  curr_f1s,
              ]:
                  score_log_file.write(json.dumps(score_log) + "\n")
  
file_path: stanza/stanza/models/lang_identifier.py
imports: import argparse
  import json
  import logging
  import os
  import random
  import torch
  from datetime import datetime
  from stanza.models.common import utils
  from stanza.models.langid.data import DataLoader
  from stanza.models.langid.trainer import Trainer
  from stanza.utils.get_tqdm import get_tqdm
label_desc: Use image node_id 7 for calling a global function with example usage: eval_model(args) without return types