Instructions to use google/pix2struct-textcaps-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/pix2struct-textcaps-large 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-large")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("google/pix2struct-textcaps-large") model = AutoModelForImageTextToText.from_pretrained("google/pix2struct-textcaps-large") - Notebooks
- Google Colab
- Kaggle
Model Inference Not Working
#1
by jais8004 - opened
1 import requests
2 from PIL import Image
----> 3 from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
5 url = "https://www.ilankelman.org/stopsigns/australia.jpg"
6 image = Image.open(requests.get(url, stream=True).raw)
ImportError: cannot import name 'Pix2StructForConditionalGeneration' from 'transformers' (c:\Users\JAIS\Anaconda3\envs\hftest\lib\site-packages\transformers_init_.py)
Also Not Able to inference from Hugging Face UI for all the variants of this model
Error Message : "The model_type 'pix2struct' is not recognized. It could be a bleeding edge model, or incorrect"
Thanks!

