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
74e3eeef
Commit
74e3eeef
authored
Feb 19, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs update
parent
a9958037
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
6 deletions
+16
-6
docs/tutorial/dataflow.md
docs/tutorial/dataflow.md
+8
-0
docs/tutorial/efficient-dataflow.md
docs/tutorial/efficient-dataflow.md
+1
-1
examples/A3C-Gym/README.md
examples/A3C-Gym/README.md
+2
-2
examples/A3C-Gym/simulator.py
examples/A3C-Gym/simulator.py
+1
-1
examples/DeepQNetwork/DQN.py
examples/DeepQNetwork/DQN.py
+1
-1
examples/DeepQNetwork/README.md
examples/DeepQNetwork/README.md
+2
-0
examples/DeepQNetwork/expreplay.py
examples/DeepQNetwork/expreplay.py
+1
-1
No files found.
docs/tutorial/dataflow.md
View file @
74e3eeef
...
@@ -47,6 +47,14 @@ Another good thing about Dataflow is that it is independent of
...
@@ -47,6 +47,14 @@ Another good thing about Dataflow is that it is independent of
tensorpack internals. You can just use it as an efficient data processing pipeline,
tensorpack internals. You can just use it as an efficient data processing pipeline,
and plug it into other frameworks.
and plug it into other frameworks.
To use a DataFlow, you'll need to call
`reset_state()`
first to initialize it, and then use the generator however you
want:
```
python
df
=
get_some_df
()
df
.
reset_state
()
generator
=
df
.
get_data
()
```
### Write your own Dataflow
### Write your own Dataflow
There are several existing Dataflow, e.g. ImageFromFile, DataFromList, which you can
There are several existing Dataflow, e.g. ImageFromFile, DataFromList, which you can
...
...
docs/tutorial/efficient-dataflow.md
View file @
74e3eeef
...
@@ -157,7 +157,7 @@ Then we add necessary transformations:
...
@@ -157,7 +157,7 @@ Then we add necessary transformations:
ds = AugmentImageComponent(ds, lots_of_augmentors)
ds = AugmentImageComponent(ds, lots_of_augmentors)
ds = BatchData(ds, 256)
ds = BatchData(ds, 256)
```
```
1.
`LMDBData`
deserialize the datapoints (from string to [jpeg_string, label])
1.
`LMDBData
Point
`
deserialize the datapoints (from string to [jpeg_string, label])
2.
Use OpenCV to decode the first component into ndarray
2.
Use OpenCV to decode the first component into ndarray
3.
Apply augmentations to the ndarray
3.
Apply augmentations to the ndarray
...
...
examples/A3C-Gym/README.md
View file @
74e3eeef
...
@@ -10,8 +10,8 @@ Most of them are the best reproducible results on gym.
...
@@ -10,8 +10,8 @@ Most of them are the best reproducible results on gym.
`CUDA_VISIBLE_DEVICES=0 ./train-atari.py --env Breakout-v0`
`CUDA_VISIBLE_DEVICES=0 ./train-atari.py --env Breakout-v0`
It should run at a speed of
6~10 iterations/s on 1 GPU plus 12+ CPU cores.
The speed is about
6~10 iterations/s on 1 GPU plus 12+ CPU cores.
In each iteration it trains on a batch of 128 new states.
In each iteration it trains on a batch of 128 new states.
The network architecture is larger than what's used in the original paper.
The pre-trained models are all trained with 4 GPUs for about 2 days.
The pre-trained models are all trained with 4 GPUs for about 2 days.
But on simple games like Breakout, you can get good performance within several hours.
But on simple games like Breakout, you can get good performance within several hours.
...
...
examples/A3C-Gym/simulator.py
View file @
74e3eeef
...
@@ -100,7 +100,6 @@ class SimulatorMaster(threading.Thread):
...
@@ -100,7 +100,6 @@ class SimulatorMaster(threading.Thread):
defining callbacks when a transition or an episode is finished.
defining callbacks when a transition or an episode is finished.
"""
"""
class
ClientState
(
object
):
class
ClientState
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
memory
=
[]
# list of Experience
self
.
memory
=
[]
# list of Experience
...
@@ -176,6 +175,7 @@ class SimulatorMaster(threading.Thread):
...
@@ -176,6 +175,7 @@ class SimulatorMaster(threading.Thread):
self
.
context
.
destroy
(
linger
=
0
)
self
.
context
.
destroy
(
linger
=
0
)
# ------------------- the following code are not used at all. Just experimental
class
SimulatorProcessDF
(
SimulatorProcessBase
):
class
SimulatorProcessDF
(
SimulatorProcessBase
):
""" A simulator which contains a forward model itself, allowing
""" A simulator which contains a forward model itself, allowing
it to produce data points directly """
it to produce data points directly """
...
...
examples/DeepQNetwork/DQN.py
View file @
74e3eeef
...
@@ -90,7 +90,7 @@ class Model(ModelDesc):
...
@@ -90,7 +90,7 @@ class Model(ModelDesc):
.
MaxPooling
(
'pool2'
,
2
)
.
MaxPooling
(
'pool2'
,
2
)
.
Conv2D
(
'conv3'
,
out_channel
=
64
,
kernel_shape
=
3
)
.
Conv2D
(
'conv3'
,
out_channel
=
64
,
kernel_shape
=
3
)
# the original arch
# the original arch
is 2x faster
# .Conv2D('conv0', image, out_channel=32, kernel_shape=8, stride=4)
# .Conv2D('conv0', image, out_channel=32, kernel_shape=8, stride=4)
# .Conv2D('conv1', out_channel=64, kernel_shape=4, stride=2)
# .Conv2D('conv1', out_channel=64, kernel_shape=4, stride=2)
# .Conv2D('conv2', out_channel=64, kernel_shape=3)
# .Conv2D('conv2', out_channel=64, kernel_shape=3)
...
...
examples/DeepQNetwork/README.md
View file @
74e3eeef
...
@@ -24,6 +24,8 @@ My Batch-A3C implementation only took <2 hours.
...
@@ -24,6 +24,8 @@ My Batch-A3C implementation only took <2 hours.
Both were trained on one GPU with an extra GPU for simulation.
Both were trained on one GPU with an extra GPU for simulation.
Double-DQN runs at 18 batches/s (1152 frames/s) on TitanX.
Double-DQN runs at 18 batches/s (1152 frames/s) on TitanX.
Note that I wasn't using the network architecture in the paper.
If switched to the network in the paper it could run 2x faster.
## How to use
## How to use
...
...
examples/DeepQNetwork/expreplay.py
View file @
74e3eeef
...
@@ -187,7 +187,7 @@ class ExpReplay(DataFlow, Callback):
...
@@ -187,7 +187,7 @@ class ExpReplay(DataFlow, Callback):
history
=
np
.
stack
(
history
,
axis
=
2
)
history
=
np
.
stack
(
history
,
axis
=
2
)
# assume batched network
# assume batched network
q_values
=
self
.
predictor
([[
history
]])[
0
][
0
]
q_values
=
self
.
predictor
([[
history
]])[
0
][
0
]
# this is the bottleneck
act
=
np
.
argmax
(
q_values
)
act
=
np
.
argmax
(
q_values
)
reward
,
isOver
=
self
.
player
.
action
(
act
)
reward
,
isOver
=
self
.
player
.
action
(
act
)
self
.
mem
.
append
(
Experience
(
old_s
,
act
,
reward
,
isOver
))
self
.
mem
.
append
(
Experience
(
old_s
,
act
,
reward
,
isOver
))
...
...
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