From cf30a361268ee8dc078fbaba7e9edcac3713c66d 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) --- tools/train.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/train.py b/tools/train.py index 274cdff9f..718a46b7b 100644 --- a/tools/train.py +++ b/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