Learn.fit_one_cycle taking 1.5 hours to complete on MNIST

Hi guys I’m just starting out with the fastai stuff and I was working on creating a MNIST classifier using data from the Kaggle dataset as I wanted to practice importing data from there.

I seem to have everything working just the learn.fit_one_cycle(1, 0.1) takes too long to complete and varies between 1 - 2 hours to complete. I have the runtime set to GPU and have played around with some different batch sizes but doesn’t seem to make much of a difference. I’ve also restarted the runtime and it randomly managed to finish in 9 minutes yesterday but it doesn’t seem to be consistent or repeatable.

I’ve also had a look at some older post about colab and there seems to be some other users who have had issues with the completion time.

Any insight would be great!

The current code set up looks like this:

mnist = DataBlock(

blocks=(ImageBlock, CategoryBlock), 

get_items=get_image_files,

splitter = GrandparentSplitter(train_name = "train", valid_name = "valid"), 

get_y=parent_label,

item_tfms=Resize(224))

dls = mnist.dataloaders(PATH)

Then:

mnist = mnist.new(

    item_tfms = RandomResizedCrop(224, min_scale = 0.5),

    batch_tfms = aug_transforms())

dls = mnist.dataloaders(PATH,bs = 32)

learn = cnn_learner(dls, resnet18, metrics=[error_rate,accuracy])

learn.fit_one_cycle(1, 0.1)