How to use from the
Use from the
Transformers library
# 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")
Quick Links

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])
Downloads last month
5
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support