Skip to content

Commit 0628fa6

Browse files
authored
fix: small fixes (#108)
* Add README for Docling-DPBench Signed-off-by: Christoph Auer <[email protected]> * fix: use of load_from_doctags, docvqa fixes Signed-off-by: Christoph Auer <[email protected]> --------- Signed-off-by: Christoph Auer <[email protected]>
1 parent 6441688 commit 0628fa6

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

docling_eval/dataset_builders/docvqa_builder.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,30 +117,31 @@ def _process_document(self, doc_id, qa_items) -> DatasetRecord:
117117
)
118118

119119
answer_index = index + 1
120-
for answer in qa_item["answers"]:
121-
cells.append(
122-
GraphCell(
123-
label=GraphCellLabel.VALUE,
124-
cell_id=answer_index,
125-
text=answer,
126-
orig=answer,
120+
if "answers" in qa_items and isinstance(qa_item["answers"], list):
121+
for answer in qa_item["answers"]:
122+
cells.append(
123+
GraphCell(
124+
label=GraphCellLabel.VALUE,
125+
cell_id=answer_index,
126+
text=answer,
127+
orig=answer,
128+
)
127129
)
128-
)
129-
links.extend(
130-
[
131-
GraphLink(
132-
label=GraphLinkLabel.TO_VALUE,
133-
source_cell_id=index,
134-
target_cell_id=answer_index,
135-
),
136-
GraphLink(
137-
label=GraphLinkLabel.TO_KEY,
138-
source_cell_id=answer_index,
139-
target_cell_id=index,
140-
),
141-
]
142-
)
143-
answer_index += 1
130+
links.extend(
131+
[
132+
GraphLink(
133+
label=GraphLinkLabel.TO_VALUE,
134+
source_cell_id=index,
135+
target_cell_id=answer_index,
136+
),
137+
GraphLink(
138+
label=GraphLinkLabel.TO_KEY,
139+
source_cell_id=answer_index,
140+
target_cell_id=index,
141+
),
142+
]
143+
)
144+
answer_index += 1
144145

145146
index = answer_index
146147

0 commit comments

Comments
 (0)