davidtvs / pytorch-lr-finder

A learning rate range test implementation in PyTorch
MIT License
921 stars 120 forks source link

ValueError ValDataLoaderIter next() call missing #76

Closed paulhager closed 9 months ago

paulhager commented 3 years ago

In the _validate function, you try to iterate through the elements of ValDataLoaderIter with a simple for loop:

https://github.com/davidtvs/pytorch-lr-finder/blob/acc5e7ee7711a460bf3e1cc5c5f05575ba1e1b4b/torch_lr_finder/lr_finder.py#L427

This throws a 'ValueError: too many values to unpack' because it is attempting to unpack the entire dataloader which has way more then two elements. I think what you want here is just the next element in val_iter, similarly to your _train_batch function, so a loop over the length of val_iter with a call to next(val_iter) every loop or an enumerate(val_iter), no?

NaleRaphael commented 3 years ago

Hi @paulhager! Is the situation mentioned in this issue similar to the one you ran into? https://github.com/davidtvs/pytorch-lr-finder/issues/61#issuecomment-692715109

If not, can you describe more about it?

davidtvs commented 9 months ago

Closing due to inactivity