question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: DataLoaderIterWrapper object is not an iterator ?

See original GitHub issue
class DataLoaderIterWrapper(object):
     def __init__(self, data_loader, auto_reset=True):
        self.data_loader = data_loader
        self.auto_reset = auto_reset
        self._iterator = iter(data_loader)

    def __next__(self):
        # Get a new set of inputs and labels
        try:
            # inputs, labels, *_ = next(self._iterator)
            inputs, labels = next(self._iterator)
        except StopIteration:
            if not self.auto_reset:
                raise
            self._iterator = iter(self.data_loader)
            # inputs, labels, *_ = next(self._iterator)
            inputs, labels = next(self._iterator)

        return inputs, labels

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
davidtvscommented, Apr 23, 2020

As @NaleRaphael said we dropped support for Py2k recently. However, the last release was left in a broken state for Py2k so it’s only fair that it gets fixed. I released version 0.1.5 which fixes the extended iterable unpacking meaning that you shouldn’t have to comment-out those lines and further change the code to make it work.

Give it a try, it’s currently the latest version on PyPI so you can simply do pip install torch-lr-finder.

I also created a branch with the latest code that works on Py2k: torch_lr_finder-v0.1.

Let us know if you have any problems with the latest version

0reactions
davidtvscommented, Apr 29, 2020

Closing this, feel free to reopen if you find a problem related to this

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: 'list' object is not an iterator in Python | bobbyhadz
The Python TypeError: 'list' object is not an iterator occurs when we try to use a list as an iterator. To solve the...
Read more >
Why is an iterable object not an iterator? - Stack Overflow
The iter() function raises a TypeError if the passed in value doesn't support the iter() method or the sequence protocol (the getitem() method)....
Read more >
Dataset object is not an iterator, although I can iterate on it.
TypeError : 'DatasetV1Adapter' object is not an iterator. Describe the expected behavior: Should fetch the first element of the iterator, ...
Read more >
How To Fix Type Error: List Object is Not an Iterator - YouTube
Are you here trying to understand how to fix type error : list object is not an iterator ? Here we explain how...
Read more >
Symbol.iterator - JavaScript - MDN Web Docs
Whenever an object needs to be iterated (such as at the beginning of a for...of loop), its @@iterator method is called with no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found