not able to download dataset

#2
by mayur20169 - opened

Resolving data files: 100%|█████████████████████████████████████████████████████████████████████████████████████| 408/408 [00:00<00:00, 616.30it/s]
Downloading data: 100%|█████████████████████████████████████████████████████████████████████████████████████| 312/312 [00:00<00:00, 6268.25files/s]
Generating train split: 8739 examples [00:00, 27257.80 examples/s]
Traceback (most recent call last):
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/builder.py", line 2013, in _prepare_split_single
writer.write_table(table)
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/arrow_writer.py", line 585, in write_table
pa_table = table_cast(pa_table, self._schema)
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/table.py", line 2302, in table_cast
return cast_table_to_schema(table, schema)
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/table.py", line 2256, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
commodity_desc: string
reference_period_desc: string
year: int64
state_ansi: int64
state_name: string
county_ansi: int64
county_name: string
asd_code: int64
asd_desc: string
domain_desc: string
source_desc: string
agg_level_desc: string
PRODUCTION, MEASURED IN 480 LB BALES: double
YIELD, MEASURED IN LB / ACRE: double
-- schema metadata --
pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 2045
to
{'commodity_desc': Value(dtype='string', id=None), 'reference_period_desc': Value(dtype='string', id=None), 'year': Value(dtype='int64', id=None), 'state_ansi': Value(dtype='int64', id=None), 'state_name': Value(dtype='string', id=None), 'county_ansi': Value(dtype='int64', id=None), 'county_name': Value(dtype='string', id=None), 'asd_code': Value(dtype='int64', id=None), 'asd_desc': Value(dtype='string', id=None), 'domain_desc': Value(dtype='string', id=None), 'source_desc': Value(dtype='string', id=None), 'agg_level_desc': Value(dtype='string', id=None), 'PRODUCTION, MEASURED IN BU': Value(dtype='float64', id=None), 'YIELD, MEASURED IN BU / ACRE': Value(dtype='float64', id=None)}
because column names don't match

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/DATA2/mayur/mayur/geohack/MMST-ViT/util/data.py", line 3, in
data = load_dataset("fudong03/Tiny-CropNet")
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/load.py", line 2616, in load_dataset
builder_instance.download_and_prepare(
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/builder.py", line 1029, in download_and_prepare
self._download_and_prepare(
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/builder.py", line 1124, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/builder.py", line 1884, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/home/mayur/miniconda3/envs/geo/lib/python3.9/site-packages/datasets/builder.py", line 2015, in _prepare_split_single
raise DatasetGenerationCastError.from_cast_error(
datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset

All the data files must have the same columns, but at some point there are 2 new columns ({'YIELD, MEASURED IN LB / ACRE', 'PRODUCTION, MEASURED IN 480 LB BALES'}) and 2 missing columns ({'PRODUCTION, MEASURED IN BU', 'YIELD, MEASURED IN BU / ACRE'}).

This happened while the csv dataset builder was generating data using

hf://datasets/fudong03/Tiny-CropNet/USDA Crop Dataset/data/Cotton/2017/USDA_Cotton_County_2017.csv (at revision 07260d9d23d7093abd89cb5a78f8d82a439c8816)

Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)

I had the same issue, was able to download this using this
////////////////////

from huggingface_hub import snapshot_download
import shutil
import os

#Define your desired directory

desired_dir = "/Tiny-CropNet"

Download the dataset

snapshot_download(
repo_id="fudong03/Tiny-CropNet",
repo_type="dataset",
cache_dir=desired_dir)

Sign up or log in to comment