Skip to content

Commit

Permalink
🧹 fmt fixes for launch scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Kelly A <[email protected]>
  • Loading branch information
kellyaa committed May 6, 2024
1 parent e38d859 commit 75dbbf1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build/accelerate_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def main():
)
)
sys.exit(1)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.error(traceback.format_exc())
write_termination_log("Unhandled exception during training")
sys.exit(200)

try:
launch_command(args)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.error(traceback.format_exc)
write_termination_log("Unhandled exception during training")
sys.exit(200)
Expand Down
10 changes: 5 additions & 5 deletions build/launch_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main():
tune_config,
merge_model,
) = process_launch_training_args(job_config)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.error(traceback.format_exc())
write_termination_log(
"Exception raised during training. This may be a problem with your input: {}".format(
Expand Down Expand Up @@ -97,7 +97,7 @@ def main():
f"Exception raised during training. This may be a problem with your input: {e}"
)
sys.exit(1)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.error(traceback.format_exc())
write_termination_log("Unhandled exception during training")
sys.exit(200)
Expand Down Expand Up @@ -126,7 +126,7 @@ def main():
base_model=model_args.model_name_or_path,
save_tokenizer=True,
)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.error(traceback.format_exc())
write_termination_log("Exception encountered merging model checkpoints")
sys.exit(200)
Expand All @@ -144,7 +144,7 @@ def main():
original_output_dir,
dirs_exist_ok=True,
)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.error(traceback.format_exc())
write_termination_log(
"Exception encountered writing output model to storage"
Expand All @@ -158,7 +158,7 @@ def main():
)
if os.path.exists(train_logs_filepath):
shutil.copy(train_logs_filepath, original_output_dir)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.error(traceback.format_exc())
# Continue, don't fail the training because of this

Expand Down
2 changes: 1 addition & 1 deletion build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def write_termination_log(text, log_file="/dev/termination-log"):
try:
with open(log_file, "a", encoding="utf-8") as handle:
handle.write(text)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.warning("Unable to write termination log due to error {}".format(e))


Expand Down

0 comments on commit 75dbbf1

Please sign in to comment.