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
dgl
Commits
35bed2a9
"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "0ab8fe49bf540b4f34ac5934c304da23ffd448e5"
Unverified
Commit
35bed2a9
authored
Aug 18, 2019
by
Mufei Li
Committed by
GitHub
Aug 18, 2019
Browse files
Rename early stop (#773)
parent
02029dce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
examples/pytorch/model_zoo/chem/property_prediction/utils.py
examples/pytorch/model_zoo/chem/property_prediction/utils.py
+7
-3
No files found.
examples/pytorch/model_zoo/chem/property_prediction/utils.py
View file @
35bed2a9
import
datetime
import
dgl
import
dgl
import
numpy
as
np
import
numpy
as
np
import
os
import
os
...
@@ -42,9 +43,12 @@ class Meter(object):
...
@@ -42,9 +43,12 @@ class Meter(object):
return
total_score
/
n_tasks
return
total_score
/
n_tasks
class
EarlyStopping
(
object
):
class
EarlyStopping
(
object
):
def
__init__
(
self
,
patience
=
10
,
filename
=
"es_checkpoint.pth"
):
def
__init__
(
self
,
patience
=
10
,
filename
=
None
):
assert
not
os
.
path
.
exists
(
filename
),
\
if
filename
is
None
:
'Filename {} is occupied. Either rename it or delete it.'
.
format
(
filename
)
dt
=
datetime
.
datetime
.
now
()
filename
=
'early_stop_{}_{:02d}-{:02d}-{:02d}.pth'
.
format
(
dt
.
date
(),
dt
.
hour
,
dt
.
minute
,
dt
.
second
)
self
.
patience
=
patience
self
.
patience
=
patience
self
.
counter
=
0
self
.
counter
=
0
self
.
filename
=
filename
self
.
filename
=
filename
...
...
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