Fasai Tricks

Batched Map

tok_ds = ds.map(tok_func, batched=True)

Learning Rate Finder

learn.lr_find(suggest_funcs=(slide, valley))

Test Dataset

tst_dl = learn.dls.test_dl(tst_df)
preds,_ = learn.get_preds(dl=tst_dl)

Ensemble

def ensemble():
    learn = tabular_learner(dls, metrics=accuracy, layers=[10,10])
    with learn.no_bar(),learn.no_logging(): learn.fit(16, lr=0.03)
    return learn.get_preds(dl=tst_dl)[0]
learns = [ensemble() for _ in range(5)]
 
ens_preds = torch.stack(learns).mean(0) # stack and mean