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
264b1e4e
Commit
264b1e4e
authored
Jul 16, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix TFRecordSerializer when msgpack is used
parent
b17a098d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
tensorpack/dataflow/serialize.py
tensorpack/dataflow/serialize.py
+8
-1
tensorpack/utils/serialize.py
tensorpack/utils/serialize.py
+1
-1
No files found.
tensorpack/dataflow/serialize.py
View file @
264b1e4e
...
...
@@ -124,10 +124,17 @@ class TFRecordSerializer():
df (DataFlow): the DataFlow to serialize.
path (str): output tfrecord file.
"""
if
os
.
environ
.
get
(
'TENSORPACK_SERIALIZE'
,
None
)
==
'msgpack'
:
def
_dumps
(
dp
):
return
dumps
(
dp
)
else
:
def
_dumps
(
dp
):
return
dumps
(
dp
)
.
to_pybytes
()
size
=
_reset_df_and_get_size
(
df
)
with
tf
.
python_io
.
TFRecordWriter
(
path
)
as
writer
,
get_tqdm
(
total
=
size
)
as
pbar
:
for
dp
in
df
.
get_data
():
writer
.
write
(
dumps
(
dp
)
.
to_pybytes
(
))
writer
.
write
(
_dumps
(
dp
))
pbar
.
update
()
@
staticmethod
...
...
tensorpack/utils/serialize.py
View file @
264b1e4e
...
...
@@ -61,7 +61,7 @@ except ImportError:
dumps_msgpack
=
create_dummy_func
(
# noqa
'dumps_msgpack'
,
[
'msgpack'
,
'msgpack_numpy'
])
if
pa
is
None
or
os
.
environ
.
get
(
'TENSORPACK_SERIALIZE'
,
None
)
==
'msgpack'
:
if
os
.
environ
.
get
(
'TENSORPACK_SERIALIZE'
,
None
)
==
'msgpack'
:
loads
=
loads_msgpack
dumps
=
dumps_msgpack
else
:
...
...
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