class_docstr: The base class for building components. 
  
  Args:
      config (Config): A Config class.
      comp_list (list, optional): A list of component classes. Default: None
docstr: Create Python object, such as model, loss, dataset, etc.
docstr_tok: ["Create","Python","object",",","such","as","model",",","loss",",","dataset",",","etc","."]
code: def build_component(self, cfg):
      """
      Create Python object, such as model, loss, dataset, etc.
      """
      cfg = copy.deepcopy(cfg)
      if "type" not in cfg:
          raise RuntimeError(
              "It is not possible to create a component object from {}, as 'type' is not specified.".format(
                  cfg
              )
          )
  
      class_type = cfg.pop("type")
      com_class = self.load_component_class(class_type)
  
      params = {}
      for key, val in cfg.items():
          if self.is_meta_type(val):
              params[key] = self.build_component(val)
          elif isinstance(val, list):
              params[key] = [
                  self.build_component(item)
                  if self.is_meta_type(item)
                  else item
                  for item in val
              ]
          else:
              params[key] = val
  
      try:
          obj = self.build_component_impl(com_class, **params)
      except Exception as e:
          if hasattr(com_class, "__name__"):
              com_name = com_class.__name__
          else:
              com_name = ""
          raise RuntimeError(
              f"Tried to create a {com_name} object, but the operation has failed. "
              "Please double check the arguments used to create the object.\n"
              f"The error message is: \n{str(e)}"
          )
  
      return obj
  
imports: import copy
  from typing import Any, Optional
  import yaml
  import paddle
  from paddleseg.cvlibs import manager, Config
  from paddleseg.utils import utils, logger
  from paddleseg.utils.utils import CachedProperty
label_desc: Use image node_id 2 for calling the Builder obj's underlying member method code with example usage: obj.build_component(cfg) and returns: obj