cannot import name 'Pix2StructForConditionalGeneration' and AttributeError in 'AutoProcessor'

#2
by pathikg - opened

I tried to follow this notebook but on importing Pix2StructForConditionalGeneration I get the following error:

image.png

following error in AutoProcessor
AttributeError: 'NoneType' object has no attribute 'from_pretrained'
image.png

Environement:

  • Python: 3.9.16
  • transformers: 4.27.3
  • sentencepiece: 0.1.97

I avoided Pix2struct error with using transformers 4.28.0.dev0 version. I don't know this is the right way but, while using the pip-installed version, couldn't handle this error. Abut second error AutoProcessor has dependency on torchvision. You can try to install it if you haven't install.

Pix2Struct was introduced on the transformers : v4.28.0, you can check it here : https://github.com/huggingface/transformers/releases

To ensure you have the latest version, run : !pip install --upgrade transformers

Once the installation is complete, you should be able to use Pix2Struct in your code.

Sign up or log in to comment