def _load_config(self) -> None: """ Load the global config for reference in :attr:`config` and set the faceswap blocks configuration options in `lib.model.nn_blocks` """ global _CONFIG # pylint: disable=global-statement if not _CONFIG: model_name = self._config_section logger.debug("Loading config for: %s", model_name) _CONFIG = Config(model_name, configfile=self._configfile).config_dict nn_block_keys = ['icnr_init', 'conv_aware_init', 'reflect_padding'] set_nnblock_config({key: _CONFIG.pop(key) for key in nn_block_keys})
def load_config(self): """ Load the global config for reference in self.config """ global _CONFIG # pylint: disable=global-statement if not _CONFIG: model_name = self.config_section logger.debug("Loading config for: %s", model_name) _CONFIG = Config(model_name, configfile=self.configfile).config_dict
def config(self): """ Return config dict for current plugin """ global _CONFIG # pylint: disable=global-statement if not _CONFIG: model_name = ".".join(self.__module__.split(".")[-2:]) logger.debug("Loading config for: %s", model_name) _CONFIG = Config(model_name).config_dict return _CONFIG
def config(self): """ Return config dict for current plugin """ global _CONFIG # pylint: disable=global-statement if not _CONFIG: model_name = self.config_section logger.debug("Loading config for: %s", model_name) _CONFIG = Config(model_name).config_dict return _CONFIG
def config(self) -> dict: """ dict: The configuration dictionary for current plugin, as set by the user's configuration settings. """ global _CONFIG # pylint: disable=global-statement if not _CONFIG: model_name = self._config_section logger.debug("Loading config for: %s", model_name) _CONFIG = Config(model_name, configfile=self._configfile).config_dict return _CONFIG
def _get_config(plugin_name, configfile=None): """ Return the configuration for the requested trainer. Parameters ---------- plugin_name: str The name of the plugin to load the configuration for configfile: str, optional A custom configuration file. If ``None`` then configuration is loaded from the default :file:`.config.train.ini` file. Default: ``None`` Returns ------- :class:`lib.config.FaceswapConfig` The configuration file for the requested plugin """ return Config(plugin_name, configfile=configfile).config_dict
def get_config(plugin_name, configfile=None): """ Return the config for the requested model """ return Config(plugin_name, configfile=configfile).config_dict
def _config_changeable_items(self) -> dict: """ dict: The configuration options that can be updated after the model has already been created. """ return Config(self._config_section, configfile=self._configfile).changeable_items
def config_changeable_items(self): """ Return the dict of config items that can be updated after the model has been created """ return Config(self.config_section, configfile=self.configfile).changeable_items