Datasets:
Dataset Viewer issue: FileNotFoundError: [Errno 2] No such file or directory: 'https://github.com/masakhane-io/afriqa/raw/main/data/queries/bem/queries.afriqa.bem.en.train.json'
#1
by
albertvillanova
HF staff
- opened
The dataset viewer is not working.
Error details:
Error code: StreamingRowsError
Exception: FileNotFoundError
Message: [Errno 2] No such file or directory: 'https://github.com/masakhane-io/afriqa/raw/main/data/queries/bem/queries.afriqa.bem.en.train.json'
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 307, in get_rows_or_raise
return get_rows(
File "/src/services/worker/src/worker/utils.py", line 251, in decorator
return func(*args, **kwargs)
File "/src/services/worker/src/worker/utils.py", line 287, in get_rows
rows_plus_one = list(itertools.islice(ds, rows_max_number + 1))
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 937, in __iter__
for key, example in ex_iterable:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 113, in __iter__
yield from self.generate_examples_fn(**self.kwargs)
File "/tmp/modules-cache/datasets_modules/datasets/masakhane--afriqa/5de49a2da2b890c80d5ff0fc1581d742cbb1eeada1e2b071c8dbfdb032fafb1e/afriqa.py", line 104, in _generate_examples
with jsonlines.open(filepath) as f:
File "/src/services/worker/.venv/lib/python3.9/site-packages/jsonlines/jsonlines.py", line 627, in open
fp = builtins.open(file, mode=mode + "t", encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'https://github.com/masakhane-io/afriqa/raw/main/data/queries/bem/queries.afriqa.bem.en.train.json'
CC: @albertvillanova
This dataset uses jsonlines
and the datasets
library does not support streaming for this library yet.
- Please note that the viewer uses the streaming mode under the hood
I think we should support for streaming datasets that use jsonlines
, but this will take some time until it is operative on the viewer.
In the meantime, you could avoid the issue by using json
instead of jsonlines
:
You could replace:
with jsonlines.open(filepath) as f:
for _, example in enumerate(f):
with:
with open(filepath, encoding="utf-8-sig") as f:
for _, row in enumerate(f):
example = json.loads(row)
See:
- Issue opened in
datasets
: Support streaming datasets that use jsonlines
Thank you
@albertvillanova
for taking a look.
I'll revert to using json
instead
ToluClassics
changed discussion status to
closed