Skip to content

Bert-classification and bert-dssm implementation with keras.

Notifications You must be signed in to change notification settings

haiming2019/keras_bert_classification

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

基于bert特征的文本分类与dssm语义表示

#0. ready

将bert预训练模型(chinese_L-12_H-768_A-12)放到当前目录下,下载地址:https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip

#1. bert_fc.py

抽取bert句向量特征,接全连接层。 训练命令:python bert_fc.py

#2. bert_lstm.py

抽取bert字向量特征,后面接LSTM/GRU和全连接层。 训练命令:python bert_lstm.py

#3. bert_dssm.py

先将文本转换为bert句向量存在tfrecord中,这一步自行处理即可, 然后从tfrecord中读取数据,数据格式为feed_dict = {"query":[[1,2,3], [4,6,7]], "doc": [[1,2,3], [4,6,7]]}

#4. TODO: 基于bert微调DSSM向量

Reference

https://github.com/google-research/bert

About

Bert-classification and bert-dssm implementation with keras.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%