Instructions to use nlpconnect/vit-gpt2-image-captioning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nlpconnect/vit-gpt2-image-captioning 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="nlpconnect/vit-gpt2-image-captioning")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning") model = AutoModelForMultimodalLM.from_pretrained("nlpconnect/vit-gpt2-image-captioning", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit History
-
Update preprocessor_config.json to use image_processor_type
Verified signatureThis pull request addresses a warning message that appears when using the `nlpconnect/vit-gpt2-image-captioning` model. The warning suggests updating the `preprocessor_config.json` file to use `image_processor_type` instead of `feature_extractor_type`. Changes made: - Renamed `feature_extractor_type` to `image_processor_type` in `preprocessor_config.json`. This change should help to align the model's configuration with the latest practices in the `transformers` library and remove the warning message for users of the model.f284be1
-
add tokenizer
b309c4b