Downloads · 30 days
4
1% of all-time downloads
ruanchaves/mdeberta-v3-base-porsimplessent
mdeberta-v3-base-porsimplessent is a text classification model from ruanchaves. Use it when you need a label for a piece of text. It is set up for transformers.
This is the microsoft/mdeberta-v3-base model finetuned for Text Simplification with the PorSimplesSent dataset. This model is suitable for Portuguese.
Downloads · 30 days
4
1% of all-time downloads
All-time downloads
519
Public
Repo size
2.3 GB
Likes
0
Public
Click a slice to open those files.
.bin1.1 GB · 98%
From the Hugging Face model README
This is the microsoft/mdeberta-v3-base model finetuned for Text Simplification with the PorSimplesSent dataset. This model is suitable for Portuguese.
from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
import numpy as np
import torch
from scipy.special import softmax
model_name = "ruanchaves/mdeberta-v3-base-porsimplessent"
s1 = "O preço para instalar um DVD player no carro fica entre R$ 2 mil e R$ 5 mil."
s2 = "Instalar um DVD player no carro tem preço médio entre R$ 2 mil e R$ 5 mil."
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
config = AutoConfig.from_pretrained(model_name)
model_input = tokenizer(*([s1], [s2]), padding=True, return_tensors="pt")
with torch.no_grad():
output = model(**model_input)
scores = output[0][0].detach().numpy()
scores = softmax(scores)
ranking = np.argsort(scores)
ranking = ranking[::-1]
for i in range(scores.shape[0]):
l = config.id2label[ranking[i]]
s = scores[ranking[i]]
print(f"{i+1}) Label: {l} Score: {np.round(float(s), 4)}")
Our research is ongoing, and we are currently working on describing our experiments in a paper, which will be published soon. In the meanwhile, if you would like to cite our work or models before the publication of the paper, please cite our GitHub repository:
@software{Chaves_Rodrigues_eplm_2023,
author = {Chaves Rodrigues, Ruan and Tanti, Marc and Agerri, Rodrigo},
doi = {10.5281/zenodo.7781848},
month = {3},
title = {{Evaluation of Portuguese Language Models}},
url = {https://github.com/ruanchaves/eplm},
version = {1.0.0},
year = {2023}
}