code: def compute_metric(output_filename):
      with open(output_filename, "r") as f:
          run_results = json.load(f)
      total_acc = 0
      total_num = 0
      for task in run_results:
          acc = 0
          pred_answers = run_results[task]["pred_answers"]
          gold_answers = run_results[task]["gold_answers"]
          for pred, gold in zip(pred_answers, gold_answers):
              if pred == gold:
                  acc += 1
          print("ACC-%s: %.4f" % (task, acc / len(gold_answers)))
          total_acc += acc
          total_num += len(gold_answers)
      print("ACC-all: %.4f" % (total_acc / total_num))
  
file_path: OpenNMT-py/eval_llm/MMLU/run_mmlu_opennmt.py
imports: import json
  import os
  import time
  import pandas
  from onmt.utils.logging import init_logger
  from onmt.inference_engine import InferenceEnginePY
  import onmt.opts
  from onmt.utils.parse import ArgumentParser
  from onmt.utils.misc import use_gpu, set_random_seed
label_desc: Use image node_id 1 for calling a global function with example usage: compute_metric(output_filename) without return types