zjunlp/ChineseGuard-3B
27
1---2license: cc-by-nc-4.03language:4- zh5pipeline_tag: text-classification6datasets:7- zjunlp/ChineseHarm-bench8---9## 🚀Installation10 111. Clone the repositories:12 13 ```bash14 git clone https://github.com/zjunlp/ChineseHarm-bench15 cd ChineseHarm-bench16 git clone https://github.com/hiyouga/LLaMA-Factory17 ```18 192. Install dependencies:20 21 ```bash22 cd LLaMA-Factory23 pip install -e ".[torch,metrics]" 24 ```25 26## 📚Inference27 28We release the following variants of our harmful content detection model:29 30🔹 Single Inference (Example)31 32Run single-input inference using the ChineseGuard-3B model:33 34```35SCRIPT_PATH="../infer/single_infer.py"36model_name="zjunlp/ChineseGuard-3B"37text="代发短信,有想做的联系我,无押金"38 39python $SCRIPT_PATH \40 --model_name $model_name \41 --text $text42```43 44🔸 Batch Inference (Multi-NPU or Multi-GPU)45 46To run inference on the entire ChineseHarm-Bench using ChineseGuard-3B and 8 NPUs:47 48```49SCRIPT_PATH="../infer/batch_infer.py"50model_name="zjunlp/ChineseHarm-3B"51file_name="../benchmark/bench.json"52output_file="../benchmark/bench_ChineseHarm-3B.json"53 54python $SCRIPT_PATH \55 --model_name $model_name \56 --file_name $file_name \57 --output_file $output_file \58 --num_npus 859 60```61 62> For more configuration options (e.g., batch size, device selection, custom prompt templates), please refer to `single_infer.py` and `batch_infer.py`.63>64> **Note:** The inference scripts support both NPU and GPU devices.65 66## 🚩Citation67 68Please cite our repository if you use ChineseGuard in your work. Thanks!69 70```bibtex71@misc{liu2025chineseharmbenchchineseharmfulcontent,72 title={ChineseHarm-Bench: A Chinese Harmful Content Detection Benchmark}, 73 author={Kangwei Liu and Siyuan Cheng and Bozhong Tian and Xiaozhuan Liang and Yuyang Yin and Meng Han and Ningyu Zhang and Bryan Hooi and Xi Chen and Shumin Deng},74 year={2025},75 eprint={2506.10960},76 archivePrefix={arXiv},77 primaryClass={cs.CL},78 url={https://arxiv.org/abs/2506.10960}, 79}80```