Run this model with HF Jobs
Run opensource/extract_names on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/opensource/extract_names. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/opensource/extract_names on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use opensource/extract_names with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use opensource/extract_names with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="opensource/extract_names")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("opensource/extract_names") model = AutoModelForTokenClassification.from_pretrained("opensource/extract_names", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
63d283f
1
Parent(s): 8e67e07
Update README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602---language: multilingual---# XLM-R + NERThis model is a fine-tuned [XLM-Roberta-base](https://arxiv.org/abs/1911.02116) over the 40 languages proposed in [XTREME](https://github.com/google-research/xtreme) from [Wikiann](https://aclweb.org/anthology/P17-1178). This is still an on-going work and the results will be updated everytime an improvement is reached.The covered labels are:```LOCORGPERO```## Metrics on evaluation set:### Average over the 40 languagesNumber of documents: 262300```precision recall f1-score supportORG 0.81 0.81 0.81 102452PER 0.90 0.91 0.91 108978LOC 0.86 0.89 0.87 121868micro avg 0.86 0.87 0.87 333298macro avg 0.86 0.87 0.87 333298```### AfrikaansNumber of documents: 1000```precision recall f1-score supportORG 0.89 0.88 0.88 582PER 0.89 0.97 0.93 369LOC 0.84 0.90 0.86 518micro avg 0.87 0.91 0.89 1469macro avg 0.87 0.91 0.89 1469```### ArabicNumber of documents: 10000```precision recall f1-score supportORG 0.83 0.84 0.84 3507PER 0.90 0.91 0.91 3643LOC 0.88 0.89 0.88 3604micro avg 0.87 0.88 0.88 10754macro avg 0.87 0.88 0.88 10754```### BasqueNumber of documents: 10000```precision recall f1-score supportLOC 0.88 0.93 0.91 5228ORG 0.86 0.81 0.83 3654PER 0.91 0.91 0.91 4072micro avg 0.89 0.89 0.89 12954macro avg 0.89 0.89 0.89 12954```### BengaliNumber of documents: 1000```precision recall f1-score supportORG 0.86 0.89 0.87 325LOC 0.91 0.91 0.91 406PER 0.96 0.95 0.95 364micro avg 0.91 0.92 0.91 1095macro avg 0.91 0.92 0.91 1095```### BulgarianNumber of documents: 1000```precision recall f1-score supportORG 0.86 0.83 0.84 3661PER 0.92 0.95 0.94 4006LOC 0.92 0.95 0.94 6449micro avg 0.91 0.92 0.91 14116macro avg 0.91 0.92 0.91 14116```### BurmeseNumber of documents: 100```precision recall f1-score supportLOC 0.60 0.86 0.71 37ORG 0.68 0.63 0.66 30PER 0.44 0.44 0.44 36micro avg 0.57 0.65 0.61 103macro avg 0.57 0.65 0.60 103```### ChineseNumber of documents: 10000```precision recall f1-score supportORG 0.70 0.69 0.70 4022LOC 0.76 0.81 0.78 3830PER 0.84 0.84 0.84 3706micro avg 0.76 0.78 0.77 11558macro avg 0.76 0.78 0.77 11558```### DutchNumber of documents: 10000```precision recall f1-score supportORG 0.87 0.87 0.87 3930PER 0.95 0.95 0.95 4377LOC 0.91 0.92 0.91 4813micro avg 0.91 0.92 0.91 13120macro avg 0.91 0.92 0.91 13120```### EnglishNumber of documents: 10000```precision recall f1-score supportLOC 0.83 0.84 0.84 4781PER 0.89 0.90 0.89 4559ORG 0.75 0.75 0.75 4633micro avg 0.82 0.83 0.83 13973macro avg 0.82 0.83 0.83 13973```### EstonianNumber of documents: 10000```precision recall f1-score supportLOC 0.89 0.92 0.91 5654ORG 0.85 0.85 0.85 3878PER 0.94 0.94 0.94 4026micro avg 0.90 0.91 0.90 13558macro avg 0.90 0.91 0.90 13558```### FinnishNumber of documents: 10000```precision recall f1-score supportORG 0.84 0.83 0.84 4104LOC 0.88 0.90 0.89 5307PER 0.95 0.94 0.94 4519micro avg 0.89 0.89 0.89 13930macro avg 0.89 0.89 0.89 13930```### FrenchNumber of documents: 10000```precision recall f1-score supportLOC 0.90 0.89 0.89 4808ORG 0.84 0.87 0.85 3876PER 0.94 0.93 0.94 4249micro avg 0.89 0.90 0.90 12933macro avg 0.89 0.90 0.90 12933```### GeorgianNumber of documents: 10000```precision recall f1-score supportPER 0.90 0.91 0.90 3964ORG 0.83 0.77 0.80 3757LOC 0.82 0.88 0.85 4894micro avg 0.84 0.86 0.85 12615macro avg 0.84 0.86 0.85 12615```### GermanNumber of documents: 10000```precision recall f1-score supportLOC 0.85 0.90 0.87 4939PER 0.94 0.91 0.92 4452ORG 0.79 0.78 0.79 4247micro avg 0.86 0.86 0.86 13638macro avg 0.86 0.86 0.86 13638```### GreekNumber of documents: 10000```precision recall f1-score supportORG 0.86 0.85 0.85 3771LOC 0.88 0.91 0.90 4436PER 0.91 0.93 0.92 3894micro avg 0.88 0.90 0.89 12101macro avg 0.88 0.90 0.89 12101```### HebrewNumber of documents: 10000```precision recall f1-score supportPER 0.87 0.88 0.87 4206ORG 0.76 0.75 0.76 4190LOC 0.85 0.85 0.85 4538micro avg 0.83 0.83 0.83 12934macro avg 0.82 0.83 0.83 12934```### HindiNumber of documents: 1000```precision recall f1-score supportORG 0.78 0.81 0.79 362LOC 0.83 0.85 0.84 422PER 0.90 0.95 0.92 427micro avg 0.84 0.87 0.85 1211macro avg 0.84 0.87 0.85 1211```### HungarianNumber of documents: 10000```precision recall f1-score supportPER 0.95 0.95 0.95 4347ORG 0.87 0.88 0.87 3988LOC 0.90 0.92 0.91 5544micro avg 0.91 0.92 0.91 13879macro avg 0.91 0.92 0.91 13879```### IndonesianNumber of documents: 10000```precision recall f1-score supportORG 0.88 0.89 0.88 3735LOC 0.93 0.95 0.94 3694PER 0.93 0.93 0.93 3947micro avg 0.91 0.92 0.92 11376macro avg 0.91 0.92 0.92 11376```### ItalianNumber of documents: 10000```precision recall f1-score supportLOC 0.88 0.88 0.88 4592ORG 0.86 0.86 0.86 4088PER 0.96 0.96 0.96 4732micro avg 0.90 0.90 0.90 13412macro avg 0.90 0.90 0.90 13412```### JapaneseNumber of documents: 10000```precision recall f1-score supportORG 0.62 0.61 0.62 4184PER 0.76 0.81 0.78 3812LOC 0.68 0.74 0.71 4281micro avg 0.69 0.72 0.70 12277macro avg 0.69 0.72 0.70 12277```### JavaneseNumber of documents: 100```precision recall f1-score supportORG 0.79 0.80 0.80 46PER 0.81 0.96 0.88 26LOC 0.75 0.75 0.75 40micro avg 0.78 0.82 0.80 112macro avg 0.78 0.82 0.80 112```### KazakhNumber of documents: 1000```precision recall f1-score supportORG 0.76 0.61 0.68 307LOC 0.78 0.90 0.84 461PER 0.87 0.91 0.89 367micro avg 0.81 0.83 0.82 1135macro avg 0.81 0.83 0.81 1135```### KoreanNumber of documents: 10000```precision recall f1-score supportLOC 0.86 0.89 0.88 5097ORG 0.79 0.74 0.77 4218PER 0.83 0.86 0.84 4014micro avg 0.83 0.83 0.83 13329macro avg 0.83 0.83 0.83 13329```### MalayNumber of documents: 1000```precision recall f1-score supportORG 0.87 0.89 0.88 368PER 0.92 0.91 0.91 366LOC 0.94 0.95 0.95 354micro avg 0.91 0.92 0.91 1088macro avg 0.91 0.92 0.91 1088```### MalayalamNumber of documents: 1000```precision recall f1-score supportORG 0.75 0.74 0.75 347PER 0.84 0.89 0.86 417LOC 0.74 0.75 0.75 391micro avg 0.78 0.80 0.79 1155macro avg 0.78 0.80 0.79 1155```### MarathiNumber of documents: 1000```precision recall f1-score supportPER 0.89 0.94 0.92 394LOC 0.82 0.84 0.83 457ORG 0.84 0.78 0.81 339micro avg 0.85 0.86 0.85 1190macro avg 0.85 0.86 0.85 1190```### PersianNumber of documents: 10000```precision recall f1-score supportPER 0.93 0.92 0.93 3540LOC 0.93 0.93 0.93 3584ORG 0.89 0.92 0.90 3370micro avg 0.92 0.92 0.92 10494macro avg 0.92 0.92 0.92 10494```### PortugueseNumber of documents: 10000```precision recall f1-score supportLOC 0.90 0.91 0.91 4819PER 0.94 0.92 0.93 4184ORG 0.84 0.88 0.86 3670micro avg 0.89 0.91 0.90 12673macro avg 0.90 0.91 0.90 12673```### RussianNumber of documents: 10000```precision recall f1-score supportPER 0.93 0.96 0.95 3574LOC 0.87 0.89 0.88 4619ORG 0.82 0.80 0.81 3858micro avg 0.87 0.88 0.88 12051macro avg 0.87 0.88 0.88 12051```### SpanishNumber of documents: 10000```precision recall f1-score supportPER 0.95 0.93 0.94 3891ORG 0.86 0.88 0.87 3709LOC 0.89 0.91 0.90 4553micro avg 0.90 0.91 0.90 12153macro avg 0.90 0.91 0.90 12153```### SwahiliNumber of documents: 1000```precision recall f1-score supportORG 0.82 0.85 0.83 349PER 0.95 0.92 0.94 403LOC 0.86 0.89 0.88 450micro avg 0.88 0.89 0.88 1202macro avg 0.88 0.89 0.88 1202```### TagalogNumber of documents: 1000```precision recall f1-score supportLOC 0.90 0.91 0.90 338ORG 0.83 0.91 0.87 339PER 0.96 0.93 0.95 350micro avg 0.90 0.92 0.91 1027macro avg 0.90 0.92 0.91 1027```### TamilNumber of documents: 1000```precision recall f1-score supportPER 0.90 0.92 0.91 392ORG 0.77 0.76 0.76 370LOC 0.78 0.81 0.79 421micro avg 0.82 0.83 0.82 1183macro avg 0.82 0.83 0.82 1183```### TeluguNumber of documents: 1000```precision recall f1-score supportORG 0.67 0.55 0.61 347LOC 0.78 0.87 0.82 453PER 0.73 0.86 0.79 393micro avg 0.74 0.77 0.76 1193macro avg 0.73 0.77 0.75 1193```### ThaiNumber of documents: 10000```precision recall f1-score supportLOC 0.63 0.76 0.69 3928PER 0.78 0.83 0.80 6537ORG 0.59 0.59 0.59 4257micro avg 0.68 0.74 0.71 14722macro avg 0.68 0.74 0.71 14722```### TurkishNumber of documents: 10000```precision recall f1-score supportPER 0.94 0.94 0.94 4337ORG 0.88 0.89 0.88 4094LOC 0.90 0.92 0.91 4929micro avg 0.90 0.92 0.91 13360macro avg 0.91 0.92 0.91 13360```### UrduNumber of documents: 1000```precision recall f1-score supportLOC 0.90 0.95 0.93 352PER 0.96 0.96 0.96 333ORG 0.91 0.90 0.90 326micro avg 0.92 0.94 0.93 1011macro avg 0.92 0.94 0.93 1011```### VietnameseNumber of documents: 10000```precision recall f1-score supportORG 0.86 0.87 0.86 3579LOC 0.88 0.91 0.90 3811PER 0.92 0.93 0.93 3717micro avg 0.89 0.90 0.90 11107macro avg 0.89 0.90 0.90 11107```### YorubaNumber of documents: 100```precision recall f1-score supportLOC 0.54 0.72 0.62 36ORG 0.58 0.31 0.41 35PER 0.77 1.00 0.87 36micro avg 0.64 0.68 0.66 107macro avg 0.63 0.68 0.63 107```## Reproduce the resultsDownload and prepare the dataset from the [XTREME repo](https://github.com/google-research/xtreme#download-the-data). Next, from the root of the transformers repo run:```cd examples/nerpython run_tf_ner.py \--data_dir . \--labels ./labels.txt \--model_name_or_path jplu/tf-xlm-roberta-base \--output_dir model \--max-seq-length 128 \--num_train_epochs 2 \--per_gpu_train_batch_size 16 \--per_gpu_eval_batch_size 32 \--do_train \--do_eval \--logging_dir logs \--mode token-classification \--evaluate_during_training \--optimizer_name adamw```## Usage with pipelines```pythonfrom transformers import pipelinenlp_ner = pipeline("ner",model="jplu/tf-xlm-r-ner-40-lang",tokenizer=('jplu/tf-xlm-r-ner-40-lang',{"use_fast": True}),framework="tf")text_fr = "Barack Obama est né à Hawaï."text_en = "Barack Obama was born in Hawaii."text_es = "Barack Obama nació en Hawai."text_zh = "巴拉克·奧巴馬(Barack Obama)出生於夏威夷。"text_ar = "ولد باراك أوباما في هاواي."nlp_ner(text_fr)#Output: [{'word': '▁Barack', 'score': 0.9894659519195557, 'entity': 'PER'}, {'word': '▁Obama', 'score': 0.9888848662376404, 'entity': 'PER'}, {'word': '▁Hawa', 'score': 0.998701810836792, 'entity': 'LOC'}, {'word': 'ï', 'score': 0.9987035989761353, 'entity': 'LOC'}]nlp_ner(text_en)#Output: [{'word': '▁Barack', 'score': 0.9929141998291016, 'entity': 'PER'}, {'word': '▁Obama', 'score': 0.9930834174156189, 'entity': 'PER'}, {'word': '▁Hawaii', 'score': 0.9986202120780945, 'entity': 'LOC'}]nlp_ner(test_es)#Output: [{'word': '▁Barack', 'score': 0.9944776296615601, 'entity': 'PER'}, {'word': '▁Obama', 'score': 0.9949177503585815, 'entity': 'PER'}, {'word': '▁Hawa', 'score': 0.9987911581993103, 'entity': 'LOC'}, {'word': 'i', 'score': 0.9984861612319946, 'entity': 'LOC'}]nlp_ner(test_zh)#Output: [{'word': '夏威夷', 'score': 0.9988449215888977, 'entity': 'LOC'}]nlp_ner(test_ar)#Output: [{'word': '▁با', 'score': 0.9903655648231506, 'entity': 'PER'}, {'word': 'راك', 'score': 0.9850614666938782, 'entity': 'PER'}, {'word': '▁أوباما', 'score': 0.9850308299064636, 'entity': 'PER'}, {'word': '▁ها', 'score': 0.9477543234825134, 'entity': 'LOC'}, {'word': 'وا', 'score': 0.9428229928016663, 'entity': 'LOC'}, {'word': 'ي', 'score': 0.9319471716880798, 'entity': 'LOC'}]```123456789---language: multilingual------license: MIT---## Extract names in any language.
README.md+4-597