XLM-R adapted to isiXhosa using "FOCUS: Effective Embedding Initialization for Monolingual Specialization of Multilingual Models".
1from transformers import AutoTokenizer, AutoModelForMaskedLM
2
3tokenizer = AutoTokenizer.from_pretrained("konstantindobler/xlm-roberta-base-focus-extend-isixhosa")
4model = AutoModelForMaskedLM.from_pretrained("konstantindobler/xlm-roberta-base-focus-extend-isixhosa")
5
6# Use model and tokenizer as usual
The model is based on
xlm-roberta-base and was adapted to isiXhosa.
The original multilingual tokenizer was extended with the top 30k tokens of a language-specific isiXhosa tokenizer. The new embeddings were initialized with FOCUS.
The model was then trained on data from CC100 for 390k optimizer steps. More details and hyperparameters can be found
in the paper.
The web-scale dataset used for pretraining and tokenizer training (CC100) might contain personal and sensitive information.
Such behavior needs to be assessed carefully before any real-world deployment of the models.
1@misc{dobler-demelo-2023-focus,
2 title={FOCUS: Effective Embedding Initialization for Monolingual Specialization of Multilingual Models},
3 author={Konstantin Dobler and Gerard de Melo},
4 year={2023},
5 eprint={2305.14481},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}