Tips on resolving this typing.Optional error seemingly related to PIL.Image?

#56
by justinwickett - opened

This is the error that I'm encountering when running from transformers import FuyuProcessor, FuyuForCausalLM:

RuntimeError: Failed to import transformers.models.fuyu.processing_fuyu because of the following error (look up to see its traceback):
typing.Optional requires a single type. Got <module 'PIL.Image' from '/home/ec2-user/anaconda3/lib/python3.10/site-packages/PIL/Image.py'>.

hey @justinwickett , do you have the latest version of transformers + PIL installed in your environment?

I thought I did, but clearly something is wrong with my environment. I preformed the following commands:

pip install --upgrade --force-reinstall pillow 
pip install --force-reinstall git+https://github.com/huggingface/transformers.git

And it does not work? Did you start a new env to be sure? If you have your full env details (python version as well) it can help, I know there might be some issues around typing and PIL so it might help uncover them :)

Sign up or log in to comment