|
--- |
|
inference: false |
|
language: pt |
|
datasets: |
|
- lener_br |
|
license: mit |
|
--- |
|
|
|
# DeBERTinha XSmall for NER |
|
|
|
|
|
## Full classification example - Work In Progress |
|
|
|
```python |
|
from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig |
|
import torch |
|
|
|
model_name = "sagui-nlp/debertinha-ptbr-xsmall-lenerbr" |
|
model = AutoModelForSequenceClassification.from_pretrained(model_name) |
|
tokenizer = AutoTokenizer.from_pretrained(model_name) |
|
|
|
input_text = "Acrescento que não há de se falar em violação do artigo 114, § 3º, da Constituição Federal, posto que referido dispositivo revela-se impertinente, tratando da possibilidade de ajuizamento de dissídio coletivo pelo Ministério Público do Trabalho nos casos de greve em atividade essencial." |
|
|
|
inputs = tokenizer(input_text, max_length=512, truncation=True, return_tensors="pt") |
|
tokens = inputs.tokens() |
|
|
|
outputs = model(**inputs).logits |
|
predictions = torch.argmax(outputs, dim=2) |
|
|
|
for token, prediction in zip(tokens, predictions[0].numpy()): |
|
print((token, model.config.id2label[prediction])) |
|
``` |
|
|
|
## Citation |
|
|
|
``` |
|
@misc{campiotti2023debertinha, |
|
title={DeBERTinha: A Multistep Approach to Adapt DebertaV3 XSmall for Brazilian Portuguese Natural Language Processing Task}, |
|
author={Israel Campiotti and Matheus Rodrigues and Yuri Albuquerque and Rafael Azevedo and Alyson Andrade}, |
|
year={2023}, |
|
eprint={2309.16844}, |
|
archivePrefix={arXiv}, |
|
primaryClass={cs.CL} |
|
} |
|
``` |