code: def score_and_save(
      evaluator: SyntheticEvaluator,
      subdirectory: str,
      root: str,
      data_filename: str,
      score_types: List[str],
      out_dir: str,
  ) -> None:
      d = root.split("/")[-1]
      if len(d) == 0:
          d = root.split("/")[-2]
  
      out_path = os.path.join(
          out_dir,
          subdirectory,
          f"scores_{d + '_' + data_filename.split('.')[0]}.tsv",
      )
      if os.path.exists(out_path):
          print(
              f"Score file for {data_filename} already exists. Skipping."
          )
          return
  
      print(f"Evaluating {os.path.join(root, data_filename)}")
      evaluator.update_evaluator(os.path.join(root, data_filename))
      scores = evaluator.evaluate(score_types=score_types)
      save_scores(scores, out_path)
      print_and_reset_max_gpu_memory()
  
file_path: ParlAI/projects/roscoe/synthetic_evaluation/synthetic_roscoe.py
imports: import json
  import os
  from typing import List
  from projects.roscoe.score import EMBEDDING_MODEL_NAMES, EMBEDDING_MODELS, SEQ_EMB_MODEL_TYPES, Chain, Evaluator, REASONING_SCORES, SCORE_GROUPS, select_semantic_scores, select_inference_scores, select_language_scores, SENT_TRANS
  from projects.roscoe.utils import print_and_reset_max_gpu_memory, save_scores
  from parlai.core.params import ParlaiParser
label_desc: Use image node_id 1 for calling a global function with example usage: score_and_save(evaluator, subdirectory, root, data_filename, score_types, out_dir) without return types