text_plain_output_1.png
(df_train.shape, df_valid.shape)

path = Path('../input/')

path.ls()

src = ItemLists(path, TextList.from_df(df_train, path='.', cols=1), TextList.from_df(df_valid, path='.', cols=1))

bs = 48

src_lm = ItemLists(path, TextList.from_df(df_train, path='.', cols=1), TextList.from_df(df_valid, path='.', cols=1))

data_lm = src_lm.label_for_lm().databunch(bs=bs)

data_lm.vocab.itos[:20]

data_lm.train_ds[0][0].data[:10]

learn = language_model_learner(data_lm, AWD_LSTM, drop_mult=0.3, model_dir='/temp/model/')

learn.lr_find()

learn.fit_one_cycle(4, 0.05, moms=(0.8, 0.7))

learn.save('fit_head')
learn.load('fit_head')

learn.unfreeze()
learn.lr_find()
learn.recorder.plot(suggestion=True)