def __init__(self, config): dg.MultiSlotDataGenerator.__init__(self) if os.path.isfile(config): with open(config, 'r') as rb: _config = yaml.load(rb.read(), Loader=yaml.FullLoader) else: raise ValueError("reader config only support yaml") envs.set_global_envs(_config) envs.update_workspace()
def create(config): _config = None if os.path.isfile(config): with open(config, 'r') as rb: _config = yaml.load(rb.read(), Loader=yaml.FullLoader) else: raise ValueError("paddlerec's config only support yaml") envs.set_global_envs(_config) envs.update_workspace() trainer = TrainerFactory._build_trainer(config) return trainer
def __init__(self, config=None): super(TranspileTrainer, self).__init__(config) self._env = self._config self.processor_register() self._model = {} self._dataset = {} envs.set_global_envs(self._config) envs.update_workspace() self._runner_name = envs.get_global_env("mode") device = envs.get_global_env("runner." + self._runner_name + ".device") if device == 'gpu': self._place = fluid.CUDAPlace(0) elif device == 'cpu': self._place = fluid.CPUPlace() self._exe = fluid.Executor(self._place)
def create(config): _config = envs.load_yaml(config) envs.set_global_envs(_config) envs.update_workspace() trainer = TrainerFactory._build_trainer(config) return trainer
def __init__(self, config): dg.MultiSlotDataGenerator.__init__(self) _config = envs.load_yaml(config) envs.set_global_envs(_config) envs.update_workspace()