code: def deterministic_perturbations(
      set_path: str, ids_path: str, percent: int
  ):
      with open(ids_path, "r") as f:
          indices = json.load(f)
      for root, _dirnames, filenames in os.walk(set_path):
          for filename in filenames:
              if "jsonl" in filename:
                  set_name = root.split("/")[-1]
                  if set_name not in indices:
                      raise ValueError(
                          f"Perturbation IDs not found for set {set_name}. Available sets are {indices.keys()}"
                      )
                  if filename not in indices[set_name]:
                      raise ValueError(
                          f"Perturbation IDs not found for file {filename} in {set_name}"
                      )
                  out_file_name = f"{percent}%_{filename}"
                  neg_samples = list(
                      read_negative_file(
                          root,
                          filename,
                      )
                  )
                  restore_and_write(
                      samples=neg_samples,
                      indices=indices[set_name][filename],
                      directory=os.path.join(opt["out_dir"], set_name),
                      output_file=out_file_name,
                  )
  
file_path: ParlAI/projects/roscoe/roscoe_data/restore_data.py
imports: import copy
  import json
  import os
  import random
  from typing import Any, Dict, Iterable, List, Set
  from parlai.core.params import ParlaiParser
label_desc: Use image node_id 8 for calling a global function with example usage: deterministic_perturbations(set_path, ids_path, percent) without return types