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
48a19f6d
Commit
48a19f6d
authored
May 03, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix exiting behavior
parent
8bdd9c85
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
examples/cifar10-convnet.py
examples/cifar10-convnet.py
+2
-2
tensorpack/dataflow/prefetch.py
tensorpack/dataflow/prefetch.py
+6
-9
No files found.
examples/cifar10-convnet.py
View file @
48a19f6d
...
@@ -97,7 +97,7 @@ def get_data(train_or_test):
...
@@ -97,7 +97,7 @@ def get_data(train_or_test):
ds
=
AugmentImageComponent
(
ds
,
augmentors
)
ds
=
AugmentImageComponent
(
ds
,
augmentors
)
ds
=
BatchData
(
ds
,
128
,
remainder
=
not
isTrain
)
ds
=
BatchData
(
ds
,
128
,
remainder
=
not
isTrain
)
if
isTrain
:
if
isTrain
:
ds
=
PrefetchData
ZMQ
(
ds
,
5
)
ds
=
PrefetchData
(
ds
,
10
,
5
)
return
ds
return
ds
def
get_config
():
def
get_config
():
...
@@ -127,7 +127,7 @@ def get_config():
...
@@ -127,7 +127,7 @@ def get_config():
session_config
=
sess_config
,
session_config
=
sess_config
,
model
=
Model
(),
model
=
Model
(),
step_per_epoch
=
step_per_epoch
,
step_per_epoch
=
step_per_epoch
,
max_epoch
=
30
0
,
max_epoch
=
25
0
,
)
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
tensorpack/dataflow/prefetch.py
View file @
48a19f6d
...
@@ -67,14 +67,6 @@ class PrefetchData(ProxyDataFlow):
...
@@ -67,14 +67,6 @@ class PrefetchData(ProxyDataFlow):
dp
=
self
.
queue
.
get
()
dp
=
self
.
queue
.
get
()
yield
dp
yield
dp
def
__del__
(
self
):
logger
.
info
(
"Prefetch process exiting..."
)
self
.
queue
.
close
()
for
x
in
self
.
procs
:
x
.
terminate
()
logger
.
info
(
"Prefetch process exited."
)
class
PrefetchProcessZMQ
(
multiprocessing
.
Process
):
class
PrefetchProcessZMQ
(
multiprocessing
.
Process
):
def
__init__
(
self
,
ds
,
conn_name
):
def
__init__
(
self
,
ds
,
conn_name
):
"""
"""
...
@@ -118,6 +110,10 @@ class PrefetchDataZMQ(ProxyDataFlow):
...
@@ -118,6 +110,10 @@ class PrefetchDataZMQ(ProxyDataFlow):
for
x
in
self
.
procs
:
for
x
in
self
.
procs
:
x
.
start
()
x
.
start
()
# __del__ not guranteed to get called at exit
import
atexit
atexit
.
register
(
lambda
x
:
x
.
__del__
(),
self
)
def
get_data
(
self
):
def
get_data
(
self
):
for
_
in
range
(
self
.
_size
):
for
_
in
range
(
self
.
_size
):
dp
=
loads
(
self
.
socket
.
recv
(
copy
=
False
))
dp
=
loads
(
self
.
socket
.
recv
(
copy
=
False
))
...
@@ -125,7 +121,8 @@ class PrefetchDataZMQ(ProxyDataFlow):
...
@@ -125,7 +121,8 @@ class PrefetchDataZMQ(ProxyDataFlow):
def
__del__
(
self
):
def
__del__
(
self
):
logger
.
info
(
"Prefetch process exiting..."
)
logger
.
info
(
"Prefetch process exiting..."
)
self
.
context
.
destroy
(
0
)
if
not
self
.
context
.
closed
:
self
.
context
.
destroy
(
0
)
for
x
in
self
.
procs
:
for
x
in
self
.
procs
:
x
.
terminate
()
x
.
terminate
()
logger
.
info
(
"Prefetch process exited."
)
logger
.
info
(
"Prefetch process exited."
)
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