🚀 SYAS1
SYAS1-PTBR 是一個基於 Distilbert 的 Transformer 模型,專注於巴西葡萄牙語的情感分析。該模型除了用於研究外,主要目的是為巴西社區做出貢獻,因為目前針對葡萄牙語的大語言模型(LLMs)非常匱乏。
🚀 快速開始
SYAS1-PTBR 是基於 Distilbert-base 的模型,通過微調使用 Kaggle 上的 “Portuguese Tweets for Sentiment Analysis” 數據集進行訓練。其訓練完全在 Google Colab Pro 上使用 NVIDIA L4 GPU 完成。
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("1Arhat/SYAS1-PTBR")
model = AutoModelForSequenceClassification.from_pretrained("1Arhat/SYAS1-PTBR")
texto = "Esse produto é incrível! Recomendo muito."
inputs = tokenizer(texto, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicao = torch.argmax(logits, dim=1).item()
probs = F.softmax(logits, dim=1)
labels = ["Negativo", "Neutro", "Positivo"]
for idx, label in enumerate(labels):
print(f'{label}: {probs[0][idx]}')
✨ 主要特性
SYAS1 專為葡萄牙語情感分析而創建。由於該模型是基於 DistilBERT 微調訓練的,它也可以處理英語,但強烈建議僅用於葡萄牙語。如果需要對其他語言進行情感分析,建議使用其他可用的模型。
📦 安裝指南
文檔未提及安裝步驟,故跳過此章節。
💻 使用示例
基礎用法
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("1Arhat/SYAS1-PTBR")
model = AutoModelForSequenceClassification.from_pretrained("1Arhat/SYAS1-PTBR")
texto = "Esse produto é incrível! Recomendo muito."
inputs = tokenizer(texto, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicao = torch.argmax(logits, dim=1).item()
高級用法
probs = F.softmax(logits, dim=1)
labels = ["Negativo", "Neutro", "Positivo"]
for idx, label in enumerate(labels):
print(f'{label}: {probs[0][idx]}')
📚 詳細文檔
模型詳情
屬性 |
詳情 |
創建者 |
Arhat |
模型類型 |
文本分類 |
許可證 |
Apache 2.0 |
基礎模型 |
distilbert-base-uncased |
語言 |
巴西葡萄牙語 |
結果
指標 |
值 |
準確率 |
0.7384 |
F1 分數 |
0.74 |
🔧 技術細節
SYAS1-PTBR 是基於 Distilbert-base 的模型,通過微調使用 Kaggle 上的 “Portuguese Tweets for Sentiment Analysis” 數據集進行訓練。其訓練完全在 Google Colab Pro 上使用 NVIDIA L4 GPU 完成。
📄 許可證
該模型使用的許可證為 Apache 2.0。