Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround for train_set batching during inference time #784

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion neuralmonkey/learning_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from termcolor import colored

from neuralmonkey.logging import log, log_print, warn
from neuralmonkey.dataset import Dataset
from neuralmonkey.dataset import Dataset, BatchingScheme
from neuralmonkey.tf_manager import TensorFlowManager
from neuralmonkey.runners.base_runner import (
BaseRunner, ExecutionResult, GraphExecutor, OutputSeries)
Expand Down Expand Up @@ -85,6 +85,9 @@ def training_loop(cfg: Namespace) -> None:
trainer_result = cfg.tf_manager.execute(
batch, feedables, cfg.trainers, train=True,
summaries=True)
# workaround: we need to use validation batching scheme
# during evaluation
batch.batching = BatchingScheme(batch_size=cfg.batch_size)
train_results, train_outputs, f_batch = run_on_dataset(
cfg.tf_manager, cfg.runners, cfg.dataset_runner, batch,
cfg.postprocess, write_out=False)
Expand Down
1 change: 1 addition & 0 deletions tests/hier-multiattention.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ trainer=<trainer>
runners=[<runner_hier_noshare_nosentinel>, <runner_hier_share_nosentinel>, <runner_hier_share_sentinel>, <runner_hier_noshare_sentinel>]
postprocess=None
evaluation=[("target_hier_noshare_nosentinel", "target", evaluators.BLEU)]
batch_size=1
logging_period=1
validation_period=5
test_datasets=[<val_data>]
Expand Down