Issues in loading image from dataset

I am trying to use the code below to load a dataset and display the image

from datasets import load_dataset
dataset = load_dataset(“darentang/sroie”)

from PIL import Image, ImageDraw, ImageFont
image = Image.open(dataset[‘train’][34][‘image_path’])
image = image.convert(“RGB”)
image.resize((350,450))

but when i try to show the image, it says that the file is not found


FileNotFoundError Traceback (most recent call last)
in <cell line: 3>()
1 from PIL import Image, ImageDraw, ImageFont
2
----> 3 image = Image.open(dataset[‘train’][34][‘image_path’])
4 image = image.convert(“RGB”)
5 image.resize((350,450))

/usr/local/lib/python3.10/dist-packages/PIL/Image.py in open(fp, mode, formats)
3225
3226 if filename:
→ 3227 fp = builtins.open(filename, “rb”)
3228 exclusive_fp = True
3229

FileNotFoundError: [Errno 2] No such file or directory: ‘/storage/hf-datasets-cache/all/datasets/89901751940830-config-parquet-and-info-darentang-sroie-aacc85f6/downloads/extracted/152a7c8b8e335ea11ab20a6c13040fb29c89ac2aee4c5c09dd36ad4a6fc28fe4/sroie/train/images/X51005433533.jpg’

Suddenly was struck with this two days ago, everything worked before perfectly.
Narrowed down to new version 2.16.0 of datasets, so these two commands helped:

python -m pip uninstall datasets
python -m pip install datasets==2.15

In case, this problem is not fixed yet, you may calculate your own “duration” values of the audiofile. Please see: Huggingface_Audio_Course/Huggingface-Audio_dataset.ipynb at main · kimdesok/Huggingface_Audio_Course · GitHub

You can find the fix, which doesn’t require downgrading datasets, in this Discord thread.