Skip to content

Commit ea27f29

Browse files
authored
symlink model.ckpt.* to relative paths (deepmodeling#2720)
Before, `model.ckpt.*` is symilnks to an abosulote path. If users wants to move the whole directory, the relative path will be more user-friendly. --------- Signed-off-by: Jinzhe Zeng <[email protected]>
1 parent 40f6286 commit ea27f29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deepmd/train/trainer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def save_checkpoint(self, cur_batch: int):
832832
pass
833833
if platform.system() != "Windows":
834834
# by default one does not have access to create symlink on Windows
835-
os.symlink(ori_ff, new_ff)
835+
os.symlink(os.path.relpath(ori_ff, os.path.dirname(new_ff)), new_ff)
836836
else:
837837
shutil.copyfile(ori_ff, new_ff)
838838
log.info("saved checkpoint %s" % self.save_ckpt)

0 commit comments

Comments
 (0)