Edit model card

Multilingual_Language_Detection

This model is a fine-tuned version of BERT-multilingual-base-(cased) on the multilingual dataset.

It achieves the following results on the evaluation set:

  • Training Loss : 0.018700
  • Validation Loss : 0.054768
  • Accuracy : 0.988864
  • F1 : 0.988909

Languages

It's trained in more than 22 different languages, they are listed below.

Arabic, Urdu, Tamil, Hindi, English, French, Spanish, Japanese, Chinese, Thai, Indonesian, Dutch, Korean, Latin, Persian, Portugese, Pushto, Romanian, Russian, Swedish, Turkish, Estonian

Model Description

The BERT model was pretrained on the 104 languages with the largest Wikipedias using a masked language modeling (MLM) objective. This model is case sensitive: it makes a difference between english and English.

BERT is a transformers model pretrained on a large corpus of multilingual data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was pretrained with two objectives:

  • Masked language modeling (MLM): taking a sentence, the model randomly masks 15% of the words in the input then run the entire masked sentence through the model and has to predict the masked words. This is different from traditional recurrent neural networks (RNNs) that usually see the words one after the other, or from autoregressive models like GPT which internally mask the future tokens. It allows the model to learn a bidirectional representation of the sentence.

  • Next sentence prediction (NSP): the models concatenates two masked sentences as inputs during pretraining. Sometimes they correspond to sentences that were next to each other in the original text, sometimes not. The model then has to predict if the two sentences were following each other or not.

This way, the model learns an inner representation of the languages in the training set that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled sentences for instance, you can train a standard classifier using the features produced by the BERT model as inputs.

Training procedure

Fine-tuning was done via the Trainer API. Here is the Colab notebook with the training code.

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 2e-5
  • train_batch_size: 8
  • eval_batch_size: 16
  • optimizer: Adam
  • evaluation strategy: epoch
  • num_epochs: 3
  • warmup_steps: 100

Training result

Training Loss Epoch Validation Loss Accuracy F1
0.002800 1 0.081287 0.9888 0.9890
0.001100 2 0.064479 0.9897 0.9898
0.018700 3 0.054768 0.9888 0.9889
Downloads last month
24
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.