code: def compute_file_ppl(output_filename):
      with open(output_filename, "r") as f:
          run_results = json.load(f)
      nlls = []
      lengths = []
      for i, _res in enumerate(run_results["scored_results"]):
          print(_res)
          nlls.append(_res[0])
          lengths.append(_res[1])
      file_ppl = np.exp(-np.sum(nlls) / np.sum(lengths))
      print("wikitext-2 ppl: %.4f" % file_ppl)
  
file_path: OpenNMT-py/eval_llm/WIKITEXT2/run_wikitext-2_benchmark.py
imports: import copy
  import json
  import numpy
  import os
  import pyonmttok
  import time
  from onmt.constants import CorpusTask, DefaultTokens
  from onmt.inference_engine import InferenceEnginePY
  from onmt.inputters.dynamic_iterator import build_dynamic_dataset_iter
  import onmt.opts
  from onmt.utils.logging import init_logger
  from onmt.utils.parse import ArgumentParser
  from onmt.utils.misc import use_gpu, set_random_seed
  from onmt.transforms import get_transforms_cls
label_desc: Use image node_id 1 for calling a global function with example usage: compute_file_ppl(output_filename) without return types