Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 6b37dd2

Browse files
authored
Turn off shuffling during evaluation (#1578)
1 parent 07bfc31 commit 6b37dd2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

allennlp/commands/evaluate.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ def evaluate(model: Model,
9494
with torch.no_grad():
9595
model.eval()
9696

97-
iterator = data_iterator(instances, num_epochs=1, cuda_device=cuda_device)
97+
iterator = data_iterator(instances,
98+
num_epochs=1,
99+
shuffle=False,
100+
cuda_device=cuda_device)
98101
logger.info("Iterating over dataset")
99102
generator_tqdm = Tqdm.tqdm(iterator, total=data_iterator.get_num_batches(instances))
100103
for batch in generator_tqdm:

allennlp/training/trainer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def _validation_loss(self) -> Tuple[float, int]:
667667

668668
val_generator = val_iterator(self._validation_data,
669669
num_epochs=1,
670-
shuffle=self._shuffle,
670+
shuffle=False,
671671
cuda_device=self._iterator_device)
672672
num_validation_batches = val_iterator.get_num_batches(self._validation_data)
673673
val_generator_tqdm = Tqdm.tqdm(val_generator,

0 commit comments

Comments
 (0)