pytorch-lr-finder icon indicating copy to clipboard operation
pytorch-lr-finder copied to clipboard

'<' not supported between instances of 'MSELoss' and 'int'

Open RowanG1 opened this issue 3 years ago • 2 comments

Using: lr_finder = LRFinder(model, optimizer, loss_fn) Get this error: '<' not supported between instances of 'MSELoss' and 'int'

/usr/local/lib/python3.7/dist-packages/fastai/callback/schedule.py in init(self, start_lr, end_lr, num_it, stop_div) 169 "Training with exponentially growing learning rate" 170 def init(self, start_lr=1e-7, end_lr=10, num_it=100, stop_div=True): --> 171 if num_it < 6: num_it = 6 172 self.scheds = {'lr': [SchedExp(s, e) for (s,e) in zip(start_lr,end_lr) 173 ] if is_listy(start_lr) else SchedExp(start_lr, end_lr)}

Any ideas?

RowanG1 avatar Feb 23 '22 01:02 RowanG1

Hi @RowanG1,

Currently provided trackback message is not complete and it shows only code related to the callback from fastai library, could you provide further more information about it?

And if I understand correctly, I'm afraid that you are using the wrong LRFinder. According to given message, the code in trackback message is exactly from fastai library.

That is, the invocation of LRFinder is for this library torch_lr_finder instead of the one in fastai library, but the LRFinder you imported is from fastai library. Therefore, it took the 3rd argument as num_it.

NaleRaphael avatar Feb 23 '22 01:02 NaleRaphael

Brilliant, thanks. I updated as follows: from torch_lr_finder import LRFinder as PytorchLRFinder

RowanG1 avatar Feb 23 '22 01:02 RowanG1