class_docstr: Provide methods to save, load, and overrides an omegaconf config object
  which may contain definition of lazily-constructed objects.
class_docstr_tok: ["Provide","methods","to","save",",","load",",","and","overrides","an","omegaconf","config","object","which","may","contain","definition","of","lazily-constructed","objects","."]
docstr: Load a config file.
  
  Args:
      filename: absolute path or relative path w.r.t. the current working directory
      keys: keys to load and return. If not given, return all keys
          (whose values are config objects) in a dict.
docstr_tok: ["Load","a","config","file",".","Args",":","filename",":","absolute","path","or","relative","path","w.r.t",".","the","current","working","directory","keys",":","keys","to","load","and","return",".","If","not","given",",","return","all","keys","(","whose","values","are","config","objects",")","in","a","dict","."]
code: def load(
      filename: str, keys: Union[None, str, Tuple[str, ...]] = None
  ):
      """
      Load a config file.
  
      Args:
          filename: absolute path or relative path w.r.t. the current working directory
          keys: keys to load and return. If not given, return all keys
              (whose values are config objects) in a dict.
      """
      has_keys = keys is not None
      filename = filename.replace("/./", "/")  # redundant
      if os.path.splitext(filename)[1] not in [".py", ".yaml", ".yml"]:
          raise ValueError(
              f"Config file {filename} has to be a python or yaml file."
          )
      if filename.endswith(".py"):
          _validate_py_syntax(filename)
  
          with _patch_import():
              # Record the filename
              module_namespace = {
                  "__file__": filename,
                  "__package__": _random_package_name(filename),
              }
              with PathManager.open(filename) as f:
                  content = f.read()
              # Compile first with filename to:
              # 1. make filename appears in stacktrace
              # 2. make load_rel able to find its parent's (possibly remote) location
              exec(compile(content, filename, "exec"), module_namespace)
  
          ret = module_namespace
      else:
          with PathManager.open(filename) as f:
              obj = yaml.unsafe_load(f)
          ret = OmegaConf.create(obj, flags={"allow_objects": True})
  
      if has_keys:
          if isinstance(keys, str):
              return _cast_to_config(ret[keys])
          else:
              return tuple(_cast_to_config(ret[a]) for a in keys)
      else:
          if filename.endswith(".py"):
              # when not specified, only load those that are config objects
              ret = DictConfig(
                  {
                      name: _cast_to_config(value)
                      for name, value in ret.items()
                      if isinstance(
                          value, (DictConfig, ListConfig, dict)
                      )
                      and not name.startswith("_")
                  },
                  flags={"allow_objects": True},
              )
          return ret
  
imports: import ast
  import builtins
  import collections.abc
  import importlib
  import inspect
  import logging
  import os
  import uuid
  from contextlib import contextmanager
  from copy import deepcopy
  from dataclasses import is_dataclass
  from typing import List, Tuple, Union
  import cloudpickle
  import yaml
  from omegaconf import DictConfig, ListConfig, OmegaConf, SCMode
  from detectron2.utils.file_io import PathManager
  from detectron2.utils.registry import _convert_target_to_string
label_desc: Use image node_id 2 for calling the LazyConfig obj's underlying member method code with example usage: obj.load(filename, keys) and returns: ret, _cast_to_config, tuple