Commit 0a4911f6 authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Small fix for trainer

Summary: Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/711

Differential Revision: D16192752

Pulled By: myleott

fbshipit-source-id: 102ed337a3d31e2047be7c033e9007c04223a684
parent 2bf7e75d
...@@ -158,7 +158,7 @@ class Trainer(object): ...@@ -158,7 +158,7 @@ class Trainer(object):
extra_state = state['extra_state'] extra_state = state['extra_state']
self._optim_history = state['optimizer_history'] self._optim_history = state['optimizer_history']
last_optim_state = state['last_optimizer_state'] last_optim_state = state.get('last_optimizer_state', None)
if last_optim_state is not None and not reset_optimizer: if last_optim_state is not None and not reset_optimizer:
# rebuild optimizer after loading model, since params may have changed # rebuild optimizer after loading model, since params may have changed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment