guoer9/qwen3-8b-news-classifier
04
Qwen3-8B 新闻分类模型
基于 Qwen3-8B 微调的中文新闻分类模型,在 TNEWS 数据集上达到 62.4% 准确率,超越 ERNIE 3.0 Titan (260B) 等 SOTA 模型。
模型效果
🏆 新闻分类 (TNEWS) - 超越SOTA
📊 训练收敛曲线
📝 实体识别 (NER) 副产品
训练配置
硬件环境
- GPU: NVIDIA RTX 5090 (32GB)
- 精度: BF16 + TF32
- 显存占用: ~24GB
模型配置
训练参数
训练框架
- Framework: Transformers + TRL (SFTTrainer)
- PEFT: LoRA
- Attention: SDPA (Scaled Dot-Product Attention)
- Gradient checkpointing: ✅ 启用
使用方法
使用 Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"guoer9/qwen3-8b-news-classifier",
device_map="auto",
torch_dtype="auto"
)
tokenizer = AutoTokenizer.from_pretrained("guoer9/qwen3-8b-news-classifier")
messages = [
{"role": "user", "content": "请对以下新闻进行分类:央行今日宣布降息25个基点,市场反应积极。"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))K8s 部署
本模型已在 Kubernetes 集群上成功部署,支持:
- GPU 资源管理 (NVIDIA Device Plugin)
- Prometheus 监控集成
- 自动扩缩容 (HPA)
总结
结论
- ✅ 微调有效:新闻分类任务上超越 SOTA
- ✅ 格式改善:输出格式规范,适合生产部署
- ⚠️ 任务专一:主要擅长训练过的新闻分类任务
项目地址
- GitHub: https://github.com/guoer9/money-agent/tree/vllm
- Hugging Face: https://huggingface.co/guoer9/qwen3-8b-news-classifier
许可证
Apache 2.0
