Package: calbert
CalBERT - Code-mixed Apaptive Language representations using BERTThis repository contains the source code
forCalBERT - Code-mixed Apaptive Language representations using BERT,
published at AAAI-MAKE 2022, Stanford University.CalBERT can be used to adapt existing Transformer language representations into another similar language by minimising
the semantic space between equivalent sentences in those languages, thus allowing the Transformer to learn
representations for words across two languages. It relies on a novel pre-training architecture named Siamese Pre-training to learn task-agnostic and language-agnostic
representations. For more information, please refer to the paper.This framework allows you to perform CalBERT's Siamese Pre-training to learn representations for your own data and can be used to obtain dense vector representations for words, sentences or paragraphs. The base models used to
train CalBERT consist of BERT-based Transformer models such as BERT, RoBERTa, XLM, XLNet, DistilBERT, and so on.
CalBERT achieves state-of-the-art results on the SAIL and IIT-P Product Reviews datasets. CalBERT is also one of the
only models able to learn code-mixed language representations without the need for traditional pre-training methods and
is currently one of the few models available for Indian code-mixing such as Hinglish.InstallationWe recommendPython 3.9or higher for CalBERT.Install PyTorchFollowPyTorch - Get Startedfor further details on how to install PyTorch
with or without CUDA.Install CalBERTInstall with pippipinstallcalbertInstall from sourceYou can also clone the current version from therepositoryand then directly
install the package.pipinstall-e.Getting StartedYou can read thedocsto learn more about how to train CalBERT for your own
use case.The following example shows you how to use CalBERT to obtain sentence embeddings.TrainingThis framework allows you to also train your own CalBERT models on your own code-mixed data so you can learn
embeddings for your custom code-mixed languages. There are various options to choose from in order to get the best
embeddings for your language.First, initialise a model with the base TransformerfromcalbertimportCalBERTmodel=CalBERT('bert-base-uncased')Create a CalBERTDataset using your sentencesfromcalbertimportCalBERTDatasetbase_language_sentences=["I am going to Delhi today via flight","This movie is awesome!"]target_language_sentences=["Main aaj flight lekar Delhi ja raha hoon.","Mujhe yeh movie bahut awesome lagi!"]dataset=CalBERTDataset(base_language_sentences,target_language_sentences)Then create a trainer and train the modelfromcalbertimportSiamesePreTrainertrainer=SiamesePreTrainer(model,dataset)trainer.train()PerformanceOur models achieve state-of-the-art results on the SAIL and IIT-P Product Reviews datasets.More information will be added soon.Application and UsesThis framework can be used for:Computing code-mixed as well as plain sentence embeddingsObtaining semantic similarities between any two sentencesOther textual tasks such as clustering, text summarization, semantic search and many more.Citing and AuthorsIf you find this repository useful, please cite our publicationCalBERT - Code-mixed Apaptive Language representations using BERT.@inproceedings{calbert-baral-et-al-2022,author={Aditeya Baral andAronya Baksy andAnsh Sarkar andDeeksha D andAshwini M. Joshi},editor={Andreas Martin andKnut Hinkelmann andHans{-}Georg Fill andAurona Gerber andDoug Lenat andReinhard Stolle andFrank van Harmelen},title={CalBERT - Code-Mixed Adaptive Language Representations Using {BERT}},booktitle={Proceedings of the {AAAI} 2022 Spring Symposium on Machine Learningand Knowledge Engineering for Hybrid Intelligence {(AAAI-MAKE} 2022),Stanford University, Palo Alto, California, USA, March 21-23, 2022},series={{CEUR} Workshop Proceedings},volume={3121},publisher={CEUR-WS.org},year={2022},url={http://ceur-ws.org/Vol-3121/short3.pdf},timestamp={Fri, 22 Apr 2022 14:55:37 +0200}}ContactPlease feel free to contact us by emailing us to report any issues or suggestions, or if you have any further
questions.Contact: -Aditeya Baral,aditeya.baral@gmail.comYou can also contact the other maintainers listed below.Aronya BaksyAnsh SarkarDeeksha D