vilt b32 finetuned vqa

Providerdandelin
Categoryvisual-question-answering
Licenseapache-2.0
Downloads74.8K
Stars0

Overview

The ViLT b32 finetuned VQA model is a streamlined vision-and-language transformer designed for Visual Question Answering tasks. Unlike traditional pipelines that use separate CNNs for image feature extraction and Transformers for text, ViLT processes both modalities in a unified architecture. This reduction in complexity lowers latency and memory overhead, making it an efficient choice for real-time applications. Developers can integrate this model into pipelines requiring automated image interrogation, accessibility tools, or visual search enhancements. Compared to heavier multimodal models, it offers a better balance of inference speed and accuracy for targeted VQA benchmarks, operating under the permissive Apache-2.0 license for flexible commercial deployment.

Highlights

  • Unified transformer architecture for faster multimodal inference
  • Optimized for high-performance Visual Question Answering tasks
  • Low memory footprint compared to traditional CNN-Transformer pipelines
  • Apache-2.0 license allows for flexible commercial integration

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
tokenizer = AutoTokenizer.from_pretrained("dandelin/vilt-b32-finetuned-vqa")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download dandelin/vilt-b32-finetuned-vqa

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download dandelin/vilt-b32-finetuned-vqa config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('dandelin/vilt-b32-finetuned-vqa')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/dandelin/vilt-b32-finetuned-vqa

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/dandelin/vilt-b32-finetuned-vqa

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('dandelin/vilt-b32-finetuned-vqa')
tokenizer = AutoTokenizer.from_pretrained('dandelin/vilt-b32-finetuned-vqa')

Full Documentation

来源: HuggingFace

---
tags:

  • visual-question-answering

license: apache-2.0
widget:
  • text: "What's the animal doing?"

src: "https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg"
  • text: "What is on top of the building?"

src: "https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg"
---

Vision-and-Language Transformer (ViLT), fine-tuned on VQAv2

Vision-and-Language Transformer (ViLT) model fine-tuned on VQAv2. It was introduced in the paper ViLT: Vision-and-Language Transformer
Without Convolution or Region Supervision
by Kim et al. and first released in this repository.

Disclaimer: The team releasing ViLT did not write a model card for this model so this model card has been written by the Hugging Face team.

Intended uses & limitations

You can use the raw model for visual question answering.

How to use

Here is how to use this model in PyTorch:

python
from transformers import ViltProcessor, ViltForQuestionAnswering
import requests
from PIL import Image

prepare image + question

url = "http://images.cocodataset.org/val2017/000000039769.jpg" image = Image.open(requests.get(url, stream=True).raw) text = "How many cats are there?"

processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")

prepare inputs

encoding = processor(image, text, return_tensors="pt")

forward pass

outputs = model(**encoding) logits = outputs.logits idx = logits.argmax(-1).item() print("Predicted answer:", model.config.id2label[idx])

Training data

(to do)

Training procedure

Preprocessing

(to do)

Pretraining

(to do)

Evaluation results

(to do)

BibTeX entry and citation info

bibtex
@misc{kim2021vilt,
      title={ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision}, 
      author={Wonjae Kim and Bokyung Son and Ildoo Kim},
      year={2021},
      eprint={2102.03334},
      archivePrefix={arXiv},
      primaryClass={stat.ML}
}
Join our Telegram