Skip to content

Commit

Permalink
Fix ddp+ema+qat flow (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
KSGulin authored Sep 30, 2022
1 parent a5a02dc commit 67a661a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
LOGGER.info('%s has been trained for %g epochs. Fine-tuning for %g additional epochs.' %
(weights, start_epoch-1, epochs))
epochs += start_epoch # finetune additional epochs
if sparseml_wrapper.qat_active(start_epoch):
if sparseml_wrapper.qat_active(start_epoch) and ema:
ema.enabled = False

# Optimizer
Expand Down Expand Up @@ -353,7 +353,8 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
LOGGER.info('Disabling half precision and EMA, QAT scheduled to run')
half_precision = False
scaler._enabled = False
ema.enabled = False
if ema:
ema.enabled = False
model.train()

# Update image weights (optional, single-GPU only)
Expand Down

0 comments on commit 67a661a

Please sign in to comment.