code: def load_config_file(opts):
      config_file_name = getattr(opts, "common.config_file", None)
      if config_file_name is None:
          return opts
      is_master_node = is_master(opts)
  
      if is_master_node:
          config_file_name = get_local_path(
              opts=opts, path=config_file_name
          )
  
      if not os.path.isfile(config_file_name):
          if len(config_file_name.split("/")) == 1:
              # loading files from default config folder
              new_config_file_name = "{}/{}".format(
                  DEFAULT_CONFIG_DIR, config_file_name
              )
              if (
                  not os.path.isfile(new_config_file_name)
                  and is_master_node
              ):
                  logger.error(
                      "Configuration file neither exists at {} nor at {}".format(
                          config_file_name, new_config_file_name
                      )
                  )
              else:
                  config_file_name = new_config_file_name
          else:
              # If absolute path of the file is passed
              if (
                  not os.path.isfile(config_file_name)
                  and is_master_node
              ):
                  logger.error(
                      "Configuration file does not exists at {}".format(
                          config_file_name
                      )
                  )
  
      setattr(opts, "common.config_file", config_file_name)
      with open(config_file_name, "r") as yaml_file:
          try:
              cfg = yaml.load(yaml_file, Loader=yaml.FullLoader)
              flat_cfg = flatten_yaml_as_dict(cfg)
              for k, v in flat_cfg.items():
                  if hasattr(opts, k):
                      setattr(opts, k, v)
                  elif "local_" not in k and not re.match(
                      META_PARAMS_REGEX, k
                  ):
                      logger.warning(UnrecognizedYamlConfigEntry(k))
          except yaml.YAMLError as exc:
              if is_master_node:
                  logger.error(
                      "Error while loading config file: {}. Error message: {}".format(
                          config_file_name, str(exc)
                      )
                  )
  
      # override arguments
      override_args = getattr(opts, "override_args", None)
      if override_args is not None:
          for override_k, override_v in override_args.items():
              if hasattr(opts, override_k):
                  setattr(opts, override_k, override_v)
              elif "local_" not in k and not re.match(
                  META_PARAMS_REGEX, k
              ):
                  logger.warning(
                      UnrecognizedYamlConfigEntry(override_k)
                  )
  
      return opts
  
file_path: ml-cvnets/options/utils.py
imports: import argparse
  import collections
  import os
  import re
  import yaml
  from options.errors import UnrecognizedYamlConfigEntry
  from utils import logger
  from utils.ddp_utils import is_master
  from utils.download_utils import get_local_path
label_desc: Use image node_id 2 for calling a global function with example usage: load_config_file(opts) and returns: opts, opts