PetrochukM / PyTorch-NLP

Basic Utilities for PyTorch Natural Language Processing (NLP)
https://pytorchnlp.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.21k stars 258 forks source link

Test on IMDB dataset is failing #43

Closed pravarmahajan closed 6 years ago

pravarmahajan commented 6 years ago

Expected Behavior

The test assertion checks if the first row of the Test Dataset of IMDB matches the given text and sentiment.

Actual Behavior

The assertion fails, as the order of rows returned is not fixed. This is due to glob.iglob, which returns files in arbitrary order.

Steps to Reproduce the Problem

python -m pytest tests/datasets/test_imdb.py

or...

>>> from torchnlp.datasets import imdb
>>> train, test = imdb.imdb_dataset(train=True, test=True)
>>> print(test[0]['text'])
PetrochukM commented 6 years ago

Hi!

Update IMDB and IWSLT tests to be deterministic via this PR: https://github.com/PetrochukM/PyTorch-NLP/pull/46

Thanks!