diff --git a/README.md b/README.md index ca1ceef..e95fad6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # bert-utils -本文基于Google开源的[BERT]()代码进行了进一步的简化,方便生成句向量与做文本分类 +本文基于Google开源的[BERT](https://github.com/google-research/bert)代码进行了进一步的简化,方便生成句向量与做文本分类 1、下载BERT中文模型 diff --git a/data/test.csv b/data/dev.csv similarity index 100% rename from data/test.csv rename to data/dev.csv diff --git a/similarity.py b/similarity.py index 4d6e792..0472070 100644 --- a/similarity.py +++ b/similarity.py @@ -664,13 +664,13 @@ class BertSim: if __name__ == '__main__': sim = BertSim() - # sim.set_mode(tf.estimator.ModeKeys.TRAIN) - # sim.train() - # sim.set_mode(tf.estimator.ModeKeys.EVAL) - # sim.eval() - sim.set_mode(tf.estimator.ModeKeys.PREDICT) - while True: - sentence1 = input('sentence1: ') - sentence2 = input('sentence2: ') - predict = sim.predict(sentence1, sentence2) - print(f'similarity:{predict[0][1]}') + sim.set_mode(tf.estimator.ModeKeys.TRAIN) + sim.train() + sim.set_mode(tf.estimator.ModeKeys.EVAL) + sim.eval() + # sim.set_mode(tf.estimator.ModeKeys.PREDICT) + # while True: + # sentence1 = input('sentence1: ') + # sentence2 = input('sentence2: ') + # predict = sim.predict(sentence1, sentence2) + # print(f'similarity:{predict[0][1]}')