debugging
Browse files- docbank.py +4 -1
docbank.py
CHANGED
|
@@ -133,6 +133,9 @@ class Docbank(datasets.GeneratorBasedBuilder):
|
|
| 133 |
|
| 134 |
# DEFAULT_CONFIG_NAME = "small" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 135 |
TOKENIZER = LayoutXLMTokenizerFast.from_pretrained("microsoft/layoutxlm-base")
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
def _info(self):
|
| 138 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
|
@@ -230,7 +233,7 @@ class Docbank(datasets.GeneratorBasedBuilder):
|
|
| 230 |
normalized_bbox = [int(x) for x in row[1:5]]
|
| 231 |
tokens.append(row[0])
|
| 232 |
bboxes.append(normalized_bbox)
|
| 233 |
-
labels.append(row[9])
|
| 234 |
# tokenized_input = self.TOKENIZER(
|
| 235 |
# row[0],
|
| 236 |
# add_special_tokens=False,
|
|
|
|
| 133 |
|
| 134 |
# DEFAULT_CONFIG_NAME = "small" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 135 |
TOKENIZER = LayoutXLMTokenizerFast.from_pretrained("microsoft/layoutxlm-base")
|
| 136 |
+
LABELS = ['abstract', 'author', 'caption', 'date', 'equation', 'figure', 'footer', 'list', 'paragraph', 'reference', 'section', 'table', 'title']
|
| 137 |
+
ID2LABEL = {k: v for k, v in enumerate(LABELS)}
|
| 138 |
+
LABEL2ID = {v: k for k, v in enumerate(LABELS)}
|
| 139 |
|
| 140 |
def _info(self):
|
| 141 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
|
|
|
| 233 |
normalized_bbox = [int(x) for x in row[1:5]]
|
| 234 |
tokens.append(row[0])
|
| 235 |
bboxes.append(normalized_bbox)
|
| 236 |
+
labels.append(self.LABEL2ID(row[9]))
|
| 237 |
# tokenized_input = self.TOKENIZER(
|
| 238 |
# row[0],
|
| 239 |
# add_special_tokens=False,
|