ImportError: cannot import name 'VideoReader' from 'torchvision.io' when importing Geneformer

#597
by Mashuaiii - opened

Hi Geneformer team,

I ran into the following error when importing Geneformer in an environment with a newer torchvision:

text
ImportError: cannot import name 'VideoReader' from 'torchvision.io'

Cause: torchvision removed VideoReader starting from version 0.26, but the datasets version installed with Geneformer still tries to import it at import time.

Workaround: Adding the following before any imports avoids the error:

python
import datasets
datasets.config.TORCHVISION_AVAILABLE = False

Geneformer does not use video functionality, so this has no effect on tokenization, fine-tuning, or embedding extraction.

Questions:

1.Is this the recommended workaround, or is there a specific datasets version that works with newer torchvision without this flag?

1.Could this compatibility note be added to the installation instructions or requirements, since newer torchvision versions are common in environments that also use PyTorch?

Thanks for your help!

Sign up or log in to comment