mirror of
https://github.com/Vision-CAIR/MiniGPT-4.git
synced 2025-04-05 18:40:46 +00:00
fix: missing "answer" key
This commit is contained in:
parent
c5796f091b
commit
006a7b863b
@ -81,7 +81,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(34120, 4922)"
|
||||
"(34109, 4922)"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
@ -96,21 +96,18 @@
|
||||
" train_set = json.load(f)[\"data\"]\n",
|
||||
" train_set = [{k: v for k, v in d.items() if k in target_fields} for d in train_set]\n",
|
||||
" for d in train_set:\n",
|
||||
" filtered_answer = filter_answers(d[\"answers\"])\n",
|
||||
" if filtered_answer is None:\n",
|
||||
" train_set.remove(d)\n",
|
||||
" else:\n",
|
||||
" d[\"answer\"] = filter_answers(d[\"answers\"])\n",
|
||||
" # drop unanswerable questions\n",
|
||||
" train_set = [d for d in train_set if d[\"answer\"] is not None]\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"with open(BASE_DIR / \"TextVQA_0.5.1_val.json\", \"r\") as f:\n",
|
||||
" val_set = json.load(f)[\"data\"]\n",
|
||||
" val_set = [{k: v for k, v in d.items() if k in target_fields} for d in val_set]\n",
|
||||
" for d in val_set:\n",
|
||||
" filtered_answer = filter_answers(d[\"answers\"])\n",
|
||||
" if filtered_answer is None:\n",
|
||||
" val_set.remove(d)\n",
|
||||
" else:\n",
|
||||
" d[\"answer\"] = filter_answers(d[\"answers\"])\n",
|
||||
" # drop unanswerable questions\n",
|
||||
" val_set = [d for d in val_set if d[\"answer\"] is not None]\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"len(train_set), len(val_set)"
|
||||
|
Loading…
Reference in New Issue
Block a user