Giter Club home page Giter Club logo

bert's Introduction

Multi-labels Classification base on BERT

this project is based on bert. Two features were added.

  1. multi-labels classification task
  2. export bert model for online serving

multi-labels

toxic-comment-classification data is used when test multi-labels model's performance.

performance on eval dataset(p.s. i don't adjust parameter)

class auc
toxic 0.9832314633351247
severe_toxic 0.991871062741562
obscene 0.9903738390113118
threat 0.969463869224999
insult 0.9863569234698775
identity_hate 0.9872562351925845

data format

csv format, and it should be like follows. (same with toxic-comment-classification dataset)

"id","comment_text","toxic","severe_toxic","obscene","threat","insult","identity_hate"
"0000997932d777bf","Explanation
Why the edits made under my username Hardcore Metallica Fan were reverted? They weren't vandalisms, just closure on some GAs after I voted at New York Dolls FAC. And please don't remove the template from the talk page since I'm retired now.89.205.38.27",0,0,0,0,0,0

header is not necessary in train file. But a classes.txt file needed to tell model how many labes will be used.

train

in tran phase, we need to change model structure after output layer.

multi-classes classifier put softmax layer after output layer.

for multi-labels, softmax change to sigmoid layer, and loss change to sigmoid_cross_entropy_with_logits, you can find it in create_model() function

eval

eval metric change to auc of every class, tf.metrics.auc used in metric_fn()

model export

original bert project only save ckpt model file, but not pb file.

if you want to serving online, you need pb file.

this problem is solved in bert issue 146, but i can't export model after do that. So i write model_exporter to export bert model.

bert's People

Contributors

0xflotus avatar abhishekraok avatar aijunbai avatar ammarasmro avatar bogdandidenko avatar cbockman avatar craigcitro avatar dalequark avatar eric-haibin-lin avatar georgefeng avatar hsm207 avatar imcaspar avatar jacobdevlin-google avatar jasonjpu avatar msramalho avatar pengli09 avatar qwfy avatar rodgzilla avatar soloice avatar stefan-it avatar tianxin1860 avatar ywkim avatar zhaoyongke avatar

Watchers

 avatar

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.