Run this model with HF Jobs
Run marquesafonso/bertimbau-large-ner-selective 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/marquesafonso/bertimbau-large-ner-selective. 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/marquesafonso/bertimbau-large-ner-selective 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 marquesafonso/bertimbau-large-ner-selective with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use marquesafonso/bertimbau-large-ner-selective with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="marquesafonso/bertimbau-large-ner-selective")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("marquesafonso/bertimbau-large-ner-selective") model = AutoModelForTokenClassification.from_pretrained("marquesafonso/bertimbau-large-ner-selective", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
bertimbau-large-ner-selective
This model card aims to simplify the use of the portuguese Bert, a.k.a, Bertimbau for the Named Entity Recognition task.
For this model card the we used the BERT-CRF (selective scenario, 5 classes) model available in the ner_evaluation folder of the original Bertimbau repo.
Available classes are:
- PESSOA
- ORGANIZACAO
- LOCAL
- TEMPO
- VALOR
Usage
# Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("marquesafonso/bertimbau-large-ner-selective")
model = AutoModelForTokenClassification.from_pretrained("marquesafonso/bertimbau-large-ner-selective")
Example
from transformers import pipeline
pipe = pipeline("ner", model="marquesafonso/bertimbau-large-ner-selective", aggregation_strategy='simple')
sentence = "Acima de Ederson, abaixo de Rúben Dias. É entre os dois jogadores do Manchester City que se vai colocar Gonçalo Ramos no ranking de vendas mais avultadas do Benfica."
result = pipe([sentence])
print(f"{sentence}\n{result}")
# Acima de Ederson, abaixo de Rúben Dias. É entre os dois jogadores do Manchester City que se vai colocar Gonçalo Ramos no ranking de vendas mais avultadas do Benfica.
# [[
# {'entity_group': 'PESSOA', 'score': 0.99694395, 'word': 'Ederson', 'start': 9, 'end': 16},
# {'entity_group': 'PESSOA', 'score': 0.9918462, 'word': 'Rúben Dias', 'start': 28, 'end': 38},
# {'entity_group': 'ORGANIZACAO', 'score': 0.96376556, 'word': 'Manchester City', 'start': 69, 'end': 84},
# {'entity_group': 'PESSOA', 'score': 0.9993823, 'word': 'Gonçalo Ramos', 'start': 104, 'end': 117},
# {'entity_group': 'ORGANIZACAO', 'score': 0.9033079, 'word': 'Benfica', 'start': 157, 'end': 164}
# ]]
Acknowledgements
This work is an adaptation of portuguese Bert, a.k.a, Bertimbau. You may check and/or cite their work:
@article{souza2020bertimbau,
author="Souza, F{\'a}bio and Nogueira, Rodrigo and Lotufo, Roberto",
editor="Cerri, Ricardo and Prati, Ronaldo C.",
title="BERTimbau: Pretrained BERT Models for Brazilian Portuguese",
booktitle="Intelligent Systems",
year="2020",
publisher="Springer International Publishing",
address="Cham",
pages="403--417",
isbn="978-3-030-61377-8"
}
@article{souza2019portuguese,
title={Portuguese Named Entity Recognition using BERT-CRF},
author={Souza, F{\'a}bio and Nogueira, Rodrigo and Lotufo, Roberto},
journal={arXiv preprint arXiv:1909.10649},
url={http://arxiv.org/abs/1909.10649},
year={2019}
}
Note that the authors - Fabio Capuano de Souza, Rodrigo Nogueira, Roberto de Alencar Lotufo - have used an MIT LICENSE for their work.
- Downloads last month
- 12,421