2 GB is fairly limited. Try restarting your kernel and using a smaller batch size (a somewhat more advanced topic). You can do this by replacing:
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
with:
data = ImageClassifierData.from_paths(PATH, bs=32, tfms=tfms_from_model(arch, sz))
The default batch size (“bs”) is 64. If that doesn’t work, keep lowering the batch size.
9 Likes