I am trying to implement an image classifier with augmentations of CutMix and Mixup. I successfully trained my model with the Mixup callback but with CutMix, I get the below error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-37-3bf775d5b609> in <module>()
----> 1 lr_min,lr_steep = learn.lr_find()
20 frames
/usr/local/lib/python3.6/dist-packages/torch/distributions/dirichlet.py in forward(ctx, concentration)
16 @staticmethod
17 def forward(ctx, concentration):
---> 18 x = torch._sample_dirichlet(concentration)
19 ctx.save_for_backward(x, concentration)
20 return x
RuntimeError: "dirichlet" not implemented for 'Long'
Is something wrong with my code? or is “Dirichlet” not being for long is something from Pytorch that I can’t change?
Apologies if the question seems lame, I am just starting out.
Best,
Mayuresh
EDIT:
Just calling cutmix = CutMix(1) wasn’t working as it was not being recognized. Hence I used from fastai2.callback.cutmix import * . Which then gave this error.
EDIT:
Just calling cutmix = CutMix(1) wasn’t working as it was not being recognized. Hence I used from fastai2.callback.cutmix import * . Which then gave this error.
According to @amritv running learn twice solved the issue for him. Unfortunately, I got the same error again
And I tried fitting and fine-tuning the learner as well, but no luck.
Also, I forgot to mention. Just calling cutmix = CutMix(1) wasn’t working as it was not being recognized. Hence I used from fastai2.callback.cutmix import *. Which then gave this error.
Thanks for the reply @amritv. But the problem was entirely with my code. The callback should’ve been done by passing a Float. cutmix = CutMix(1) was where it went wrong .
Changing it to cutmix = CutMix(1.) solved it.
Thank you @muellerzr. Simply fitting with learn.fit_one_cycle() helped in my case. And it gave me errors when I did lr_find() before learn.fit_one_cycle().