preprocess = transforms.Compose(
...     [
...         transforms.Resize((config.image_size, config.image_size)),
...         transforms.RandomHorizontalFlip(),
...         transforms.ToTensor(),
...         transforms.Normalize([0.5], [0.5]),
...     ]
... ) Use 🤗 Datasets’ set_transform method to apply the preprocess function on the fly during training:   Copied >>> def transform(examples):
...     images = [preprocess(image.convert("RGB")) f