ArrowInvalid: Not an Arrow file
#21
by sinabooeshaghi - opened
Hi- thank you for putting this corpus together. I was unable to load the corpus into python with the pyarrow package. Here is a minimal example to reproduce my error
$ git lfs install
$ git clone https://huggingface.co/datasets/ctheodoris/Genecorpus-30M
$ cd Genecorpus-30M/genecorpus_30M_2048.dataset
$ pip install pyarrow transformers ipython
$ ipython
import pyarrow as pa
import pyarrow.parquet as pq
import sys
file_path = "dataset.arrow"
# Read the Arrow file
table = pa.ipc.RecordBatchFileReader(file_path).read_all()
# Print the contents
print(table)
error:
---------------------------------------------------------------------------
ArrowInvalid Traceback (most recent call last)
Cell In[1], line 10
7 file_path = "dataset.arrow"
9 # Read the Arrow file
---> 10 table = pa.ipc.RecordBatchFileReader(file_path).read_all()
12 # Print the contents
13 print(table)
File ~/.envs/basenv/lib/python3.12/site-packages/pyarrow/ipc.py:110, in RecordBatchFileReader.__init__(self, source, footer_offset, options, memory_pool)
107 def __init__(self, source, footer_offset=None, *, options=None,
108 memory_pool=None):
109 options = _ensure_default_ipc_read_options(options)
--> 110 self._open(source, footer_offset=footer_offset,
111 options=options, memory_pool=memory_pool)
File ~/.envs/basenv/lib/python3.12/site-packages/pyarrow/ipc.pxi:1085, in pyarrow.lib._RecordBatchFileReader._open()
File ~/.envs/basenv/lib/python3.12/site-packages/pyarrow/error.pxi:154, in pyarrow.lib.pyarrow_internal_check_status()
File ~/.envs/basenv/lib/python3.12/site-packages/pyarrow/error.pxi:91, in pyarrow.lib.check_status()
ArrowInvalid: Not an Arrow file
My OS
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
I may be doing something wrong in which case I would definitely appreciate your guidance! Thank you.
Thank you for your question! The file is in a Hugging Face dataset format.
https://huggingface.co/docs/datasets/en/index
from datasets import load_from_disk
data = load_from_disk(/path/to/dataset)
ctheodoris changed discussion status to closed
Ah that worked- thank you!