我正在运行下面链接中给出的代码。 python的ktrain软件包用于bert文本分类的嵌入方式是什么。我相信代码使用的是Bert的预训练模型。就是将bert嵌入与输入嵌入相结合。模型中的嵌入是否也考虑了给定的输入文本
代码的相关部分
import ktrain
from ktrain import text
x_train, y_train), (x_test, y_test), preproc = text.texts_from_array(x_train=x_train, y_train=y_train,
x_test=x_test, y_test=y_test,
class_names=train_b.target_names,
preprocess_mode='bert',
ngram_range=1,
maxlen=350,
max_features=35000)
model = text.text_classifier('bert', train_data=(x_train, y_train), preproc=preproc)
learner = ktrain.get_learner(model, train_data=(x_train, y_train), batch_size=6)
https://github.com/amaiya/ktrain/blob/master/examples/text/20newsgroups-BERT.ipynb