Cannot fix ImportError: cannot import name 'ToTensorV2' from 'albumentations.pytorch' on Colab
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

