Error while loading dataset from hugging face

#9
by chowfi - opened

When running this:

dataset = load_dataset("openclimatefix/uk_pv")

I get the error:

The above exception was the direct cause of the following exception:

DatasetGenerationError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1640 if isinstance(e, SchemaInferenceError) and e.context is not None:
1641 e = e.context
-> 1642 raise DatasetGenerationError("An error occurred while generating the dataset") from e
1643
1644 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)

DatasetGenerationError: An error occurred while generating the dataset

ArrowTypeError: Could not convert {'10003'....

Could someone help me with this? I am interested in using this for a school project.

Open Climate Fix org
edited Oct 18

Hi @chowfi !

Unfortunately, the readme of this dataset is outdated, and this function will not work. Depending on how much data you need, you can either download it or try streaming with HfFileSystem as described in this issue for our ICON dataset. These instructions are for using xarray, but pandas also support ffspec, so something like this should work for you:

import pandas as pd
from huggingface_hub import HfFileSystem
fs = HfFileSystem()
pd.read_parquet("hf://datasets/openclimatefix/uk_pv/data/2023/12/202312_5min.parquet")

Depending on the size and number of files you are trying to open that can turn out to be quite slow, just a word of caution!

Hope this helps! Let me know if you have other questions.

P. S.
HF also provides direct reading through a link as described here, but our datasets require you to be authenticated, so this might not work. But you are welcome to try, I can't say I've tested this method thoroughly.

Sign up or log in to comment