Skip to content

Commit a4c8545

Browse files
authored
fix save dir (modelscope#622)
1 parent 9445065 commit a4c8545

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

swift/trainers/mixin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,10 @@ def _save(self, output_dir: Optional[str] = None, state_dict=None):
425425
for file in additional_files:
426426
src_path = os.path.join(model_dir, file)
427427
dst_path = os.path.join(output_dir, file)
428-
if os.path.exists(src_path):
428+
if os.path.isfile(src_path):
429429
shutil.copy(src_path, dst_path)
430+
elif os.path.isdir(src_path):
431+
shutil.copytree(src_path, dst_path)
430432

431433
def _save_checkpoint(self, model, trial, metrics=None):
432434
self.state.last_model_checkpoint = os.path.join(

0 commit comments

Comments
 (0)