Module 'torchvision.datasets' has no attribute 'OxfordIIITPet'

According to the torchvision documentation, the Oxford IIIT Pets dataset should be available but when I try to load it using trainset = torchvision.datasets.OxfordIIITPet(root="./", download=True, target_types='segmentation'), I just get the error in the title.

The OxfordIIITPet dataset was added in January 2022, so you might need to update your torchvision version.