Spaces:
Sleeping
Sleeping
Habeeb Okunade commited on
Commit ·
f119f72
1
Parent(s): 785b8f1
Update Training script
Browse files37 unmodified lines38394041424344454647487 unmodified lines5657585960616237 unmodified linesprocessor = AutoImageProcessor.from_pretrained(MODEL_NAME)def transform(example):# Determine image columnimage_column = "image" if "image" in example else list(example.keys())[0]images = example[image_column]# Ensure listif not isinstance(images, list):images = [images]7 unmodified linesraise ValueError(f"Unknown type for image: {type(img)}")processed_images.append(img)# Convert images to tensorsinputs = processor(images=processed_images, return_tensors="pt")# Handle labels37 unmodified lines3839404142434445464748497 unmodified lines5758596061626337 unmodified linesprocessor = AutoImageProcessor.from_pretrained(MODEL_NAME)def transform(example):# Determine correct image columnimage_column = "image" if "image" in example else [c for c in example.keys() if c != "label"][0]images = example[image_column]# Ensure we always have a listif not isinstance(images, list):images = [images]7 unmodified linesraise ValueError(f"Unknown type for image: {type(img)}")processed_images.append(img)# Convert to tensors (batched)inputs = processor(images=processed_images, return_tensors="pt")# Handle labels
train2.py+5-4