code: def load_config(
      user_config: Dict,
  ):
      cfg = copy.deepcopy(default_args)
  
      if user_config:
          cfg.update(**user_config)
  
      for k in user_config.keys():
          if k not in cfg:
              warnings.warn(f"unknown argument {k}, ignored")
  
      for k, v in cfg.items():
          if k in (
              "batch_size",
              "display_rate",
              "seed",
              "skip_steps",
              "steps",
              "n_batches",
              "cutn_batches",
          ) and isinstance(v, float):
              cfg[k] = int(v)
          if k == "width_height":
              cfg[k] = [int(vv) for vv in v]
  
      cfg.update(
          **{
              "seed": cfg["seed"] or random.randint(0, 2**32),
          }
      )
  
      if cfg["batch_name"]:
          da_name = f'{__package__}-{cfg["batch_name"]}-{cfg["seed"]}'
      else:
          da_name = f'{__package__}-{cfg["seed"]}'
          warnings.warn(
              "you did not set `batch_name`, set it to have unique session ID"
          )
  
      cfg.update(**{"name_docarray": da_name})
  
      print_args_table(cfg)
  
      return SimpleNamespace(**cfg)
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_clip_rn50/reverse_diffusion/config.py
imports: import copy
  import random
  import warnings
  from types import SimpleNamespace
  from typing import Dict
  import yaml
  from yaml import Loader
  from .None import __resources_path__
label_desc: Use image node_id 1 for calling a global function with example usage: load_config(user_config) and returns: SimpleNamespace