code: def main(args):
      def make_path(p):
          import pathlib  # make sure out path exists
  
          pathlib.Path(os.path.dirname(p)).mkdir(
              parents=True, exist_ok=True
          )
  
      def save_scores_map(path, metric_to_score):
          print("saving scores to", path)
          datas = pandas.DataFrame.from_dict(metric_to_score)
          ordered = [
              x
              for x in BASELINE_SCORES
              if x in list(metric_to_score.keys())
          ]
          datas = datas.reindex(columns=ordered)
          make_path(path)
          with open(path, "w+") as f:
              datas.to_csv(f)
  
      print(
          "========================================= Done with module includes"
      )
      datasets = args.dataset
      if "test" in datasets:
          datasets = ["test"]
      elif "human" in datasets:
          datasets = INPUT_DATA_FILES_HUMAN
      elif "synthetic" in datasets:
          datasets = INPUT_DATA_SYNTHETIC
      print("Getting scores for datasets", datasets)
      print("On scores", args.score)
  
      scorers_classes = set([SCORES_TO_CLASS[x] for x in args.score])
      scorers = [x() for x in scorers_classes]
      score_path_name = "-".join(args.score)
  
      use_ref = [
          x for x in UseRef if x.value in args.use_ref
      ]  # string -> enum conversion
  
      print("Using reference types", use_ref)
  
      print(
          "========================================= Done loading scorers; iterating through datasets"
      )
  
      for dataset in datasets:
          print("Scoring dataset", dataset)
          datas = BaselineDataLoader.load_data(dataset)
          print("Data loaded, about to start scoring")
          for out_name, examples in datas.items():
              with_ref_scores = {}
              no_ref_scores = {}
              for scorer in scorers:
                  scores_raw = scorer.score_data(examples, use_ref)
                  if UseRef.YES in scores_raw:
                      for metric, scores in scores_raw[
                          UseRef.YES
                      ].items():
                          if len(scores) > 0:
                              with_ref_scores[metric] = scores
                          else:
                              print(
                                  "with ref length of 0:",
                                  dataset,
                                  out_name,
                                  metric,
                              )
                  if UseRef.NO in scores_raw:
                      for metric, scores in scores_raw[
                          UseRef.NO
                      ].items():
                          if len(scores) > 0:
                              no_ref_scores[metric] = scores
                          else:
                              print(
                                  "no ref length of 0:",
                                  dataset,
                                  out_name,
                                  metric,
                              )
              # Now we've got all our scores, save them
              out_for_dataset = os.path.join(
                  args.out_dir, dataset, score_path_name
              )
              make_path(out_for_dataset)
  
              if len(with_ref_scores) > 0:
                  save_scores_map(
                      os.path.join(
                          out_for_dataset, f"{out_name}-with_ref.csv"
                      ),
                      with_ref_scores,
                  )
  
              if len(no_ref_scores) > 0:
                  save_scores_map(
                      os.path.join(
                          out_for_dataset, f"{out_name}-no_ref.csv"
                      ),
                      no_ref_scores,
                  )
  
file_path: ParlAI/projects/roscoe/baselines/run.py
imports: import argparse
  import glob
  import os
  from typing import Dict, List
  import pandas
  import json
  from projects.roscoe.utils import split_gsm8k_gpt3_generations_to_steps
  from projects.roscoe.synthetic_evaluation.synthetic_roscoe import SyntheticChain
  from projects.roscoe.baselines.constants import Example, UseRef, BASELINE_SCORES, INPUT_DATA_SYNTHETIC, INPUT_DATA_FILES_HUMAN, INPUT_DATA_HUMAN, ALL_DATASETS, PERTURBATIONS
  from projects.roscoe.baselines.scores import SCORES_TO_CLASS
  from nltk import sent_tokenize
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) without return types