Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
ca7d5cab
Commit
ca7d5cab
authored
Aug 17, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send stat
parent
b47c184e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
README.md
README.md
+1
-0
examples/OpenAIGym/README.md
examples/OpenAIGym/README.md
+3
-0
tensorpack/callbacks/stat.py
tensorpack/callbacks/stat.py
+26
-3
No files found.
README.md
View file @
ca7d5cab
...
@@ -29,6 +29,7 @@ Abstract your training task into three components:
...
@@ -29,6 +29,7 @@ Abstract your training task into three components:
+
Print some variables of interest
+
Print some variables of interest
+
Run inference on a test dataset
+
Run inference on a test dataset
+
Run some operations once a while
+
Run some operations once a while
+
Send the accuracy to your phone
With the above components defined, tensorpack trainer will run the training iterations for you.
With the above components defined, tensorpack trainer will run the training iterations for you.
Multi-GPU training is ready to use by simply switching the trainer.
Multi-GPU training is ready to use by simply switching the trainer.
...
...
examples/OpenAIGym/README.md
View file @
ca7d5cab
...
@@ -19,9 +19,12 @@ Models are available for the following gym atari environments (click links for v
...
@@ -19,9 +19,12 @@ Models are available for the following gym atari environments (click links for v
+
[
DoubleDunk-v0
](
https://gym.openai.com/evaluations/eval_FI1GpF4TlCuf29KccTpQ
)
+
[
DoubleDunk-v0
](
https://gym.openai.com/evaluations/eval_FI1GpF4TlCuf29KccTpQ
)
+
[
ElevatorAction-v0
](
https://gym.openai.com/evaluations/eval_SqeAouMvR0icRivx2xprZg
)
+
[
ElevatorAction-v0
](
https://gym.openai.com/evaluations/eval_SqeAouMvR0icRivx2xprZg
)
+
[
FishingDerby-v0
](
https://gym.openai.com/evaluations/eval_pPLCnFXsTVaayrIboDOs0g
)
+
[
FishingDerby-v0
](
https://gym.openai.com/evaluations/eval_pPLCnFXsTVaayrIboDOs0g
)
+
[
JourneyEscape
](
https://gym.openai.com/evaluations/eval_S9nQuXLRSu7S5x21Ay6AA
)
+
[
Pong-v0
](
https://gym.openai.com/evaluations/eval_8L7SV59nSW6GGbbP3N4G6w
)
+
[
Pong-v0
](
https://gym.openai.com/evaluations/eval_8L7SV59nSW6GGbbP3N4G6w
)
+
[
Qbert-v0
](
https://gym.openai.com/evaluations/eval_wekCJkrWQm9NrOUzltXg
)
+
[
Seaquest-v0
](
https://gym.openai.com/evaluations/eval_N2624y3NSJWrOgoMSpOi4w
)
+
[
Seaquest-v0
](
https://gym.openai.com/evaluations/eval_N2624y3NSJWrOgoMSpOi4w
)
+
[
Tennis-v0
](
https://gym.openai.com/evaluations/eval_gDjJD0MMS1yLm1T0hdqI4g
)
+
[
Tennis-v0
](
https://gym.openai.com/evaluations/eval_gDjJD0MMS1yLm1T0hdqI4g
)
+
[
UpNDown-v0
](
https://gym.openai.com/evaluations/eval_KmkvMJkxQFSED20wFUMdIA
)
+
[
VideoPinball-v0
](
https://gym.openai.com/evaluations/eval_PWwzNhVFR2CxjYvEsPfT1g
)
+
[
VideoPinball-v0
](
https://gym.openai.com/evaluations/eval_PWwzNhVFR2CxjYvEsPfT1g
)
Note that atari game settings in gym are quite different from DeepMind papers, so the scores are not comparable. The most notable differences are:
Note that atari game settings in gym are quite different from DeepMind papers, so the scores are not comparable. The most notable differences are:
...
...
tensorpack/callbacks/stat.py
View file @
ca7d5cab
...
@@ -3,15 +3,14 @@
...
@@ -3,15 +3,14 @@
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import
tensorflow
as
tf
import
tensorflow
as
tf
import
re
import
re
,
os
import
os
import
operator
import
operator
import
json
import
json
from
.base
import
Callback
from
.base
import
Callback
from
..utils
import
*
from
..utils
import
*
__all__
=
[
'StatHolder'
,
'StatPrinter'
]
__all__
=
[
'StatHolder'
,
'StatPrinter'
,
'SendStat'
]
class
StatHolder
(
object
):
class
StatHolder
(
object
):
"""
"""
...
@@ -107,3 +106,27 @@ class StatPrinter(Callback):
...
@@ -107,3 +106,27 @@ class StatPrinter(Callback):
def
_trigger_epoch
(
self
):
def
_trigger_epoch
(
self
):
self
.
trainer
.
stat_holder
.
add_stat
(
'global_step'
,
self
.
global_step
)
self
.
trainer
.
stat_holder
.
add_stat
(
'global_step'
,
self
.
global_step
)
self
.
trainer
.
stat_holder
.
finalize
()
self
.
trainer
.
stat_holder
.
finalize
()
class
SendStat
(
Callback
):
"""
Execute a command with some specific stats.
For example, send the stats to your phone through pushbullet:
SendStat('curl -u your_id: https://api.pushbullet.com/v2/pushes
\
-d type=note -d title="validation error"
\
-d body={validation_error} > /dev/null 2>&1',
'validation_error')
"""
def
__init__
(
self
,
command
,
stats
):
self
.
command
=
command
if
not
isinstance
(
stats
,
list
):
stats
=
[
stats
]
self
.
stats
=
stats
def
_trigger_epoch
(
self
):
holder
=
self
.
trainer
.
stat_holder
v
=
{
k
:
holder
.
get_stat_now
(
k
)
for
k
in
self
.
stats
}
cmd
=
self
.
command
.
format
(
**
v
)
ret
=
os
.
system
(
cmd
)
if
ret
!=
0
:
logger
.
error
(
"Command {} failed with ret={}!"
.
format
(
cmd
,
ret
))
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