Instructions to use google/pix2struct-textcaps-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/pix2struct-textcaps-base with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="google/pix2struct-textcaps-base")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("google/pix2struct-textcaps-base") model = AutoModelForImageTextToText.from_pretrained("google/pix2struct-textcaps-base") - Notebooks
- Google Colab
- Kaggle
Not able to import Pix2StructForConditionalGeneration, Pix2StructProcessor
#3
by tushar729 - opened
While trying out the code, I am not able to import the packages Pix2StructForConditionalGeneration, Pix2StructProcessor. I have the latest version of transformers and pytorch installed. Following are the package version and error details :
tensorflow 2.12.0 torch 2.0.0+cpu torchaudio 2.0.1+cpu torchvision 0.15.1+cpu transformers 4.27.3
Hi @tushar729
Thanks so much for your interest in running the model !
Please use the main branch of transformers to properly use Pix2Struct:
pip install git+https://github.com/huggingface/transformers.git
Hi @ybelkada why not run a space (deploy as a gradio app) so that other users can just use it? Or at least leverage the code.
