Exemplo n.º 1
0
    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})
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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
Exemplo n.º 6
0
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
Exemplo n.º 7
0
def get_config(plugin_name, configfile=None):
    """ Return the config for the requested model """
    return Config(plugin_name, configfile=configfile).config_dict
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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