code: def process_wow_dataset(
      raw_file, processed_file, knwl_ref_file, resp_ref_file
  ):
      """
      This is a function used for processing the wizard of wikipedia (wow) dataset
      Expected processed format:
      topic \t dialogue context \t golden knowledge \t golden response
      """
  
      # loading the raw data
      print("> Loading data from %s" % raw_file)
      with open(raw_file, "r") as fr:
          dialog_data = json.load(fr)
  
      print("> Processing data ...")
      fproc = open(processed_file, "w")
      fknwl = open(knwl_ref_file, "w") if knwl_ref_file else None
      fresp = open(resp_ref_file, "w") if resp_ref_file else None
  
      for i, sample in enumerate(tqdm(dialog_data)):
          # get all the dialog data for a single dialog sample
          dialog = sample["dialog"]
  
          turn_list = []  # collect the dialog history
          # processing for each single dialog sample
          for j, turn in enumerate(dialog):
              # text of each turn
              text = turn["text"]
              if not (
                  text.endswith("?")
                  or text.endswith(".")
                  or text.endswith("!")
              ):
                  text = text + "."
  
              if j == 0:
                  # first turn
                  turn_list.append(text)
                  continue
  
              speaker = turn["speaker"].lower()
              if "wizard" in speaker:
                  checked_sentence = list(
                      turn["checked_sentence"].values()
                  )  # knowledge
                  checked_passage = list(
                      turn["checked_passage"].values()
                  )  # topic
  
                  assert len(checked_sentence) <= 1
  
                  # get the ground truth knowledge
                  if len(checked_sentence) > 0:
                      checked_sentence = checked_sentence[0]
                  else:
                      checked_sentence = "no_passages_used"
  
                  if len(checked_passage) == 1:
                      checked_passage = checked_passage[0]
                  else:
                      checked_passage = "no_passages_used"
  
                  # get the topic
                  if checked_passage != "no_passages_used":
                      topic = checked_passage
                  else:
                      topic = sample["chosen_topic"]
  
                  dialog_context = " [SEP] ".join(turn_list)
                  knowledge = checked_sentence
                  response = text
                  # add the response into the dialog history
                  turn_list.append(response)
  
                  # write to the output files
                  fproc.write(
                      topic
                      + "\t"
                      + dialog_context
                      + "\t"
                      + knowledge
                      + "\t"
                      + response
                      + "\n"
                  )
  
                  if fknwl:
                      fknwl.write(knowledge + "\n")
                  if fresp:
                      # tokenize for evaluation
                      response = " ".join(word_tokenize(response))
                      fresp.write(response + "\n")
  
              else:
                  assert "apprentice" in speaker
                  turn_list.append(text)
  
      fproc.close()
      if fknwl:
          fknwl.close()
      if fresp:
          fresp.close()
  
file_path: megatron-lm/tasks/msdp/preprocessing.py
imports: import torch
  import argparse
  from nltk import word_tokenize
  from tqdm import tqdm
  import numpy
  import json
label_desc: Use image node_id 2 for calling a global function with example usage: process_wow_dataset(raw_file, processed_file, knwl_ref_file, resp_ref_file) without return types