Code Monkey home page Code Monkey logo

mn-tweet-bert's Introduction

mn-tweet-bert

Introduction

Using this repo, you can classify whether the input text is similar to @Iderodcomedian's or @enkhbat's. And you will fine-tuning will take at most an hour.

How to use

Data

For fine-tuning, the small noisy data was crawled from twitter (tweets of @Iderodcomedian and @enkhbat).

You can download it using

source scripts/get_train_data.sh

Models

You can also use the fine-tuned model on the small dataset using:

wget https://storage.googleapis.com/bucket-97tsogoo-gmail/mn-tweets-idree-enkhbat/models/tweetmn-epoch-10/pytorch_model.bin && mv pytorch_model.bin ./output/

If you want to fine-tune the pre-trained BERT (Mongolian) from scratch you can use:

./scripts/run_classifier.sh

and this will output the evualation scores too. Before that you need pre-trained BERT on Mongolian text corpus.

Results

After the training, you will see similar to:

eval_loss = 0.5363224036991596
global_step = 290
loss = 7.182709101972908e-05
tweetmn = {'acc': 0.9, 'f1': 0.888888888888889, 'acc_and_f1': 0.8944444444444445}

Visualization

Pytorch tool in jessevig/bertviz can be used to see attention scores after fine-tuned model is trained.

Comment: Originally in the bertviz, sentencepiece implementation is not released yet!

Attention-head example

From the picture above, we can see could learn some grammatical features and interesting connections between words.

For example the words компанийнхаа and менежерүүд were similar to phrase компаний менежер and attention scored high on words not working as the phrase in the current sentence.

References

Based on following repositories:

mn-tweet-bert's People

Contributors

bayartsogt-ya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

undarmaa

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.