"vscode:/vscode.git/clone" did not exist on "1fcb811a8e6351be60304b1d4a4a749c36541651"
Commit b41c74dc authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Add code for "Pay Less Attention with Lightweight and Dynamic Convolutions" (#473)

Summary:
Changelog:
- `e330f56`: Add code for the "Pay Less Attention with Lightweight and Dynamic Convolutions" paper
- `5e3b98c`: Add scripts for computing tokenized BLEU with compound splitting and sacrebleu
- update READMEs
- misc fixes
Pull Request resolved: https://github.com/pytorch/fairseq/pull/473

Differential Revision: D13819717

Pulled By: myleott

fbshipit-source-id: f2dc12ea89a436b950cafec3593ed1b04af808e9
parent bc8ae449
...@@ -328,6 +328,9 @@ def save_checkpoint(args, trainer, epoch_itr, val_loss): ...@@ -328,6 +328,9 @@ def save_checkpoint(args, trainer, epoch_itr, val_loss):
def load_checkpoint(args, trainer, epoch_itr): def load_checkpoint(args, trainer, epoch_itr):
"""Load a checkpoint and replay dataloader to match.""" """Load a checkpoint and replay dataloader to match."""
os.makedirs(args.save_dir, exist_ok=True) os.makedirs(args.save_dir, exist_ok=True)
if os.path.isabs(args.restore_file):
checkpoint_path = args.restore_file
else:
checkpoint_path = os.path.join(args.save_dir, args.restore_file) checkpoint_path = os.path.join(args.save_dir, args.restore_file)
if os.path.isfile(checkpoint_path): if os.path.isfile(checkpoint_path):
extra_state = trainer.load_checkpoint(checkpoint_path, args.reset_optimizer, args.reset_lr_scheduler, extra_state = trainer.load_checkpoint(checkpoint_path, args.reset_optimizer, args.reset_lr_scheduler,
...@@ -344,6 +347,8 @@ def load_checkpoint(args, trainer, epoch_itr): ...@@ -344,6 +347,8 @@ def load_checkpoint(args, trainer, epoch_itr):
if 'best' in extra_state: if 'best' in extra_state:
save_checkpoint.best = extra_state['best'] save_checkpoint.best = extra_state['best']
return True return True
else:
print('| no existing checkpoint found {}'.format(checkpoint_path))
return False return False
......
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