class_docstr: Parse training configuration. Only supports yaml/yml file.
  
  The following hyper-parameters are available in the config file:
      batch_size: The number of samples per gpu.
      iters: The total training steps.
      train_dataset: A training data config including type/data_root/transforms/mode.
          For data type, please refer to medseg.datasets.
          For specific transforms, please refer to medseg.transforms.transforms.
      val_dataset: A validation data config including type/data_root/transforms/mode.
      optimizer: A optimizer config, currently medseg only supports sgd with momentum in config file.
          In addition, weight_decay could be set as a regularization.
      learning_rate: A learning rate config. If decay is configured, learning _rate value is the starting learning rate,
           where only poly decay is supported using the config file. In addition, decay power and end_lr are tuned experimentally.
      loss: A loss config. Multi-loss config is available. The loss type order is consistent with the seg model outputs,
          where the coef term indicates the weight of corresponding loss. Note that the number of coef must be the same as the number of
          model outputs, and there could be only one loss type if using the same loss type among the outputs, otherwise the number of
          loss type must be consistent with coef.
      model: A model config including type/backbone and model-dependent arguments.
          For model type, please refer to medseg.models.
          For backbone, please refer to medseg.models.backbones.
  
  Args:
      path (str) : The path of config file, only supports yaml format.
  
  Examples:
  
      from medseg.cvlibs.config import Config
  
      # Create a cfg object with yaml file path.
      cfg = Config(yaml_cfg_path)
  
      # Parsing the argument when its property is used.
      train_dataset = cfg.train_dataset
  
      # model builder uses some properties in dataset
      # so model argument should be parsed after dataset.
      model = cfg.model
      ...
class_docstr_tok: ["Parse","training","configuration",".","Only","supports","yaml\/yml","file",".","The","following","hyper-parameters","are","available","in","the","config","file",":","batch_size",":","The","number","of","samples","per","gpu",".","iters",":","The","total","training","steps",".","train_dataset",":","A","training","data","config","including","type\/data_root\/transforms\/mode",".","For","data","type",",","please","refer","to","medseg.datasets",".","For","specific","transforms",",","please","refer","to","medseg.transforms.transforms",".","val_dataset",":","A","validation","data","config","including","type\/data_root\/transforms\/mode",".","optimizer",":","A","optimizer","config",",","currently","medseg","only","supports","sgd","with","momentum","in","config","file",".","In","addition",",","weight_decay","could","be","set","as","a","regularization",".","learning_rate",":","A","learning","rate","config",".","If","decay","is","configured",",","learning","_rate","value","is","the","starting","learning","rate",",","where","only","poly","decay","is","supported","using","the","config","file",".","In","addition",",","decay","power","and","end_lr","are","tuned","experimentally",".","loss",":","A","loss","config",".","Multi-loss","config","is","available",".","The","loss","type","order","is","consistent","with","the","seg","model","outputs",",","where","the","coef","term","indicates","the","weight","of","corresponding","loss",".","Note","that","the","number","of","coef","must","be","the","same","as","the","number","of","model","outputs",",","and","there","could","be","only","one","loss","type","if","using","the","same","loss","type","among","the","outputs",",","otherwise","the","number","of","loss","type","must","be","consistent","with","coef",".","model",":","A","model","config","including","type\/backbone","and","model-dependent","arguments",".","For","model","type",",","please","refer","to","medseg.models",".","For","backbone",",","please","refer","to","medseg.models.backbones",".","Args",":","path","(","str",")",":","The","path","of","config","file",",","only","supports","yaml","format",".","Examples",":","from","medseg.cvlibs.config","import","Config","#","Create","a","cfg","object","with","yaml","file","path",".","cfg","=","Config","(","yaml_cfg_path",")","#","Parsing","the","argument","when","its","property","is","used",".","train_dataset","=","cfg.train_dataset","#","model","builder","uses","some","properties","in","dataset","#","so","model","argument","should","be","parsed","after","dataset",".","model","=","cfg.model","..."]
docstr: Parse a yaml file and build config
docstr_tok: ["Parse","a","yaml","file","and","build","config"]
code: def _parse_from_yaml(self, path: str):
      """Parse a yaml file and build config"""
      with codecs.open(path, "r", "utf-8") as file:
          dic = yaml.load(file, Loader=yaml.FullLoader)
  
      if "_base_" in dic:
          cfg_dir = os.path.dirname(path)
          base_path = dic.pop("_base_")
          base_path = os.path.join(cfg_dir, base_path)
          base_dic = self._parse_from_yaml(base_path)
          dic = self._update_dic(dic, base_dic)
  
      return dic
  
imports: import codecs
  import os
  import warnings
  from typing import Any, Dict, Generic
  import paddle
  import yaml
  from medicalseg.cvlibs import manager
  from medicalseg.utils import logger, get_sys_env
label_desc: Use image node_id 3 for calling the Config obj's underlying member method code with example usage: obj._parse_from_yaml(path) and returns: dic