Transformers
PyTorch
vilt
Inference Endpoints
juletxara commited on
Commit
303ada9
1 Parent(s): 8c07839

update readme

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md CHANGED
@@ -1,3 +1,75 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ # Vision-and-Language Transformer (ViLT), fine-tuned on VSR random split
6
+
7
+ Vision-and-Language Transformer (ViLT) model fine-tuned on random split of [Visual Spatial Reasoning (VSR)](https://arxiv.org/abs/2205.00363). ViLT was introduced in the paper [ViLT: Vision-and-Language Transformer
8
+ Without Convolution or Region Supervision](https://arxiv.org/abs/2102.03334) by Kim et al. and first released in [this repository](https://github.com/dandelin/ViLT).
9
+
10
+ ## Intended uses & limitations
11
+
12
+ You can use the model to determine whether a sentence is true or false given an image.
13
+
14
+ ### How to use
15
+
16
+ Here is how to use the model in PyTorch:
17
+
18
+ ```
19
+ from transformers import ViltProcessor, ViltForImagesAndTextClassification
20
+ import requests
21
+ from PIL import Image
22
+
23
+ image = Image.open(requests.get("https://camo.githubusercontent.com/ffcbeada14077b8e6d4b16817c91f78ba50aace210a1e4754418f1413d99797f/687474703a2f2f696d616765732e636f636f646174617365742e6f72672f747261696e323031372f3030303030303038303333362e6a7067", stream=True).raw)
24
+ text = "The person is ahead of the cow."
25
+
26
+ processor = ViltProcessor.from_pretrained("juletxara/vilt-vsr-random")
27
+ model = ViltForImagesAndTextClassification.from_pretrained("juletxara/vilt-vsr-random")
28
+
29
+ # prepare inputs
30
+ encoding = processor(image, text, return_tensors="pt")
31
+
32
+ # forward pass
33
+ outputs = model(input_ids=encoding.input_ids, pixel_values=encoding.pixel_values.unsqueeze(0))
34
+ logits = outputs.logits
35
+ idx = logits.argmax(-1).item()
36
+ print("Predicted answer:", model.config.id2label[idx])
37
+ ```
38
+
39
+ ## Training data
40
+
41
+ (to do)
42
+
43
+ ## Training procedure
44
+
45
+ ### Preprocessing
46
+
47
+ (to do)
48
+
49
+ ### Pretraining
50
+
51
+ (to do)
52
+
53
+ ## Evaluation results
54
+
55
+ (to do)
56
+
57
+ ### BibTeX entry and citation info
58
+
59
+ ```bibtex
60
+ @misc{kim2021vilt,
61
+ title={ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision},
62
+ author={Wonjae Kim and Bokyung Son and Ildoo Kim},
63
+ year={2021},
64
+ eprint={2102.03334},
65
+ archivePrefix={arXiv},
66
+ primaryClass={stat.ML}
67
+ }
68
+
69
+ @article{liu2022visual,
70
+ title={Visual Spatial Reasoning},
71
+ author={Liu, Fangyu and Emerson, Guy and Collier, Nigel},
72
+ journal={arXiv preprint arXiv:2205.00363},
73
+ year={2022}
74
+ }
75
+ ```