diff --git a/ppdet/engine/trainer.py b/ppdet/engine/trainer.py index 0378e00ecb548747ca0996bc206b22d498f8b301..2a2fc766d727420c26bead1d98ad1d4d8e438f4c 100644 --- a/ppdet/engine/trainer.py +++ b/ppdet/engine/trainer.py @@ -429,10 +429,8 @@ class Trainer(object): model = self.model if self.cfg.get('to_static', False): model = apply_to_static(self.cfg, model) - sync_bn = ( - getattr(self.cfg, 'norm_type', None) == 'sync_bn' and - (self.cfg.use_gpu or self.cfg.use_npu or self.cfg.use_mlu) and - self._nranks > 1) + sync_bn = (getattr(self.cfg, 'norm_type', None) == 'sync_bn' and + (self.cfg.use_gpu or self.cfg.use_mlu) and self._nranks > 1) if sync_bn: model = paddle.nn.SyncBatchNorm.convert_sync_batchnorm(model) diff --git a/ppdet/modeling/heads/sparsercnn_head.py b/ppdet/modeling/heads/sparsercnn_head.py index 801ff04fb772aec568dd94d9d4916d2b778e88fe..0534cf4ad704001b07fdd9c898e68dc6606a4f4b 100644 --- a/ppdet/modeling/heads/sparsercnn_head.py +++ b/ppdet/modeling/heads/sparsercnn_head.py @@ -317,12 +317,15 @@ class SparseRCNNHead(nn.Layer): pooler_scales = [1.0 / 4.0, 1.0 / 8.0, 1.0 / 16.0, 1.0 / 32.0] end_level = 3 + aligned = True + if paddle.device.is_compiled_with_custom_device('npu'): + aligned = False box_pooler = RoIAlign( resolution=pooler_resolution, spatial_scale=pooler_scales, sampling_ratio=sampling_ratio, end_level=end_level, - aligned=True) + aligned=aligned) return box_pooler def forward(self, features, input_whwh):