Skip to content

Commit

Permalink
Post-rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mryab committed Dec 27, 2021
1 parent 2436a7a commit b829c7f
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions examples/albert/run_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,6 @@ def setup_transformers_logging(process_rank: int):
transformers.utils.logging.enable_propagation()


def get_model(training_args, config, tokenizer):
# Find latest checkpoint in output_dir
output_dir = Path(training_args.output_dir)
logger.info(f'Checkpoint dir {output_dir}, contents {list(output_dir.glob("checkpoint*"))}')
latest_checkpoint_dir = max(output_dir.glob("checkpoint*"), default=None, key=os.path.getctime)

if latest_checkpoint_dir is not None:
logger.info(f"Loading model from {latest_checkpoint_dir}")
model = AlbertForPreTraining.from_pretrained(latest_checkpoint_dir)
else:
logger.info(f"Training from scratch")
model = AlbertForPreTraining(config)
model.resize_token_embeddings(len(tokenizer))

return model


class CollaborativeCallback(transformers.TrainerCallback):
"""
This callback monitors and reports collaborative training progress.
Expand Down

0 comments on commit b829c7f

Please sign in to comment.