Skip to content

Commit

Permalink
Add lr_scheduler check for inference.
Browse files Browse the repository at this point in the history
Signed-off-by: Dashiell Stander <[email protected]>
  • Loading branch information
dashstander committed Oct 17, 2023
1 parent f6ac04d commit a97bd1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion megatron/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,9 @@ def setup_model_and_optimizer(neox_args, use_cache=False, iteration=None):
neox_args.iteration = 0

# need this for correct lr scheduling resume from ckpt
lr_scheduler.optimizer = model.optimizer
# but it will not exist if this is being called for inference
if lr_scheduler is not None:
lr_scheduler.optimizer = model.optimizer

return model, optimizer, lr_scheduler

Expand Down

0 comments on commit a97bd1f

Please sign in to comment.