gsbDBI / torch-choice

Choice modeling with PyTorch: logit model and nested logit model
MIT License
39 stars 8 forks source link

Error in EarlyStopping function when providing a validation dataset #52

Open kdzhang opened 4 months ago

kdzhang commented 4 months ago

I encountered the error below when a validation dataset is provided:

RunTimeError: Early stopping conditioned on metric `val_ll` which is not available. Pass in or modify your `EarlyStopping` callback to use any of the following: `train_loss`, `val_log_likelihood`

I changed the following line in run_helper_lightening.py :

# current
callbacks = [EarlyStopping(monitor="val_ll", mode="max", patience=10, min_delta=0.001)] if val_dataloader is not None else []

# modified
callbacks = [EarlyStopping(monitor="val_log_likelihood", mode="max", patience=10, min_delta=0.001)] if val_dataloader is not None else []

After this change the code runs. I am not very familiar with PyTorch, so I am not sure whether this is a bug or I am making some newbie error here... Thanks for your help!