Instructions to use ctheodoris/Geneformer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ctheodoris/Geneformer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="ctheodoris/Geneformer")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("ctheodoris/Geneformer") model = AutoModelForMaskedLM.from_pretrained("ctheodoris/Geneformer", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
ImportError: cannot import name 'VideoReader' from 'torchvision.io' when importing Geneformer
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!