Datasets:

Modalities:
Image
Text
Formats:
parquet
Languages:
English
ArXiv:
License:
marksibrahim commited on
Commit
5ee9602
·
verified ·
1 Parent(s): fcd52bf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -6
README.md CHANGED
@@ -79,19 +79,31 @@ We have two subsets: Common-O (3 - 8 objects) and Common-O Complex (8 - 16 objec
79
  ```python
80
  import datasets
81
 
 
82
 
83
- question, image, image2, correct_response, _ = datasets.load("facebook/Common-O")[3]
84
 
85
- instructions = ""
86
 
87
- prompt = instructions + question
88
 
 
 
89
 
90
- output = model(prompt, image, image2)
91
 
92
- exact_match(output, correct_response)
 
 
 
 
 
 
 
 
 
 
 
93
  ```
94
 
95
 
96
 
97
-
 
79
  ```python
80
  import datasets
81
 
82
+ common_o = datasets.load("facebook/Common-O")["main"]
83
 
84
+ x = common_o[3]
85
 
 
86
 
87
+ output: str = model(x["image_1"], x["image_2"], x["question"])
88
 
89
+ check_answer(output, x["answer"])
90
+ ```
91
 
92
+ To check the answer, we use an exact match criteria:
93
 
94
+ ```python
95
+ def check_answer(
96
+ generation: str,
97
+ ground_truth: List[str]
98
+ ):
99
+ preds = generation.split("\n")[-1]
100
+ preds = re.sub("Answer:", "", preds)
101
+ preds = preds.split(",")
102
+ preds = sorted(preds, key=lambda x: x[0])
103
+
104
+ ground_truth = sorted(ground_truth)
105
+ return preds == ground_truth
106
  ```
107
 
108
 
109