Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No early stopping implemented in Chapter 3 (yelp) #34

Open
lisanka93 opened this issue Nov 17, 2021 · 1 comment
Open

No early stopping implemented in Chapter 3 (yelp) #34

lisanka93 opened this issue Nov 17, 2021 · 1 comment

Comments

@lisanka93
Copy link

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

@Rucious-Aladdin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants