fix eval
@@ -55,11 +55,14 @@ def main(args, return_dict={}):
place = 'gpu:{}'.format(ParallelEnv().dev_id) if use_gpu else 'cpu'
place = paddle.set_device(place)
- paddle.disable_static(place)
+ use_data_parallel = int(os.getenv("PADDLE_TRAINERS_NUM", 1)) != 1
+ config["use_data_parallel"] = use_data_parallel
- strategy = paddle.distributed.init_parallel_env()
net = program.create_model(config.ARCHITECTURE, config.classes_num)
+ if config["use_data_parallel"]:
+ strategy = paddle.distributed.init_parallel_env()
net = paddle.DataParallel(net, strategy)
+
init_model(config, net, optimizer=None)
valid_dataloader = Reader(config, 'valid', places=place)()
net.eval()
