    def load_from_yaml(self, path2yaml: str = None) -> "TrainingConfig":
        """
        Load training configuration from yaml.

        Args:
            path2yaml (`str`):
                The path to yaml.
        Return:
            (`TrainingConfig`).
                TrainingConfig instance self.

        Example:
            >>> from towhee.trainer.training_config import TrainingConfig
            >>> from pathlib import Path
            >>> conf = Path(__file__).parent / "config.yaml"
            >>> ta = TrainingConfig()
            >>> ta.save_to_yaml(conf)
            >>> ta.load_from_yaml(conf)
            >>> ta.epoch_num
            2
        """
        with open(path2yaml, "r", encoding="utf-8") as f:
            config_dict = load_yaml(f)
            for file_category in config_dict:
                if file_category not in self.config_category_set:
                    trainer_log.warning("category %s is not a attribute in TrainingConfig", file_category)
            for category in self.config_category_set:
                category_dict = config_dict.get(category, {})
                self._set_attr_from_dict(category_dict)
            return self
Load training configuration from yaml.

Args:
path2yaml (`str`):
The path to yaml.
Return:
(`TrainingConfig`).
TrainingConfig instance self.

Example:
>>> from towhee.trainer.training_config import TrainingConfig
>>> from pathlib import Path
>>> conf = Path(__file__).parent / "config.yaml"
>>> ta = TrainingConfig()
>>> ta.save_to_yaml(conf)
>>> ta.load_from_yaml(conf)
>>> ta.epoch_num
2
towhee/trainer/training_config.py