Skip to content

Commit 0545749

Browse files
authored
Merge pull request #222 from lvapeab/master
Fixbug build_vocabulary
2 parents f93864c + 6abe0a3 commit 0545749

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ install:
3535
# Replace dep1 dep2 ... with your dependencies
3636
- travis_wait 30 conda create --quiet -n test-environment python=$TRAVIS_PYTHON_VERSION
3737
- source activate test-environment
38-
- travis_wait 30 conda install tensorflow=*=mkl* pytables --quiet
38+
- travis_wait 30 conda install pytables --quiet
39+
- pip install tensorflow==1.14.0
3940
- pip install -e git+https://github.com/MarcBS/keras#egg=keras --progress-bar off
4041
- pip install pyux pandas flaky Pillow theano pytest pytest-cache pytest-cov pytest-forked pytest-pep8 pytest-xdist --progress-bar off
4142
- pip install -e git+https://github.com/lvapeab/coco-caption.git#egg=coco-caption --progress-bar off

keras_wrapper/dataset.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,14 +1683,7 @@ def preprocessText(self, annotations_list, data_id, set_name, tokenization, buil
16831683
tokfun = None
16841684

16851685
# Build vocabulary
1686-
if build_vocabulary:
1687-
self.build_vocabulary(sentences, data_id,
1688-
max_text_len != 0,
1689-
min_occ=min_occ,
1690-
n_words=max_words,
1691-
use_extra_words=(max_text_len != 0),
1692-
use_unk_class=use_unk_class)
1693-
elif isinstance(build_vocabulary, str):
1686+
if isinstance(build_vocabulary, str):
16941687
if build_vocabulary in self.vocabulary:
16951688
self.vocabulary[data_id] = self.vocabulary[build_vocabulary]
16961689
self.vocabulary_len[data_id] = self.vocabulary_len[build_vocabulary]
@@ -1706,6 +1699,14 @@ def preprocessText(self, annotations_list, data_id, set_name, tokenization, buil
17061699
if not self.silence:
17071700
logger.info('\tReusing vocabulary from dictionary for data with data_id "' + data_id + '".')
17081701

1702+
elif build_vocabulary:
1703+
self.build_vocabulary(sentences, data_id,
1704+
max_text_len != 0,
1705+
min_occ=min_occ,
1706+
n_words=max_words,
1707+
use_extra_words=(max_text_len != 0),
1708+
use_unk_class=use_unk_class)
1709+
17091710
if data_id not in self.vocabulary:
17101711
raise Exception('The dataset must include a vocabulary with data_id "' + data_id +
17111712
'" in order to process the type "text" data. Set "build_vocabulary" to True if you want to use the current data for building the vocabulary.')

0 commit comments

Comments
 (0)