emerald-ai / torchmetal

A library for Meta-Learning and Few-Shot Learning with PyTorch.
MIT License
1 stars 3 forks source link

Torchvision InterpolationMode warnings #3

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.

Complete steps to reproduce the bug

Use transforms with Torchvision 0.9.1 that interpolate an image.

Expected behavior

No warnings, preferably by the ability to pass **kwargs through.

Environment

Additional context

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.


Copied from: https://github.com/tristandeleu/pytorch-meta/issues/131

iron-beagle commented 3 years ago

Fix for rotation on Dev branch. See PR #13