Skip to content

Commit

Permalink
base dir model is the best one, end of training weights in dedicated dir
Browse files Browse the repository at this point in the history
  • Loading branch information
eustlb committed Jul 12, 2024
1 parent 828831e commit 7264d88
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion training/run_distillation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1772,9 +1772,18 @@ def generate_step(batch):
# break condition
if cur_step == total_train_steps:

# the model under training_args.output_dir is the best model, let's also save end of training weights
final_weights_dir = os.path.join(training_args.output_dir, "end-of-training-weights")

feature_extractor.save_pretrained(final_weights_dir)
tokenizer.save_pretrained(final_weights_dir)
# save the config and generation config as well
config.save_pretrained(final_weights_dir)
student_model.generation_config.save_pretrained(final_weights_dir)

# un-wrap student model for save
student_model = accelerator.unwrap_model(student_model)
student_model.save_pretrained(training_args.output_dir)
student_model.save_pretrained(final_weights_dir)

if training_args.push_to_hub:
upload_folder(
Expand Down

0 comments on commit 7264d88

Please sign in to comment.