Giter Site home page Giter Site logo

keras_bert_classification's Introduction

基于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. 基于bert微调DSSM向量

新增bert_dssm_finetune,基于bert微调的DSSM向量,使用https://github.com/CyberZHG/keras-bert 获取CLS向量然后接一层全连接。 data目录下有1000条样本数据,格式为:标题\t内容

Reference

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

https://github.com/CyberZHG/keras-bert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.