From b2a6586d9f5033585e3e773a7cfb4c5a975b57a9 Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Thu, 4 Jul 2019 11:16:23 +0800 Subject: [PATCH] not enable syncbn in cpu (#2711) --- PaddleCV/PaddleDetection/tools/train.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PaddleCV/PaddleDetection/tools/train.py b/PaddleCV/PaddleDetection/tools/train.py index 274cdff9..718a46b7 100644 --- a/PaddleCV/PaddleDetection/tools/train.py +++ b/PaddleCV/PaddleDetection/tools/train.py @@ -126,8 +126,9 @@ def main(): build_strategy.memory_optimize = False build_strategy.enable_inplace = True sync_bn = getattr(model.backbone, 'norm_type', None) == 'sync_bn' - # only enable sync_bn in multi-devices - build_strategy.sync_batch_norm = sync_bn and devices_num > 1 + # only enable sync_bn in multi GPU devices + build_strategy.sync_batch_norm = sync_bn and devices_num > 1 \ + and cfg.use_gpu train_compile_program = fluid.compiler.CompiledProgram( train_prog).with_data_parallel( loss_name=loss.name, build_strategy=build_strategy) -- GitLab