chywang's picture
Update README.md
0a61c79
|
raw
history blame
731 Bytes
metadata
license: apache-2.0
language: zh

Alibaba PAI BERT Base Chinese for LLM Risk Detection

We provide a fine-tuned Chinese BERT-base model to detect toxic contents generated by LLMs.

Usage:


from transformers import pipeline

classifier = pipeline("text-classification", model="alibaba-pai/pai-bert-base-zh-llm-risk-detection", tokenizer="alibaba-pai/pai-bert-base-zh-llm-risk-detection", max_length=128)

text = "我的月季嫩嫩的就卷了,也看不到虫子,然后就干了,这是什么毛病呢?"

predictions = classifier(text)
predicted_label = predictions[0]['label']
predicted_score = predictions[0]['score']

print(f"预测标签: {predicted_label}")
print(f"预测分数: {predicted_score}")