Text Classification
Transformers
ONNX
Safetensors
Chinese
bert
chinese
intent-classification
text-embeddings-inference
Instructions to use pawizard/traffic-classify with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pawizard/traffic-classify with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="pawizard/traffic-classify")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("pawizard/traffic-classify") model = AutoModelForSequenceClassification.from_pretrained("pawizard/traffic-classify", device_map="auto") - Notebooks
- Google Colab
- Kaggle
metadata
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
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])