Downloads · 30 days
10
15% of all-time downloads
zyhForHugging/qwen2.5-1.5b-chinese-news-classifier
qwen2.5-1.5b-chinese-news-classifier is a text classification model from zyhForHugging. 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.
本模型基于 Qwen/Qwen2.5-1.5B-Instruct,针对 10 类中文新闻分类任务完成全参数微调。训练使用 Qwen Chat Template 整理输入,并通过序列分类头输出类别。
Downloads · 30 days
10
15% of all-time downloads
All-time downloads
68
Public
Parameters
1.5B
3.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors3.1 GB · 100%
From the Hugging Face model README
本模型基于 Qwen/Qwen2.5-1.5B-Instruct,针对 10 类中文新闻分类任务完成全参数微调。训练使用 Qwen Chat Template 整理输入,并通过序列分类头输出类别。
| ID | 类别 |
|---|---|
| 0 | finance |
| 1 | realty |
| 2 | stocks |
| 3 | education |
| 4 | science |
| 5 | society |
| 6 | politics |
| 7 | sports |
| 8 | game |
| 9 | entertainment |
Qwen2ForSequenceClassificationimport torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
repo_id = "zyhForHugging/qwen2.5-1.5b-chinese-news-classifier"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
messages = [{"role": "user", "content": "中国队在本届比赛中取得胜利"}]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=False,
return_dict=True,
return_tensors="pt",
)
with torch.no_grad():
logits = model(**inputs).logits
label = model.config.id2label[int(logits.argmax(dim=-1).item())]
print(label)
训练代码、数据集、BERT 微调、INT8 量化及 TextCNN 蒸馏模型见 GitHub 项目。
本模型继承基础模型的 Apache-2.0 许可。模型仅用于学习、研究与项目展示,实际应用前应在目标数据分布上重新验证。