Open mnslarcher opened 6 months ago
OK, I think I found the problem.
from datasets import load_dataset
dataset = load_dataset("nelorth/oxford-flowers")
image = dataset["train"][0]["image"]
print(image.keys())
gives you:
dict_keys(['bytes', 'path'])
This breaks hf_datasets_augs_helper
that expect dataset["train"][0]["image"]
to be a PIL Image:
def hf_datasets_augs_helper(examples, transform, image_key, mode='RGB'):
"""Apply passed in transforms for HuggingFace Datasets."""
images = [transform(image.convert(mode)) for image in examples[image_key]]
return {image_key: images}
A fix for this dataset would be:
import io
from PIL import Image
def hf_datasets_augs_helper(examples, transform, image_key, mode='RGB'):
"""Apply passed in transforms for HuggingFace Datasets."""
images = [transform(Image.open(io.BytesIO(image["bytes"])).convert(mode)) for image in examples[image_key]]
return {image_key: images}
Hi,
First, congratulations on this amazing repository; it's a great codebase for study.
I'm attempting to run the Oxford Flowers demo but am encountering an error. I'm not sure if it's just me or if the demo is currently non-functional (perhaps due to some changes on Hugging Face's end, or something else I'm unaware of):
Here's the full traceback: