Instructions to use huiqian/tiny-sentiment-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use huiqian/tiny-sentiment-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="huiqian/tiny-sentiment-classifier")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("huiqian/tiny-sentiment-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("huiqian/tiny-sentiment-classifier", device_map="auto")Quick Links
Tiny Sentiment Classifier
这是一个非常小的自定义 Transformer 模型,用于中文情感二分类(正面/负面)。
模型简介
- 架构:小型 Transformer Encoder + 线性分类头
- 隐藏维度:128
- 层数:2
- 词汇表:字符级(支持中文汉字 + ASCII)
- 训练数据:极简玩具数据集(仅用于演示 HF 适配流程)
使用方式
from transformers import pipeline
# 加载模型
classifier = pipeline(
"text-classification",
model="huiqian/tiny-sentiment-classifier"
)
# 预测
text = "这家店的服务超级好,强烈推荐!"
result = classifier(text)
print(result)
# 示例输出: [{'label': '正面', 'score': 0.98}]
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="huiqian/tiny-sentiment-classifier")