Skip to content

Commit 7ff1ce9

Browse files
fix: add hf compatible path update (#622)
Signed-off-by: yashasvi <[email protected]>
1 parent 6f2134d commit 7ff1ce9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tuning/trainercontroller/callback.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,16 @@ def on_save(
585585
kwargs["path"] = f"{args.output_dir}/checkpoint-{state.global_step}"
586586
if "is_final" not in kwargs:
587587
kwargs["is_final"] = False
588+
589+
base_path = kwargs["path"]
590+
hf_converted_path = os.path.join(base_path, "hf_converted_checkpoint")
591+
592+
if os.path.isdir(hf_converted_path):
593+
kwargs["path"] = hf_converted_path
594+
kwargs["hf_path"] = hf_converted_path
595+
else:
596+
kwargs["hf_path"] = base_path
597+
588598
self._actions_on_event(event_name="on_save", **kwargs)
589599

590600
def on_step_begin(

0 commit comments

Comments
 (0)