File size: 1,907 Bytes
aa7739c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
language:
- zh
pipeline_tag: text-classification
tags:
- chinese
- text-classification
- onnx
- intent-classification
library_name: transformers
---

# traffic-classify

Chinese text classifier for traffic / intent classification into three labels:

- `0`: 非研发相关
- `1`: 研发相关
- `2`: 中性

## Files

- Root directory: Transformers model, tokenizer, and config.
- `onnx/model_fp32.onnx`: FP32 ONNX export.
- `onnx/model_int8.onnx`: INT8 quantized ONNX model for CPU inference.

## Evaluation
On the held-out evaluation set, the classifier achieves an overall accuracy of
approximately `94%`, with a weighted F1-score of approximately `94%`,
demonstrating strong classification capability across different traffic types.

The per-class F1-scores are:

- 研发相关: `0.96`
- 中性: `0.93`
- 非研发相关: `0.88`

The results indicate that the model performs particularly well in identifying
研发-related traffic, while non-研发 traffic remains relatively more
challenging due to semantic overlap with technical discussions.

## Dataset Policy

The dataset uses a compact three-class policy:

- 研发相关: full software / IT / electronics / communication terminology sources.
- 中性: stopwords only.
- 非研发相关: remaining dictionary categories, compactly sampled.

See the project `DATA_SOURCES.md` for source details.

## Usage

```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch

repo_id = "pawizard/traffic-classify"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)

text = "这个 NullPointerException 报错怎么修复"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)

with torch.no_grad():
    logits = model(**inputs).logits
    pred = int(logits.argmax(dim=-1).item())

print(model.config.id2label[pred])
```