dandelin / vilt-b32-mlm

huggingface.co
Total runs: 24.9K
24-hour runs: -1.5K
7-day runs: -2.0K
30-day runs: 5.8K
Model's Last Updated: July 06 2022
fill-mask

Introduction of vilt-b32-mlm

Model Details of vilt-b32-mlm

Vision-and-Language Transformer (ViLT), pre-trained only

Vision-and-Language Transformer (ViLT) model pre-trained on GCC+SBU+COCO+VG (200k steps). 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 . Note: this model only includes the language modeling head.

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 masked language modeling given an image and a piece of text with [MASK] tokens.

How to use

Here is how to use this model in PyTorch:

from transformers import ViltProcessor, ViltForMaskedLM
import requests
from PIL import Image
import re

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
text = "a bunch of [MASK] laying on a [MASK]."

processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-mlm")
model = ViltForMaskedLM.from_pretrained("dandelin/vilt-b32-mlm")

# prepare inputs
encoding = processor(image, text, return_tensors="pt")

# forward pass
outputs = model(**encoding)

tl = len(re.findall("\[MASK\]", text))
inferred_token = [text]

# gradually fill in the MASK tokens, one by one
with torch.no_grad():
    for i in range(tl):
        encoded = processor.tokenizer(inferred_token)
        input_ids = torch.tensor(encoded.input_ids).to(device)
        encoded = encoded["input_ids"][0][1:-1]
        outputs = model(input_ids=input_ids, pixel_values=pixel_values)
        mlm_logits = outputs.logits[0]  # shape (seq_len, vocab_size)
        # only take into account text features (minus CLS and SEP token)
        mlm_logits = mlm_logits[1 : input_ids.shape[1] - 1, :]
        mlm_values, mlm_ids = mlm_logits.softmax(dim=-1).max(dim=-1)
        # only take into account text
        mlm_values[torch.tensor(encoded) != 103] = 0
        select = mlm_values.argmax().item()
        encoded[select] = mlm_ids[select].item()
        inferred_token = [processor.decode(encoded)]

selected_token = ""
encoded = processor.tokenizer(inferred_token)
processor.decode(encoded.input_ids[0], skip_special_tokens=True)
Training data

(to do)

Training procedure
Preprocessing

(to do)

Pretraining

(to do)

Evaluation results

(to do)

BibTeX entry and citation info
@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}
}

Runs of dandelin vilt-b32-mlm on huggingface.co

24.9K
Total runs
-1.5K
24-hour runs
-2.4K
3-day runs
-2.0K
7-day runs
5.8K
30-day runs

More Information About vilt-b32-mlm huggingface.co Model

More vilt-b32-mlm license Visit here:

https://choosealicense.com/licenses/apache-2.0

vilt-b32-mlm huggingface.co

vilt-b32-mlm huggingface.co is an AI model on huggingface.co that provides vilt-b32-mlm's model effect (), which can be used instantly with this dandelin vilt-b32-mlm model. huggingface.co supports a free trial of the vilt-b32-mlm model, and also provides paid use of the vilt-b32-mlm. Support call vilt-b32-mlm model through api, including Node.js, Python, http.

vilt-b32-mlm huggingface.co Url

https://huggingface.co/dandelin/vilt-b32-mlm

dandelin vilt-b32-mlm online free

vilt-b32-mlm huggingface.co is an online trial and call api platform, which integrates vilt-b32-mlm's modeling effects, including api services, and provides a free online trial of vilt-b32-mlm, you can try vilt-b32-mlm online for free by clicking the link below.

dandelin vilt-b32-mlm online free url in huggingface.co:

https://huggingface.co/dandelin/vilt-b32-mlm

vilt-b32-mlm install

vilt-b32-mlm is an open source model from GitHub that offers a free installation service, and any user can find vilt-b32-mlm on GitHub to install. At the same time, huggingface.co provides the effect of vilt-b32-mlm install, users can directly use vilt-b32-mlm installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

vilt-b32-mlm install url in huggingface.co:

https://huggingface.co/dandelin/vilt-b32-mlm

Url of vilt-b32-mlm

vilt-b32-mlm huggingface.co Url

Provider of vilt-b32-mlm huggingface.co

dandelin
ORGANIZATIONS

Other API from dandelin