ONNX Model Zoo

dnouv/xlm-roberta-base-language-detection-tfjs

By dnouv · ↓ 2 · ♥ 1 · Updated 2025-04-07

What's in this repo

This page lists the files in dnouv/xlm-roberta-base-language-detection-tfjs, including model.onnx, model_optimized.onnx, model_quantized.onnx.

  • 3 ONNX models (.onnx files)
  • 10 files, including 4 .json, 3 .onnx, 1 .md, 1 .model
  • Last updated 2025-04-07

ONNX files

File Size Download
onnx/model.onnx — Download
onnx/model_optimized.onnx — Download
onnx/model_quantized.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

ONNX version of papluca/xlm-roberta-base-language-detection

This model is a conversion of papluca/xlm-roberta-base-language-detection to ONNX format using the 🤗 Optimum library.

Model description

This model is a fine-tuned version of xlm-roberta-base on the Language Identification dataset.

This model is an XLM-RoBERTa transformer model with a classification head on top (i.e. a linear layer on top of the pooled output). For additional information please refer to the xlm-roberta-base model card or to the paper Unsupervised Cross-lingual Representation Learning at Scale by Conneau et al.

Intended uses & limitations

You can directly use this model as a language detector, i.e. for sequence classification tasks. Currently, it supports the following 20 languages:

arabic (ar), bulgarian (bg), german (de), modern greek (el), english (en), spanish (es), french (fr), hindi (hi), italian (it), japanese (ja), dutch (nl), polish (pl), portuguese (pt), russian (ru), swahili (sw), thai (th), turkish (tr), urdu (ur), vietnamese (vi), and chinese (zh)

Usage

Optimum

Loading the model requires the 🤗 Optimum library installed.

from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline

tokenizer = AutoTokenizer.from_pretrained("laiyer/xlm-roberta-base-language-detection-onnx")
model = ORTModelForSequenceClassification.from_pretrained("laiyer/xlm-roberta-base-language-detection-onnx")
classifier = pipeline(
    task="text-classification",
    model=model,
    tokenizer=tokenizer,
    top_k=None,
)

classifier_output = ner("It's not toxic comment")
print(classifier_output)

LLM Guard

Language scanner

Community

Join our Slack to give us feedback, connect with the maintainers and fellow users, ask questions, or engage in discussions about LLM security!

Model info

onnx xlm-roberta language language-detection text-classification multilingual ar bg de el en es
↓ 2 ♥ 1

Created: 2025-04-07

Updated: 2025-04-07

View on Hugging Face

Files (10)

.gitattributes
README.md
config.json
onnx/model.onnx ONNX
onnx/model_optimized.onnx ONNX
onnx/model_quantized.onnx ONNX
sentencepiece.bpe.model
special_tokens_map.json
tokenizer.json
tokenizer_config.json

Related models