Dataset Viewer issue

#1
by nurik040404 - opened

The dataset viewer is not working.

Error details:

Error code:   FeaturesError
Exception:    ArrowInvalid
Message:      JSON parse error: Column(/comments/[]/score) changed from number to string in row 1
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 152, in _generate_tables
                  dataset = json.load(f)
                File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
                  return loads(fp.read(),
                File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
                  return _default_decoder.decode(s)
                File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
                  raise JSONDecodeError("Extra data", s, end)
              json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 2567)
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/split/first_rows_from_streaming.py", line 543, in compute_first_rows_response
                  iterable_dataset = iterable_dataset._resolve_features()
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1688, in _resolve_features
                  features = _infer_features_from_batch(self._head())
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 824, in _head
                  return _examples_to_batch(list(self.take(n)))
                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 678, in __iter__
                  yield from islice(self.ex_iterable, self.n)
                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 "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 763, in wrapper
                  for key, table in generate_tables_fn(**kwargs):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 155, in _generate_tables
                  raise e
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 131, in _generate_tables
                  pa_table = paj.read_json(
                File "pyarrow/_json.pyx", line 246, in pyarrow._json.read_json
                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: JSON parse error: Column(/comments/[]/score) changed from number to string in row 1

cc @albertvillanova @lhoestq @severo .

Thanks for reporting, @nurik040404 .

Please note that the issue is not related to the dataset viewer, but to the data in your dataset: it can't be loaded

from datasets import load_dataset

ds = load_dataset("nurik040404/mse")

gives error:

ArrowInvalid: JSON parse error: Column(/comments/[]/score) changed from number to string in row 1

The datasets loading script fails when trying to infer the data type of the comments score: sometimes they are numeric and some other times they are string (the empty string).

You should:

  • Either edit the data content to make consistent the data type of the comments score
  • Or implement a loading script and specify the appropriate data types using the datasets.Features class

Sign up or log in to comment