Пример #1
0
    def _set_saved_config(self):
        saved_config_dict = self.model_checkpoint["config"]
        self.config_dict = saved_config_dict

        logger.info("Load saved_config ...")
        logger.info(pretty_json_dumps(saved_config_dict))

        saved_config = NestedNamespace()
        saved_config.load_from_json(saved_config_dict)

        is_use_gpu = self.config.use_gpu

        self.config = saved_config
        self.config.use_gpu = is_use_gpu
Пример #2
0
    def _set_saved_config(self, cuda_devices):
        saved_config_dict = self.model_checkpoint["config"]
        saved_config_dict["iterator"]["batch_size"] = saved_config_dict[
            "iterator"]["batch_size"] // len(cuda_devices)
        self.config_dict = saved_config_dict

        logger.info("Load saved_config ...")
        logger.info(pretty_json_dumps(saved_config_dict))

        saved_config = NestedNamespace()
        saved_config.load_from_json(saved_config_dict)

        is_use_gpu = self.config.use_gpu

        self.config = saved_config
        self.config.use_gpu = is_use_gpu
        self.config.cuda_devices = cuda_devices