GithubHelp home page GithubHelp logo

giyaseddin / kinyabert-acl2022 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anzeyimana/kinyabert-acl2022

0.0 0.0 0.0 449.25 MB

License: MIT License

Shell 1.98% C++ 0.52% Python 84.99% Lua 0.17% Cuda 1.02% Makefile 0.02% HTML 3.21% Batchfile 0.03% Cython 0.35% Rich Text Format 7.71%

kinyabert-acl2022's Introduction

KinyaBERT: a Morphology-aware Kinyarwanda Language Model

Implementation for the ACL 2022 paper KinyaBERT: a Morphology-aware Kinyarwanda Language Model.

Brief Introduction

KinyaBERT implements a two-tier BERT architecture for modeling morphologically rich languages (MRLs). The current implementation is tailored to Kinyarwanda, a language spoken by more than 12M people in Central and Eastern Africa. Due to the complex morphology expressed by MRLs such as Kinyarwanda, conventional tokenization algorithms such as byte pair encoding (BPE) are suboptimal at handling MRLs. KinyaBERT leverages a morphological analyzer to extract morphemes and incorporates them in a two-tier transformer encoder architecture to explicitly express morphological compositionality. Empirical experiments indicate that KinyaBERT outperforms baseline BERT models on natural language inference (NLI) and named entity recognition (NER) tasks.

Repository guide:

  • code: main python codebase
  • conf: vocabulary files for KinyaBERT
  • datasets: evaluation datasets for Translated GLUE benchmark, Named Entity Recognition (NER) and NEWS categorization tasks.
  • fairseq-tupe-tpu-pytorch-v1.9: TPU-optimized fairseq code for baseline models. The package has been customized to use TUPE-R positional encoding
  • lib: shared library for Kinyarwanda morphological analysis and part-of-speech tagging
  • results: Fine-tuning results in raw format
  • scripts: data pre-processing scripts

Important files:

  1. code/morpho_model.py : KinyaBERT model implementation in PyTorch
  2. code/kinlpmorpho.py : CFFI interface to the morphological analyzer
  3. code/morpho_data_loaders.py : Data loading utilities
  4. code/train_exploratory_distributed_model.py : KinyaBERT pre-training process
  5. code/pretrained_kinyabert_model_fine_tune_eval.py : KinyaBERT fine-tuning process
  6. code/pretrained_roberta_model_fine_tune_eval.py : Baseline models fine-tuning process
  7. lib/libkinlp.so : Morphological analyzer/POS Tagger shared library
  8. results/FINAL_AVERAGED_RESULTS.xlsx : All experimental results aggregated in a spreadsheet

Dependencies

  • PyTorch version >= 1.8.0
  • Python version >= 3.6
  • NVIDIA apex for faster GPU training
  • Progressbar2: pip install progressbar2
  • CFFI: pip install cffi
  • YouTokenMe: pip install youtokentome

How to use the code

The code in this repository is meant to be used for adapting KinyaBERT architecture to other languages and modeling scenarios. This experimental code is not intended to be used straight out of the repository, but to provide a guidance to custom implementation.

The morphological analyzer

The code in this repository requires having access to a morphological analyzer and the code itself cannot work without an adaptation to the morphological analyzer. The adaptation can me made following the CFFI interface in code/kinlpmorpho.py and making other necessary adjustments related to vocabularies. The morphological analyzer for Kinyarwanda which is used in this work is a closed-source proprietary software. The current plan is to make it available to researchers in a software-as-a-service model. Currently, it can be provided by contacting the first author by E-mail ([email protected]).

Citation

Please cite as:

@inproceedings{nzeyimana-niyongabo-rubungo-2022-kinyabert,
    title = "{K}inya{BERT}: a Morphology-aware {K}inyarwanda Language Model",
    author = "Nzeyimana, Antoine  and
      Niyongabo Rubungo, Andre",
    booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    month = may,
    year = "2022",
    address = "Dublin, Ireland",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.acl-long.367",
    pages = "5347--5363",
}

kinyabert-acl2022's People

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.