Skip to content

Commit 4204593

Browse files
authored
Fix invalid wokers numbers for classification (#213)
When multiprocessing is disabled, the flag for running the prediction in the main process was not updated. Signed-off-by: Luca Foppiano <luca@foppiano.org>
1 parent 4faee0c commit 4204593

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

delft/textClassification/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,9 @@ def predict(self, predict_generator, use_main_thread_only=False):
250250
multiprocessing = True
251251

252252
if use_main_thread_only:
253-
# worker at 0 means the training will be executed in the main thread
254-
nb_workers = 0
253+
# tf_keras 2.17 requires workers >= 1; workers=1 with
254+
# use_multiprocessing=False runs in the main thread.
255+
nb_workers = 1
255256
multiprocessing = False
256257

257258
y = self.model.predict(predict_generator, use_multiprocessing=multiprocessing, workers=nb_workers)

0 commit comments

Comments
 (0)