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
torchani
Commits
f73d8ae1
Unverified
Commit
f73d8ae1
authored
Dec 11, 2018
by
Gao, Xiang
Committed by
GitHub
Dec 11, 2018
Browse files
Use ignite.contrib.handlers.ProgressBar (#151)
parent
fa852d5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
33 deletions
+9
-33
examples/cache_aev.py
examples/cache_aev.py
+5
-16
examples/nnp_training.py
examples/nnp_training.py
+4
-17
No files found.
examples/cache_aev.py
View file @
f73d8ae1
...
@@ -15,11 +15,10 @@ AEVs. This example shows how to use disk cache to boost training
...
@@ -15,11 +15,10 @@ AEVs. This example shows how to use disk cache to boost training
import
torch
import
torch
import
ignite
import
ignite
import
torchani
import
torchani
import
tqdm
import
timeit
import
timeit
import
tensorboardX
import
tensorboardX
import
os
import
os
import
sy
s
import
ignite.contrib.handler
s
# training and validation set
# training and validation set
...
@@ -119,20 +118,10 @@ evaluator = ignite.engine.create_supervised_evaluator(container, metrics={
...
@@ -119,20 +118,10 @@ evaluator = ignite.engine.create_supervised_evaluator(container, metrics={
})
})
@
trainer
.
on
(
ignite
.
engine
.
Events
.
EPOCH_STARTED
)
###############################################################################
def
init_tqdm
(
trainer
):
# Let's add a progress bar for the trainer
trainer
.
state
.
tqdm
=
tqdm
.
tqdm
(
total
=
len
(
training
),
pbar
=
ignite
.
contrib
.
handlers
.
ProgressBar
()
file
=
sys
.
stdout
,
desc
=
'epoch'
)
pbar
.
attach
(
trainer
)
@
trainer
.
on
(
ignite
.
engine
.
Events
.
ITERATION_COMPLETED
)
def
update_tqdm
(
trainer
):
trainer
.
state
.
tqdm
.
update
(
1
)
@
trainer
.
on
(
ignite
.
engine
.
Events
.
EPOCH_COMPLETED
)
def
finalize_tqdm
(
trainer
):
trainer
.
state
.
tqdm
.
close
()
def
hartree2kcal
(
x
):
def
hartree2kcal
(
x
):
...
...
examples/nnp_training.py
View file @
f73d8ae1
...
@@ -13,11 +13,10 @@ This example shows how to use TorchANI train your own neural network potential.
...
@@ -13,11 +13,10 @@ This example shows how to use TorchANI train your own neural network potential.
import
torch
import
torch
import
ignite
import
ignite
import
torchani
import
torchani
import
tqdm
import
timeit
import
timeit
import
tensorboardX
import
tensorboardX
import
os
import
os
import
sy
s
import
ignite.contrib.handler
s
###############################################################################
###############################################################################
...
@@ -153,21 +152,9 @@ evaluator = ignite.engine.create_supervised_evaluator(container, metrics={
...
@@ -153,21 +152,9 @@ evaluator = ignite.engine.create_supervised_evaluator(container, metrics={
###############################################################################
###############################################################################
# Now let's register some event handlers to work with tqdm to display progress:
# Let's add a progress bar for the trainer
@
trainer
.
on
(
ignite
.
engine
.
Events
.
EPOCH_STARTED
)
pbar
=
ignite
.
contrib
.
handlers
.
ProgressBar
()
def
init_tqdm
(
trainer
):
pbar
.
attach
(
trainer
)
trainer
.
state
.
tqdm
=
tqdm
.
tqdm
(
total
=
len
(
training
),
file
=
sys
.
stdout
,
desc
=
'epoch'
)
@
trainer
.
on
(
ignite
.
engine
.
Events
.
ITERATION_COMPLETED
)
def
update_tqdm
(
trainer
):
trainer
.
state
.
tqdm
.
update
(
1
)
@
trainer
.
on
(
ignite
.
engine
.
Events
.
EPOCH_COMPLETED
)
def
finalize_tqdm
(
trainer
):
trainer
.
state
.
tqdm
.
close
()
###############################################################################
###############################################################################
...
...
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