Downloads · 30 days
0
huevan/distilbert-base-uncased-rx
distilbert-base-uncased-rx is a text classification model from huevan. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
This model is a fine-tuned version of distilbert-base-uncased on the amazonpolarity dataset. It is designed for binary sentiment classification, predicting whether a given text expresses a positive (1) or negative (0)…
Downloads · 30 days
0
Access
Public
Updated Feb 22, 2025
Repo size
3.3 MB
Likes
1
Public
Click a slice to open those files.
.safetensors3.3 MB · 77%
From the Hugging Face model README
This model is a fine-tuned version of distilbert-base-uncased on the amazon_polarity dataset. It is designed for binary sentiment classification, predicting whether a given text expresses a positive (1) or negative (0) sentiment. The model leverages the lightweight architecture of DistilBERT, making it efficient for deployment while maintaining strong performance.
distilbert-base-uncasedThis model is intended for sentiment analysis tasks, particularly in analyzing product reviews or user feedback. It can be used in:
The model can classify text directly without additional fine-tuning for similar binary sentiment tasks.
It can be further fine-tuned for domain-specific sentiment analysis (e.g., medical reviews, movie critiques).
Below is an example of how to load and use the model with the transformers library:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
# 加载模型和tokenizer
model_name = "huevan/distilbert-base-uncased-rx" # 替换为你的仓库名
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# 输入文本
text = "I love this product, it's amazing!"
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
# 预测
model.eval()
with torch.no_grad():
outputs = model(**inputs)
prediction = outputs.logits.argmax(-1).item()
sentiment = "positive" if prediction == 1 else "negative"
print(f"Sentiment: {sentiment}") # 输出: positive