UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte error with streaming=True

#4
by enyoukai - opened

Looks like when I load this dataset with streaming=True I get some utf-8 decoding error related to the below code:

def _generate_examples(self, labels, ontology, audio_files):
    with open(ontology) as fid:
        ontology_data = json.load(fid)

Furthermore, print(ontology) returns the url https://huggingface.co/datasets/agkphysics/AudioSet/resolve/main/data/ontology.json (not really sure how the open method was able to open that in the first place). So far replacing the code with

with urllib.request.urlopen("https://huggingface.co/datasets/agkphysics/AudioSet/resolve/main/data/ontology.json") as fid:
    ontology_data = json.load(fid)

seems to work though.

I seem to remember having streaming working at some point but I don't know if it was actually streaming from remote or just from my local copy.

It seems now that many HuggingFace datasets are switching to storing data in sharded Parquet files, which I would like to convert at some point (at least for the balanced train and eval sets). But I don't know when I will get the time.

I have converted the dataset to Parquet format, so it should be able to be streamed now.

agkphysics changed discussion status to closed

Sign up or log in to comment