Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
10K<n<100K
Language Creators:
found
Annotations Creators:
expert-generated
Source Datasets:
original
ArXiv:
Tags:
License:

How to handle starting position if there is no answer?

#2
by BayesianMemories - opened

Hey y'all,

I'm trying to create training examples using the Contract Understanding Atticus Dataset (CUAD) the corresponding SQuAD like dataset. I've been following the example in the huggingface tutorial (https://huggingface.co/course/chapter7/7?fw=pt#processing-the-validation-data).

However, the script given doesn't work since there are some answers which do not have questions. When you run the preprocess_training_examples there is an IndexError because the start_char = answer["answer_start"][0] is an empty list.

Does anyone have suggestions on how I should be handling these missing answers?

You can load the data doing the following, and I've copied and pasted the first 15 elements of the list:

from datasets import load_dataset
raw_datasets = load_dataset('cuad')

raw_datasets['train'][:15]['answers']

[{'text': ['DISTRIBUTOR AGREEMENT'], 'answer_start': [44]},
{'text': ['Distributor'], 'answer_start': [244]},
{'text': ['Electric City of Illinois L.L.C.'], 'answer_start': [49574]},
{'text': ['Electric City of Illinois LLC'], 'answer_start': [212]},
{'text': ['Company'], 'answer_start': [197]},
{'text': ['Electric City Corp.'], 'answer_start': [148]},
{'text': ['7th day of September, 1999.'], 'answer_start': [263]},
{'text': ['Unless earlier terminated otherwise provided therein, this Agreement, subject to the commencement date established in Section 1.3, shall be effective immediately.'],
'answer_start': [31058]},
{'text': ['The term of this Agreement shall be ten (10) years (the "Term") which shall commence on the date upon which the Company delivers to Distributor the last Sample, as defined hereinafter.'],
'answer_start': [5268]},
{'text': ['The term of this Agreement shall be ten (10) years (the "Term") which shall commence on the date upon which the Company delivers to Distributor the last Sample, as defined hereinafter.'],
'answer_start': [5268]},
{'text': ['If Distributor complies with all of the terms of this Agreement, the Agreement shall be renewable on an annual basis for one (1) year terms for up to another ten (10) years on the same terms and conditions as set forth herein.'],
'answer_start': [5543]},
{'text': [], 'answer_start': []},
{'text': ['This Agreement is to be construed according to the laws of the State of Illinois.'],
'answer_start': [52061]},
{'text': [], 'answer_start': []},
{'text': [], 'answer_start': []}]

deleted
This comment has been hidden

Sign up or log in to comment