Created
December 19, 2022 23:00
-
-
Save piercelamb/b913c4809b3dca85ac6a1773d0a067e0 to your computer and use it in GitHub Desktop.
wait_for_everyone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accelerator.wait_for_everyone() | |
unwrapped_best_model = accelerator.unwrap_model(curr_best_model) | |
if accelerator.is_main_process: | |
# this print line is used by tuning jobs to select the best job | |
print(f"objective_metric_f1={best_f1};") | |
loss_filename, learning_filename, f1_filename = plot_curves( | |
train_dataloader.batch_size, | |
num_train_epochs, | |
learning_rate, | |
train_eval_data | |
) | |
local_best_model_stats = os.path.join(os.getcwd(),'best_model_stats.json') | |
with open(local_best_model_stats, "w", encoding="utf-8") as f: | |
json.dump({'best_valid_f1': best_f1, 'best_valid_acc':best_acc}, f, ensure_ascii=False, indent=4) | |
return unwrapped_best_model, loss_filename, learning_filename, f1_filename, local_best_model_stats |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment