Downloads · 30 days
117
0% of all-time downloads
liam168/c2-roberta-base-finetuned-dianping-chinese
c2-roberta-base-finetuned-dianping-chinese is a text classification model from liam168. Use it when you need a label for a piece of text. It is set up for transformers.
Downloads · 30 days
117
0% of all-time downloads
All-time downloads
35.6K
Public
Repo size
818 MB
Likes
24
Public
Click a slice to open those files.
.bin409 MB · 100%
From the Hugging Face model README
用中文对话情绪语料训练的模型,2分类:乐观和悲观。
>>> from transformers import AutoModelForSequenceClassification , AutoTokenizer, pipeline
>>> model_name = "liam168/c2-roberta-base-finetuned-dianping-chinese"
>>> class_num = 2
>>> ts_texts = ["我喜欢下雨。", "我讨厌他."]
>>> model = AutoModelForSequenceClassification.from_pretrained(model_name, num_labels=class_num)
>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
>>> classifier = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
>>> classifier(ts_texts[0])
>>> classifier(ts_texts[1])
[{'label': 'positive', 'score': 0.9973447918891907}]
[{'label': 'negative', 'score': 0.9972558617591858}]