save_pretrained: mkdir(exist_ok=True) (#5258)

* all save_pretrained methods mkdir if not os.path.exists
This commit is contained in:
Sam Shleifer
2020-06-28 14:53:47 -04:00
committed by GitHub
parent 12dfbd4f7a
commit 45e26125de
16 changed files with 17 additions and 59 deletions

View File

@@ -92,8 +92,6 @@ class BartSummarizationDistiller(SummarizationModule):
student = BartForConditionalGeneration(student_cfg)
student, _ = init_student(student, teacher)
save_dir = self.output_dir.joinpath("student")
save_dir.mkdir(exist_ok=True)
self.copy_to_student(d_layers_to_copy, e_layers_to_copy, hparams, student, teacher)
student.save_pretrained(save_dir)
hparams.model_name_or_path = str(save_dir)