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

Home Page:https://blog.csdn.net/rensihui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: 'sentence1'

xkungfu opened this issue · comments

执行Keras-TextClassification/test/sentence_similarity/predit.py时报错:

Traceback (most recent call last):
  File "predict.py", line 155, in <module>
    pred_tet(path_test=path_sim_webank_test, rate=1)  # sample条件下设为1,否则训练语料可能会很少
  File "predict.py", line 99, in pred_tet
    target_names=target_names, digits=9)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/sklearn/utils/validation.py", line 72, in inner_f
    return f(**kwargs)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/sklearn/metrics/_classification.py", line 1929, in classification_report
    y_type, y_true, y_pred = _check_targets(y_true, y_pred)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/sklearn/metrics/_classification.py", line 81, in _check_targets
    check_consistent_length(y_true, y_pred)
  File "/home/datad/pyroot/similartextKT/env/lib/python3.6/site-packages/sklearn/utils/validation.py", line 256, in check_consistent_length
    " samples: %r" % [int(l) for l in lengths])
ValueError: Found input variables with inconsistent numbers of samples: [100, 0]

我是想要完成短文本相似度的训练和使用。请问短文本相似度的是不是这个文件?
这个报错应该如何处理?谢谢!

模型测试其他场景残留的代码,已修复