Skip to content

Commit

Permalink
fix accelerate local main bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishivi committed Jan 10, 2025
1 parent 2be8c98 commit 021ba6d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion open_instruct/dpo_tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def load_model():
if accelerator.is_local_main_process:
clean_last_n_checkpoints(args.output_dir, keep_last_n_checkpoints=0)

if args.try_auto_save_to_beaker and accelerator.is_main_process == 0 and len(beaker_config.beaker_dataset_id_urls) > 0 and args.output_dir != "/output":
if args.try_auto_save_to_beaker and accelerator.is_main_process and len(beaker_config.beaker_dataset_id_urls) > 0 and args.output_dir != "/output":
shutil.copytree(args.output_dir, "/output", dirs_exist_ok=True)

if is_beaker_job() and accelerator.is_main_process:
Expand Down
2 changes: 1 addition & 1 deletion open_instruct/dpo_tune_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ def load_model():
if accelerator.is_local_main_process:
clean_last_n_checkpoints(args.output_dir, keep_last_n_checkpoints=0)

if args.try_auto_save_to_beaker and accelerator.is_main_process == 0 and len(beaker_config.beaker_dataset_id_urls) > 0 and args.output_dir != "/output":
if args.try_auto_save_to_beaker and accelerator.is_main_process and len(beaker_config.beaker_dataset_id_urls) > 0 and args.output_dir != "/output":
shutil.copytree(args.output_dir, "/output", dirs_exist_ok=True)

if is_beaker_job() and accelerator.is_main_process:
Expand Down
2 changes: 1 addition & 1 deletion open_instruct/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ def main(args: FlatArguments):
if accelerator.is_local_main_process:
clean_last_n_checkpoints(args.output_dir, keep_last_n_checkpoints=0)

if args.try_auto_save_to_beaker and accelerator.is_main_process == 0 and len(beaker_config.beaker_dataset_id_urls) > 0 and args.output_dir != "/output":
if args.try_auto_save_to_beaker and accelerator.is_main_process and len(beaker_config.beaker_dataset_id_urls) > 0 and args.output_dir != "/output":
shutil.copytree(args.output_dir, "/output", dirs_exist_ok=True)

if is_beaker_job() and accelerator.is_main_process:
Expand Down

0 comments on commit 021ba6d

Please sign in to comment.