class_docstr: Class that wraps all templates for a specific dataset/subset and implements all the helper
  functions necessary to read/write to the yaml file
class_docstr_tok: ["Class","that","wraps","all","templates","for","a","specific","dataset\/subset","and","implements","all","the","helper","functions","necessary","to","read\/write","to","the","yaml","file"]
docstr: Reads a file containing a prompt collection.
docstr_tok: ["Reads","a","file","containing","a","prompt","collection","."]
code: def read_from_file(self) -> Dict:
      """
      Reads a file containing a prompt collection.
      """
  
      if not os.path.exists(self.yaml_path):
          dataset_name = (
              f"{self.dataset_name} {self.subset_name}"
              if self.subset_name
              else self.dataset_name
          )
          logging.warning(
              f"Tried instantiating `DatasetTemplates` for {dataset_name}, but no prompts found. "
              "Please ignore this warning if you are creating new prompts for this dataset."
          )
          return {}
      yaml_dict = yaml.safe_load(open(self.yaml_path, "r"))
      return yaml_dict[self.TEMPLATES_KEY]
  
imports: import logging
  import os
  import random
  import re
  import uuid
  from collections import Counter, defaultdict
  from shutil import rmtree
  from typing import Dict, List, Optional, Tuple
  import pandas
  import pkg_resources
  import yaml
  from jinja2 import BaseLoader, Environment, meta
  from ..constants import AUTOMM
label_desc: Use image node_id 8 for calling the DatasetTemplates obj's underlying member method code with example usage: obj.read_from_file() and returns: yaml_dict, dict