Open lisanka93 opened 2 years ago
please modify the syntax inside the update_train_state function as follows and ensure that the minimum value is initialized.
def update_train_state(args, model, train_state): """ codes... """ if loss_t < train_state['early_stopping_best_val']: torch.save(model.state_dict(), train_state['model_filename']) train_state['early_stopping_best_val'] = loss_t
The early_stopping_best_val never gets updated so the loss is ALWAYS smaller and early stopping never happens this line of code is missing in the if-else statement in update_train_stage function:
train_state['early_stopping_best_val'] = loss_t