Convert ml1 to cpu

I have successfully converted notebooks to run on CPU only, up until the bottom part of lesson4-mnist_sgd.

Any ideas?

Well an iterator doesn’t necessarily have a __len__ method, fastai’s DevicedataLoader fits in this category. Here you want to access the __len__ method from md.val_dl, not the one from iter(md.val_dl), which is another object. So here you need to put len(md.val_dl) instead of len(val_dl).
Always be careful that iter returns another object (an iterator, which in this case is a generator function) so you can’t necessarily access attributes from the object you created the iterator with.

Thank you. it worked.

How can I publish my cpu-only version in ml1 exercises for others? I’ve had to make many changes to get it to work so far. I’m working on lesson4-mnist_sgd.

1 Like

I think you can put that on the course’s forum, but I’m not that sure as I never really worked on the course.

I’d recommend perhaps a separate github repo at first and post in Share Your Work and on a post for others to see.

Just my two cents! And good work! :slight_smile:

1 Like