Coder Social home page Coder Social logo

codewithzichao / multilingual-transformers Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 3.0 25 KB

Our source code for EACL2021 workshop: Offensive Language Identification in Dravidian Languages. We ranked 4th, 4th and 3rd in Tamil, Malayalam and Kannada language of this task finally!๐Ÿฅณ

Python 99.22% Shell 0.78%
pytorch multilingual eacl transformer xlm-roberta

multilingual-transformers's Introduction

Offensive Language Identification in Dravidian Languages at EACL2021 Workshop

Our source code for EACL2021 workshop: Offensive Language Identification in Dravidian Languages. We ranked 4th,4th and 3th in Tamil, Malayalam and Kannada language of this task finally!๐Ÿฅณ

Updated: Source code is released!๐Ÿคฉ

I will release the code very soon.

Repository structure

โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ ckpt                        # store model weights during training
โ”‚ย ย  โ””โ”€โ”€ README.md
โ”œโ”€โ”€ data                        # store the data
โ”‚ย ย  โ””โ”€โ”€ README.md
โ”œโ”€โ”€ gen_data.py                 # generate Dataset
โ”œโ”€โ”€ install_cli.sh              # install required package
โ”œโ”€โ”€ loss.py                     # loss function
โ”œโ”€โ”€ main_xlm_bert.py            # train mulingual-BERT
โ”œโ”€โ”€ main_xlm_roberta.py         # train XLM-RoBERTa
โ”œโ”€โ”€ model.py                    # model implementation
โ”œโ”€โ”€ pred_data
โ”‚ย ย  โ””โ”€โ”€ README.md
โ”œโ”€โ”€ preprocessing.py            # preprocess the data
โ”œโ”€โ”€ pretrained_weights          # store the pretrained weights
โ”‚ย ย  โ””โ”€โ”€ README.md
โ””โ”€โ”€ train.py                    # define training and validation loop

Installation

Use the following command so that you can install all of required packages:

sh install_cli.sh

Preprocessing

The first step is to preprocess the data. Just use the following command:

python3 -u preprocessing.py

Training

The second step is to train our model. In our solution, We trained two models which use multilingual-BERT and XLM-RoBERTa as the encoder, respectively.

If you want to train model which use multilingual-BERT as the encoder, use the following command:

nohup python3 -u main_xlm_bert.py \
        --base_path your base path \
        --batch_size 8 \
        --epochs 50 \
        > train_xlm_bert_log.log 2>&1 &

If you want to train model which use XLM-RoBERTa as the encoder, use the following command:

nohup python3 -u main_xlm_roberta.py \
        --base_path your base path \
        --batch_size 8 \
        --epochs 50 \
        > train_xlm_roberta_log.log 2>&1 &

Inference

The final step is inference after training. Use the following command:

nohup python3 -u inference.py > inference.log 2>&1 &

Congralutions! You have got the final results!๐Ÿคฉ

If you use our code, please indicate the source.

multilingual-transformers's People

Contributors

codewithzichao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.