-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Hard error on EarlyStopping() #159
Comments
Indeed that error should be caught not thrown by the standard validation phase, but I can't see why the current code doesn't do that. Let me try and reproduce. |
For the epoch the early stop condition is met, |
Ah I see the issue is that early stopping throws a I guess the appropriate fix would be to adjust the code for function fit!(learner, nepochs::Int, (trainiter, validiter))
for i in 1:nepochs
try
epoch!(learner, TrainingPhase(), trainiter)
epoch!(learner, ValidationPhase(), validiter)
catch e
if e isa CancelFittingException
@debug "Fitting canceled" error = e
break
else
rethrow()
end
end
end
end Should be a straightforward PR if you want to attempt it. |
A quick and dirty test just confirmed the solution works. Test code as follows. Will send a PR shortly.
|
Cheers, Have implemented slightly different epoch training. Instead of using
Learners for Training and Validation are different from each other, as they point out to distinct loss functions. Upon execution, error message shows up as below. However, if I am reopening the case for further analysis. Thanks in advance.
|
That's expected. Your new training loop must catch the fitting exception, since it is taking over the role of the outer loop from the package. Exceptions that are caught at an |
Cheers. When training a model with
FluxTraining.fit!(learner, epochs)
and an early stop condition is met, I am having a hard error that causes the Julia script to be teminated, which prevents execution of code lines placed after thefit!
command. I believe this is unintended behavior, please kindly verify. Thanks in advance.Code is as follows (early stop parameters purposedly set to small numbers):
Error message as follows:
The text was updated successfully, but these errors were encountered: