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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("google/pix2struct-textcaps-base") model = AutoModelForMultimodalLM.from_pretrained("google/pix2struct-textcaps-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download preprocessor_config.json from google/pix2struct-textcaps-base: direct link, hf CLI and curl.
- Browser
- Download file 217 Bytes
-
https://huggingface.co/google/pix2struct-textcaps-base/resolve/main/preprocessor_config.json
- Command line
-
hf download hf://google/pix2struct-textcaps-base/preprocessor_config.json
-
curl -L -o preprocessor_config.json https://huggingface.co/google/pix2struct-textcaps-base/resolve/main/preprocessor_config.json
217 Bytes
| { | |
| "do_convert_rgb": true, | |
| "do_normalize": true, | |
| "image_processor_type": "Pix2StructImageProcessor", | |
| "patch_size": {"height":16, "width":16}, | |
| "processor_class": "Pix2StructProcessor", | |
| "max_patches": 2048 | |
| } | |