Dataset Viewer issue

#1
by AresEkb - opened

The dataset viewer is not working.

The error is thrown because dl_manager.download(url) returns original url instead of a path to downloaded file.

I added the following code to _generate_tables(self, file_path):

        if file_path.startswith(_BASE_URL):
            file_path = file_path[len(_BASE_URL):]

Not sure whether it can help. But I can't check it, because the dataset preview doesn't get updated after the change.

Are there examples of datasets.ArrowBasedBuilder usage?

Error details:

Error code:   StreamingRowsError
Exception:    ArrowInvalid
Message:      Expected a local filesystem path, got a URI: 'https://huggingface.co/datasets/AresEkb/prof_standards_sbert_large_mt_nlu_ru/resolve/main/actions.parquet'
Traceback:    Traceback (most recent call last):
                File "/src/workers/datasets_based/src/datasets_based/workers/first_rows.py", line 484, in compute_first_rows_response
                  rows = get_rows(
                File "/src/workers/datasets_based/src/datasets_based/workers/first_rows.py", line 119, in decorator
                  return func(*args, **kwargs)
                File "/src/workers/datasets_based/src/datasets_based/workers/first_rows.py", line 175, in get_rows
                  rows_plus_one = list(itertools.islice(ds, rows_max_number + 1))
                File "/src/workers/datasets_based/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 846, in __iter__
                  for key, example in self._iter():
                File "/src/workers/datasets_based/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 788, in _iter
                  yield from ex_iterable
                File "/src/workers/datasets_based/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 113, in __iter__
                  yield from self.generate_examples_fn(**self.kwargs)
                File "/src/workers/datasets_based/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 713, in wrapper
                  for key, table in generate_tables_fn(**kwargs):
                File "/tmp/modules-cache/datasets_modules/datasets/AresEkb--prof_standards_sbert_large_mt_nlu_ru/e364fefad7451542c3a64db51fa6b66138851ca1fd4ac6a70f52940fb9c224e6/prof_standards_sbert_large_mt_nlu_ru.py", line 98, in _generate_tables
                  yield self.config.name, pq.read_table(file_path)
                File "/src/workers/datasets_based/.venv/lib/python3.9/site-packages/pyarrow/parquet.py", line 1960, in read_table
                  dataset = _ParquetDatasetV2(
                File "/src/workers/datasets_based/.venv/lib/python3.9/site-packages/pyarrow/parquet.py", line 1753, in __init__
                  if filesystem.get_file_info(path_or_paths).is_file:
                File "pyarrow/_fs.pyx", line 441, in pyarrow._fs.FileSystem.get_file_info
                File "pyarrow/error.pxi", line 143, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 99, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: Expected a local filesystem path, got a URI: 'https://huggingface.co/datasets/AresEkb/prof_standards_sbert_large_mt_nlu_ru/resolve/main/actions.parquet'

cc @albertvillanova @lhoestq @severo .

Hi, @AresEkb , thanks for reporting.

Indeed, datasets library does not support pq.read_table in streaming mode yet... We should implement it.

You can remove the last code you added, e.g.:

        if file_path.startswith(_BASE_URL):
            file_path = file_path[len(_BASE_URL):]

In the meantime, you can circumvent this issue by passing a file-like object (instead of path name) to pq.read_table:
You can replace this line:

yield self.config.name, pq.read_table(file_path)

with

yield self.config.name, pq.read_table(open(file_path, "rb"))

Thanks for the help! I've changed the code.

However it seems that the dataset card not updated after the change. It still shows the exception.
I think that update broken few days ago. Is it possible to force it?

It's working now, thanks @albertvillanova and @AresEkb , for figuring out how to adapt the code:

Capture d’écran 2023-01-11 à 14.42.41.png

I had to trigger the refresh manually. I'm investigating why it was not triggered automatically (it should have).

Thanks a lot for your help! It's great!

AresEkb changed discussion status to closed

The issue with automatic refresh should have been solved now (https://github.com/huggingface/datasets-server/pull/676). Thanks for having alerted us about this issue!

Sign up or log in to comment