yongzhuo / Keras-TextClassification

中文长文本分类、短句子分类、多标签分类、两句子相似度(Chinese Text Classification of Keras NLP, multi-label classify, or sentence classify, long or short),字词句向量嵌入层(embeddings)和网络层(graph)构建基类,FastText,TextCNN,CharCNN,TextRNN, RCNN, DCNN, DPCNN, VDCNN, CRNN, Bert, Xlnet, Albert, Attention, DeepMoji, HAN, 胶囊网络-CapsuleNet, Transformer-encode, Seq2seq, SWEM, LEAM, TextGCN
https://blog.csdn.net/rensihui
MIT License
1.78k stars 405 forks source link

TypeError: get_encoders() got an unexpected keyword argument 'use_adapter' #50

Closed xkungfu closed 4 years ago

xkungfu commented 4 years ago

执行\Keras-TextClassification\keras_textclassification\m00_Bert\train.py时报错:


load bert model start!

Traceback (most recent call last):
  File "train.py", line 109, in <module>
    train(rate=1) # sample条件下设为1,否则训练语料可能会很少
  File "train.py", line 88, in train
    graph = Graph(hyper_parameters)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_textclassification/m00_Bert/graph.py", line 43, in __init__
    super().__init__(hyper_parameters)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_textclassification/base/graph.py", line 62, in __init__
    self.create_model(hyper_parameters)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_textclassification/m00_Bert/graph.py", line 53, in create_model
    super().create_model(hyper_parameters)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_textclassification/base/graph.py", line 103, in create_model
    self.word_embedding = Embeddings(hyper_parameters=hyper_parameters)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_textclassification/base/embedding.py", line 199, in __init__
    super().__init__(hyper_parameters)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_textclassification/base/embedding.py", line 71, in __init__
    self.build()
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_textclassification/base/embedding.py", line 212, in build
    trainable=self.trainable)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_bert/loader.py", line 169, in load_trained_model_from_checkpoint
    **kwargs)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_bert/loader.py", line 58, in build_model_from_config
    **kwargs)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/keras_bert/bert.py", line 126, in get_model
    adapter_activation=gelu,
TypeError: get_encoders() got an unexpected keyword argument 'use_adapter'
xkungfu commented 4 years ago

pip install keras-bert==0.81.1 slove the problem

yongzhuo commented 4 years ago

我这边keras-bert==0.81.0没有出现该问题