Skip to content

Commit

Permalink
Update trainer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zkyseu authored Dec 19, 2022
1 parent 76b9eec commit 1440efc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pplanedet/engine/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def __init__(self, cfg):
scale_loss = amp_cfg.pop('scale_loss')
self.scaler = paddle.amp.GradScaler(init_loss_scaling=scale_loss)
amp_cfg['models'] = self.model
self.model = paddle.amp.decorate(**amp_cfg) # decorate for level O2
if amp_cfg['level'] == 'O2':
self.model = paddle.amp.decorate(**amp_cfg) # decorate for level O2

# ZeRO
self.sharding_strategies = cfg.get('sharding', False)
Expand Down

0 comments on commit 1440efc

Please sign in to comment.