Downloads · 30 days
16
0% of all-time downloads
liam168/c4-zh-distilbert-base-uncased
c4-zh-distilbert-base-uncased 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. The card lists the license as apache-2.0.
Downloads · 30 days
16
0% of all-time downloads
All-time downloads
7.6K
Public
Repo size
536 MB
Likes
1
Public
Click a slice to open those files.
.bin268 MB · 100%
From the Hugging Face model README
用 ["女性","体育","文学","校园"]4类数据训练的分类模型。
>>> from transformers import DistilBertForSequenceClassification , AutoTokenizer, pipeline
>>> model_name = "liam168/c4-zh-distilbert-base-uncased"
>>> class_num = 4
>>> ts_texts = ["女人做得越纯粹,皮肤和身材就越好", "我喜欢篮球"]
>>> model = DistilBertForSequenceClassification.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': 'Female', 'score': 0.9137857556343079}]
[{'label': 'Sports', 'score': 0.8206522464752197}]