File size: 731 Bytes
eadc4d6 28c784d eadc4d6 0a61c79 eadc4d6 a71f059 eadc4d6 |
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 |
---
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:
```python
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}")
``` |