Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
ff9f597a
Commit
ff9f597a
authored
Oct 21, 2016
by
Davis King
Browse files
Made the dnn_trainer automatically reload from the last good state if a loss of
NaN is encountered.
parent
4a2f0192
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
dlib/dnn/trainer.h
dlib/dnn/trainer.h
+8
-0
No files found.
dlib/dnn/trainer.h
View file @
ff9f597a
...
@@ -889,6 +889,14 @@ namespace dlib
...
@@ -889,6 +889,14 @@ namespace dlib
if
(
main_iteration_counter_at_last_disk_sync
==
0
)
if
(
main_iteration_counter_at_last_disk_sync
==
0
)
return
false
;
return
false
;
for
(
auto
x
:
previous_loss_values
)
{
// If we get a NaN value of loss assume things have gone horribly wrong and
// we should reload the state of the trainer.
if
(
std
::
isnan
(
x
))
return
true
;
}
// if we haven't seen much data yet then just say false.
// if we haven't seen much data yet then just say false.
if
(
gradient_updates_since_last_sync
<
30
||
previous_loss_values
.
size
()
<
2
*
gradient_updates_since_last_sync
)
if
(
gradient_updates_since_last_sync
<
30
||
previous_loss_values
.
size
()
<
2
*
gradient_updates_since_last_sync
)
return
false
;
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment