tristandeleu / pytorch-meta

A collection of extensions and data-loaders for few-shot learning & meta-learning in PyTorch
https://tristandeleu.github.io/pytorch-meta/
MIT License
1.97k stars 256 forks source link

Torchvision InterpolationMode warnings #131

Open sevro opened 3 years ago

sevro commented 3 years ago

When updating PyTorch to the current latest 1.8.1 and torchvision to the corresponding 0.9.1 calling torchmeta.transforms.Rotation causes the warning:

~/.cache/pypoetry/virtualenvs/retrainer-TPV0pAOM-py3.8/lib/python3.8/site-packages/torchvision/transforms/functional.py:942: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum.

Pulling a full stack trace of the warning got me the exact method:

  File "~/.cache/pypoetry/virtualenvs/retrainer-TPV0pAOM-py3.8/lib/python3.8/site-packages/torchmeta/transforms/augmentations.py", line 34, in __call__
    return F.rotate(image, self.angle % 360, self.resample,

It seems this is the new API. Easy fix is to pass generic **kwargs instead of specific ones which I have already tested, although this be needed for other transforms also. This would be a change more robust to future API changes and flexible for users also I think. I have been using this library a lot for some time now, so let me know if you would be interested in a PR for this.

tristandeleu commented 3 years ago

I'm sorry for the late reply. Thank you very much for the notice, if you have a fix already available I'd be happy to get it in, otherwise I can fix it soon.