Batch size setting in the new fast.ai Framework?

I’m rather used to batch_size coming from Keras and such, in the new framework here I can’t seem to find where it is controlled. Is it dynamic? Or all just mini batch = 1?

Thanks!

1 Like

When you set the dataset you can specify a parameter called bs (batch size). Look in dataset.py in dl/fastai dir

1 Like

Use the argument bs. See an example below.

data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(resnet34, sz), bs=32)
learn = ConvLearner.pretrained(resnet34, data, precompute=True)
learn.fit(0.01, 1)
2 Likes

Oh duh and he mentioned it in the lesson too. Just remembered. Thanks!

Is it possible to set the batch size on tabular data? I have a very large dataset I would like to train and I’m running out of memory.

As a argument in the databunch call

5 Likes