Skip to content

Commit

Permalink
Revert "Not always consider a local model a checkpoint in run_glue"
Browse files Browse the repository at this point in the history
This reverts commit f366061.
  • Loading branch information
sgugger committed Mar 4, 2021
1 parent f366061 commit 745ea78
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions examples/text-classification/run_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,12 @@ def compute_metrics(p: EvalPrediction):

# Training
if training_args.do_train:
checkpoint = None
if last_checkpoint is not None:
checkpoint = last_checkpoint
elif os.path.isdir(model_args.model_name_or_path):
# Check the config from that potential checkpoint has the right number of labels before using it as a
# checkpoint.
if AutoConfig.from_pretrained(model_args.model_name_or_path).num_labels == num_labels:
checkpoint = model_args.model_name_or_path

checkpoint = model_args.model_name_or_path
else:
checkpoint = None
train_result = trainer.train(resume_from_checkpoint=checkpoint)
metrics = train_result.metrics

Expand Down

0 comments on commit 745ea78

Please sign in to comment.