Instructions to use remiai3/Image_Captioning_nlpconnect_vit-gpt2-image-captioning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use remiai3/Image_Captioning_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="remiai3/Image_Captioning_nlpconnect_vit-gpt2-image-captioning")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("remiai3/Image_Captioning_nlpconnect_vit-gpt2-image-captioning", dtype="auto") - Notebooks
- Google Colab
- Kaggle
Image Captioning (CPU/GPU)
- Model:
nlpconnect/vit-gpt2-image-captioning(MIT) - Task: Generate a caption for a given image.
- Note: Here we just provide the resources for to run this models in the laptops we didn't develop this entire models we just use the open source models for the experiment this model is developed by nlpconnect
Quick start (any project)
# 1) Create env
python -m venv venv && source .venv/bin/activate # Windows: ./venv/Scripts/activate
# 2) Install deps
pip install -r requirements.txt
# 3) Run
python main.py --help
Tip: If you have a GPU + CUDA, PyTorch will auto-use it. If not, everything runs on CPU (slower but works).
and while running the main.py code using command then only you the output Use: python main.py --image remiai.png or python main.py --image sample.jpg
other wise you get the output like this usage: main.py [-h] --image IMAGE error: the following arguments are required: --image
Model tree for remiai3/Image_Captioning_nlpconnect_vit-gpt2-image-captioning
Base model
nlpconnect/vit-gpt2-image-captioning