Skip to content

python2 iterator bug? #109

Closed
Closed
@tombosc

Description

@tombosc

here is the snippet:

from __future__ import print_function
from torchtext.datasets import WikiText2

i_train, i_dev, i_test = WikiText2.iters(device='-1', root="data/")
for i in i_train:
    print(i)

here's the error:

Traceback (most recent call last):
  File "bug.py", line 5, in <module>
    for i in i_train:
  File "/u/bosctom/.local/lib/python2.7/site-packages/torchtext/data/iterator.py", line 218, in __iter__
    self.batch_size - len(text)))
TypeError: can't multiply sequence by non-int of type 'float'

The bug is related to python2's math.ceil() returning a float?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions