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
ModelZoo
ResNet50_tensorflow
Commits
a6d7a7ba
Commit
a6d7a7ba
authored
Aug 31, 2016
by
Xin Pan
Browse files
More detail explanation of data and fix comments.
parent
761c59c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
textsum/README.md
textsum/README.md
+8
-4
textsum/data.py
textsum/data.py
+8
-4
No files found.
textsum/README.md
View file @
a6d7a7ba
...
@@ -27,6 +27,7 @@ for example vocabulary format. In <b>How To Run</b> below, users can use toy
...
@@ -27,6 +27,7 @@ for example vocabulary format. In <b>How To Run</b> below, users can use toy
data and vocab provided in the data/ directory to run the training by replacing
data and vocab provided in the data/ directory to run the training by replacing
the data directory flag.
the data directory flag.
<b>
Experiment Result
</b>
<b>
Experiment Result
</b>
8000 examples from testset are sampled to generate summaries and rouge score is
8000 examples from testset are sampled to generate summaries and rouge score is
...
@@ -73,10 +74,13 @@ Install TensorFlow and Bazel.
...
@@ -73,10 +74,13 @@ Install TensorFlow and Bazel.
```
shell
```
shell
# cd to your workspace
# cd to your workspace
# clone the code to your workspace and create empty WORKSPACE file.
# 1. Clone the textsum code to your workspace 'textsum' directory.
# move the data to your workspace. If don't have full dataset yet, copy
# 2. Create an empty 'WORKSPACE' file in your workspace.
# the toy data from the data/ directory from code directory and rename
# 3. Move the train/eval/test data to your workspace 'data' directory.
# the files.
# In the following example, I named the data training-*, test-*, etc.
# If your data files have different names, update the --data_path.
# If you don't have data but want to try out the model, copy the toy
# data from the textsum/data/data to the data/ directory in the workspace.
ls
-R
ls
-R
.:
.:
data textsum WORKSPACE
data textsum WORKSPACE
...
...
textsum/data.py
View file @
a6d7a7ba
...
@@ -70,11 +70,15 @@ class Vocab(object):
...
@@ -70,11 +70,15 @@ class Vocab(object):
return
self
.
_count
return
self
.
_count
def
ExampleGen
(
recordio_path
,
num_epochs
=
None
):
def
ExampleGen
(
data_path
,
num_epochs
=
None
):
"""Generates tf.Examples from path of recordio files.
"""Generates tf.Examples from path of data files.
Binary data format: <length><blob>. <length> represents the byte size
of <blob>. <blob> is serialized tf.Example proto. The tf.Example contains
the tokenized article text and summary.
Args:
Args:
recordio
_path:
CNS
path to tf.Example
recordio
data
_path: path to tf.Example
data files.
num_epochs: Number of times to go through the data. None means infinite.
num_epochs: Number of times to go through the data. None means infinite.
Yields:
Yields:
...
@@ -86,7 +90,7 @@ def ExampleGen(recordio_path, num_epochs=None):
...
@@ -86,7 +90,7 @@ def ExampleGen(recordio_path, num_epochs=None):
while
True
:
while
True
:
if
num_epochs
is
not
None
and
epoch
>=
num_epochs
:
if
num_epochs
is
not
None
and
epoch
>=
num_epochs
:
break
break
filelist
=
glob
.
glob
(
recordio
_path
)
filelist
=
glob
.
glob
(
data
_path
)
assert
filelist
,
'Empty filelist.'
assert
filelist
,
'Empty filelist.'
random
.
shuffle
(
filelist
)
random
.
shuffle
(
filelist
)
for
f
in
filelist
:
for
f
in
filelist
:
...
...
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