From 50fc7d0eaececb45bf36adf854c96035a9d2599b Mon Sep 17 00:00:00 2001 From: cuicheng01 Date: Tue, 20 Sep 2022 10:06:20 +0000 Subject: [PATCH] fix bugs to adapt to the new framework --- ppcls/engine/evaluation/classification.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ppcls/engine/evaluation/classification.py b/ppcls/engine/evaluation/classification.py index 647a8217..45eccf71 100644 --- a/ppcls/engine/evaluation/classification.py +++ b/ppcls/engine/evaluation/classification.py @@ -81,7 +81,8 @@ def classification_eval(engine, epoch_id=0): # gather Tensor when distributed if paddle.distributed.get_world_size() > 1: label_list = [] - label = batch[1].cuda() if engine.config["Global"][ + device_id = paddle.distributed.ParallelEnv().device_id + label = batch[1].cuda(device_id) if engine.config["Global"][ "device"] == "gpu" else batch[1] paddle.distributed.all_gather(label_list, label) labels = paddle.concat(label_list, 0) -- GitLab