Downloads · 30 days
10
16% of all-time downloads
twmdatagame2025/ckipbert-chinese-sms-name-classifierv2
ckipbert-chinese-sms-name-classifierv2 is a text classification model from twmdatagame2025. Use it when you need a label for a piece of text. The card lists the license as mit.
這是一個基於 ckiplab/bert-base-chinese 微調的中文 BERT 模型,專門用於識別 SMS 簡訊中是否包含人名的二元分類任務。
Downloads · 30 days
10
16% of all-time downloads
All-time downloads
63
Public
Parameters
102M
409 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors409 MB · 100%
From the Hugging Face model README
這是一個基於 ckiplab/bert-base-chinese 微調的中文 BERT 模型,專門用於識別 SMS 簡訊中是否包含人名的二元分類任務。
| 指標 | 數值 |
|---|---|
| 驗證準確率 | 0.9965 |
| 最佳準確率 | 0.9965 |
from transformers import BertTokenizer, BertForSequenceClassification
import torch
# 載入模型和分詞器
model_name = "renhehuang/bert-chinese-sms-name-classifierv2"
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertForSequenceClassification.from_pretrained(model_name)
# 預測函數
def predict_name_in_sms(text, max_length=256):
model.eval()
encoding = tokenizer.encode_plus(
text,
add_special_tokens=True,
max_length=max_length,
return_token_type_ids=False,
padding='max_length',
truncation=True,
return_attention_mask=True,
return_tensors='pt'
)
with torch.no_grad():
outputs = model(
input_ids=encoding['input_ids'],
attention_mask=encoding['attention_mask']
)
logits = outputs.logits
probabilities = torch.softmax(logits, dim=-1)
predicted_class = torch.argmax(logits, dim=-1).item()
confidence = probabilities[0][predicted_class].item()
return predicted_class, confidence
# 使用範例
text = "王先生您好,您的訂單已確認"
predicted_class, confidence = predict_name_in_sms(text)
print(f"預測類別: {predicted_class} (信心度: {confidence:.4f})")
✅ Apple Silicon 優化: 此模型針對 Apple Silicon (M1/M2/M3) 晶片進行了特別優化,包括 MPS GPU 加速和記憶體優化。
0: 不包含姓名1: 包含姓名如果您使用了此模型,請引用:
@misc{bert-chinese-sms-name-classifier,
title={BERT Chinese SMS Name Classifier},
author={renhehuang},
year={2025},
publisher={Hugging Face},
journal={Hugging Face Model Hub},
}
如有問題或建議,請通過 Hugging Face 或 GitHub 聯絡作者。