ELI5 provenances missing in validation split
#4
by
dmrau
- opened
The provenances present in ELI5 in the original file from the github https://dl.fbaipublicfiles.com/KILT/eli5-dev-kilt.jsonl
are missing in the hf_hub dataset.
dmrau
changed discussion title from
ELI5 provenances missing
to ELI5 provenances missing in validation split
The provenances can be added to the validation
split with the following code:
def add_missing_data_eli5(dataset):
# hf dataset is missing provenances add them
original_fname = '../data/eli5-dev-kilt.jsonl'
if not os.path.exists(original_fname):
urllib.request.urlretrieve("https://dl.fbaipublicfiles.com/KILT/eli5-dev-kilt.jsonl", original_fname)
original = defaultdict(dict)
for l in open(original_fname):
example = json.loads(l)
original_provenance = [out['provenance'] for out in example['output'] if 'provenance' in out]
q_id = example['id']
original[q_id] = original_provenance
def add_missing_data(x, original_dataset):
id_ = x['id']
original_provenance = original_dataset[id_]
for i in range(len(original_provenance)):
x['output'][i]['provenance'] = original_provenance[i]
return x
return dataset.map(add_missing_data, fn_kwargs=dict(original_dataset=original))
dataset = datasets.load_dataset('kilt_tasks', 'eli5' )['validation']
dataset = add_missing_data_eli5(dataset)