huiqian's picture
Create README.md
4c19631 verified
metadata
license: mit
library_name: transformers
tags:
  - pytorch
  - text-classification
  - sentiment-analysis
  - chinese
pipeline_tag: text-classification
language: zh

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}]