我有数据框对象,它有两个字段,即文本和标签,我想做类似于 ULMFit 的文本分类
以下是具有以下特定目的的代码
data_lm = TextLMDataBunch.from_df(train_df = df_trn, valid_df = df_val, path = "")
# Language model learner object
data_clas = TextClasDataBunch.from_df(path = "", train_df = df_trn, valid_df = df_val, vocab=data_lm.train_ds.vocab, bs=32)
分类对象
learn = language_model_learner(data_lm, AWD_LSTM, drop_mult=0.5)
# learn language model object
learn.fit_one_cycle(10, 1e-2)
# Fit a language model
learn.save_encoder('good_ft_enc')
# save the encoder of the language model
learn = text_classifier_learner(data_clas,AWD_LSTM,drop_mult=0.7)
learn.load_encoder('good_ft_enc')
# classifier object with the loaded encoder
learn.fit_one_cycle(3, 1e-2)
# fit the classifier
这些是遵循的一系列步骤,但我无法理解数据加载器是否正确加载了我的文本和标签字段,因为我没有在函数参数中的任何地方给出它们。任何帮助将不胜感激