I’m using Pytorch version 1.1.0 installed with fast.ai library and trying to get to know more about the framework about how it works.
I’ve been going through the blitz tutorial and on the one with training a classifier with CIFAR10 dataset, I’m stuck at a certain point where we use the Data Loader on the training sample :
# get some random training images
dataiter = iter(trainloader)
images, labels = dataiter.next()
When I want to run this code, it gives me the following error :
TypeError: object() takes no parameters
I don’t understand why it does this error, I’ve tried to uninstall and re-install yet it still keep doing the same error
It’s a bit hard to tell the context without seeing the rest of your code. Also, I’m not sure what kind of wrapping fast.ai has done, but this could be coming from their library.
The typical way to interact with datasets in PyTorch looks like something like this:
>>> mnist = MNIST(r"some root directory", download=True, train=True, transform=ToTensor())
>>> data = DataLoader(mnist)
>>> for num, (input, label) in enumerate(data):
... print(num)
data in this case, an instance of the DataLoader class is itself an iterator. You can use normal python looping constructs on this. You shouldn’t have to call .next() directly.