Downloads · 30 days
5
4% of all-time downloads
shroukAdel/xlm-roberta-base-finetuned-panx-all
xlm-roberta-base-finetuned-panx-all is a token classification model from shroukAdel. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as mit.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
5
4% of all-time downloads
All-time downloads
130
Public
Parameters
277M
1.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.1 GB · 98%
From the Hugging Face model README
This model is a fine-tuned version of xlm-roberta-base on PAN-X dataset for multiple languages (German, French, Italian, and English)
It achieves the following results on the evaluation set:
The easiest way to use this model for inference is with the Hugging Face pipeline API, setting the task to "ner" and using the "simple" aggregation strategy to automatically merge subword tokens back into recognizable entities.
This method simplifies the process and handles token aggregation for you.
from transformers import pipeline
# Replace with your model ID
model_id = "shroukAdel/xlm-roberta-base-finetuned-panx-all"
# Initialize the NER pipeline
# aggregation_strategy="simple" ensures subwords are combined into single entities
ner_pipeline = pipeline(
"ner",
model=model_id,
aggregation_strategy="simple"
)
# Example 1: German
text_de = "Jeff Dean ist ein Informatiker bei Google in Kalifornien"
print(ner_pipeline(text_de))
# Output: [{'entity_group': 'PER', 'score': 0.997, 'word': 'Jeff Dean', ...}, {'entity_group': 'ORG', 'score': 0.996, 'word': 'Google', ...}, {'entity_group': 'LOC', 'score': 0.998, 'word': 'Kalifornien', ...}]
# Example 2: English
text_en = "My name is Sarah and I live in London"
print(ner_pipeline(text_en))
# Output: [{'entity_group': 'PER', 'score': 0.996, 'word': 'Sarah', ...}, {'entity_group': 'LOC', 'score': 0.998, 'word': 'London', ...}]
# Example 3: French
text_fr = "Marie Curie était une physicienne française"
print(ner_pipeline(text_fr))
# Output: [{'entity_group': 'PER', 'score': 0.995, 'word': 'Marie Curie', ...}]
If you need lower-level access to the model or are integrating it into a custom training loop, you can load the model and tokenizer manually.
from transformers import AutoTokenizer, AutoModelForTokenClassification
model_id = "shroukAdel/xlm-roberta-base-finetuned-panx-all"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForTokenClassification.from_pretrained(model_id)
# Now you can use the tokenizer and model for custom inference or further fine-tuning
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | F1 |
|---|---|---|---|---|
| 0.2902 | 1.0 | 835 | 0.1952 | 0.8212 |
| 0.157 | 2.0 | 1670 | 0.1852 | 0.8387 |
| 0.1028 | 3.0 | 2505 | 0.1809 | 0.8529 |