Views
No views yet
bert-base-chinese 微调,用于根据大学生创新创业项目名称或一句话简介预测适合的参赛赛道。| 指标 | 数值 |
|---|---|
| Accuracy | 75.41% |
| Precision Micro | 75.41% |
| Recall Micro | 75.41% |
| F1 Micro | 75.41% |
| Precision Macro | 70.53% |
| Recall Macro | 70.72% |
| F1 Macro | 70.44% |
| 类别 | Precision | Recall | F1 |
|---|---|---|---|
| 产业赛道 | 0.8200 | 0.8146 | 0.8173 |
| 高教主赛道 | 0.8146 | 0.8310 | 0.8227 |
| 青年红色筑梦之旅赛道 | 0.7102 | 0.7976 | 0.7514 |
| 职教赛道 | 0.4764 | 0.3855 | 0.4262 |
1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4model_id = "你的用户名/trackBERT"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForSequenceClassification.from_pretrained(model_id)
8model.eval()
9
10text = "红色文化数字化传播与乡村振兴实践项目"
11inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
12
13with torch.no_grad():
14 logits = model(**inputs).logits
15 pred_id = torch.argmax(logits, dim=-1).item()
16
17print(model.config.id2label[pred_id])