tcepi/mbp_prepared_food_dataset
Viewer • Updated • 4.59k • 72 • 1
How to use tcepi/mbp_prepared_food_model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="tcepi/mbp_prepared_food_model") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("tcepi/mbp_prepared_food_model")
model = AutoModelForSequenceClassification.from_pretrained("tcepi/mbp_prepared_food_model")Este modelo é um fine-tune do ModernBERT-base para classificação binária, treinado no dataset tcepi/mbp_prepared_food_dataset.
| Métrica | Valor |
|---|---|
| Accuracy | 0.9761 |
| F1-Score | 0.9761 |
| Precision | 0.9761 |
| Recall | 0.9761 |
| ROC-AUC | 0.9931 |
| Specificity | 0.9760 |
| Predito Negativo | Predito Positivo | |
|---|---|---|
| Real Negativo | 448 (TN) | 11 (FP) |
| Real Positivo | 11 (FN) | 449 (TP) |
precision recall f1-score support
Negativo 0.9760 0.9760 0.9760 459
Positivo 0.9761 0.9761 0.9761 460
accuracy 0.9761 919
macro avg 0.9761 0.9761 0.9761 919
weighted avg 0.9761 0.9761 0.9761 919
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Carregar modelo e tokenizer
tokenizer = AutoTokenizer.from_pretrained("tcepi/mbp_prepared_food_model")
model = AutoModelForSequenceClassification.from_pretrained("tcepi/mbp_prepared_food_model")
# Classificar texto
text = "Seu texto aqui"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1).item()
print(f"Classe predita: {model.config.id2label[predicted_class]}")
print(f"Probabilidades: {predictions.tolist()}")
O modelo foi treinado usando o dataset tcepi/mbp_prepared_food_dataset.
Base model
answerdotai/ModernBERT-base