code: def from_file(cls, filename, *args, **kwargs):
      """
      Create object from config saved in filename. Expects json or yaml file.
  
      Args:
          filename: File containing the config (json or yaml).
  
      Returns:
          any: The object generated from the file.
      """
      path = os.path.join(os.getcwd(), filename)
      if not os.path.isfile(path):
          raise FileNotFoundError(
              "File '{}' not found!".format(filename)
          )
  
      with open(path, "rt") as fp:
          if path.endswith(".yaml") or path.endswith(".yml"):
              config = yaml.safe_load(fp)
          else:
              config = json.load(fp)
  
      # Add possible *args.
      config["_args"] = args
      return from_config(cls, config=config, **kwargs)
  
file_path: ray/python/ray/rllib/utils/from_config.py
imports: from copy import deepcopy
  from functools import partial
  import importlib
  import json
  import os
  import re
  import yaml
  from ray.rllib.utils.annotations import DeveloperAPI
  from ray.rllib.utils import force_list, merge_dicts
label_desc: Use image node_id 2 for calling a global function with example usage: from_file(cls, filename) and returns: from_config