I tried all three solutions from this question to solve the problem, but still receive an error:
ImportError: cannot import name 'ToTensorV2' from 'albumentations.pytorch' (/usr/local/lib/python3.7/dist-packages/albumentations/pytorch/__init__.py)
My current code:
!pip install -U albumentations
import albumentations
from albumentations.pytorch import ToTensorV2
Have you tried factory resetting the runtime? If you haven't, maybe python was still loading the earlier version. I have just tested the accepted solution from the linked question on a fresh colab instance and it worked fine:
!pip install albumentations==0.4.6
import albumentations
from albumentations.pytorch import ToTensorV2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With