CIRCL/Vulnerability-CNVD
Updated • 74 • 4
How to use CIRCL/vulnerability-severity-classification-chinese-macbert-base with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="CIRCL/vulnerability-severity-classification-chinese-macbert-base") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("CIRCL/vulnerability-severity-classification-chinese-macbert-base")
model = AutoModelForSequenceClassification.from_pretrained("CIRCL/vulnerability-severity-classification-chinese-macbert-base")This model is a fine-tuned version of hfl/chinese-macbert-base on the dataset CIRCL/Vulnerability-CNVD.
For more information, visit the Vulnerability-Lookup project page or the ML-Gateway GitHub repository, which demonstrates its usage in a FastAPI server.
You can use this model directly with the Hugging Face transformers library for text classification:
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="CIRCL/vulnerability-severity-classification-chinese-macbert-base"
)
# Example usage for a Chinese vulnerability description
description_chinese = "TOTOLINK A3600R是中国吉翁电子(TOTOLINK)公司的一款6天线1200M无线路由器。TOTOLINK A3600R存在缓冲区溢出漏洞,该漏洞源于/cgi-bin/cstecgi.cgi文件的UploadCustomModule函数中的File参数未能正确验证输入数据的长度大小,攻击者可利用该漏洞在系统上执行任意代码或者导致拒绝服务。"
result_chinese = classifier(description_chinese)
print(result_chinese)
# Expected output example: [{'label': '高', 'score': 0.9802}]
The following hyperparameters were used during training:
It achieves the following results on the evaluation set:
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 Macro | Low Precision | Low Recall | Low F1 | Medium Precision | Medium Recall | Medium F1 | High Precision | High Recall | High F1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1.2165 | 1.0 | 3221 | 1.2363 | 0.7429 | 0.5960 | 0.6380 | 0.1631 | 0.2598 | 0.7335 | 0.8549 | 0.7895 | 0.7679 | 0.7115 | 0.7386 |
| 1.1430 | 2.0 | 6442 | 1.1676 | 0.7625 | 0.6464 | 0.6316 | 0.2643 | 0.3726 | 0.7548 | 0.8568 | 0.8026 | 0.7909 | 0.7386 | 0.7639 |
| 0.8890 | 3.0 | 9663 | 1.1915 | 0.7631 | 0.6690 | 0.5884 | 0.3470 | 0.4365 | 0.7833 | 0.8091 | 0.7960 | 0.7564 | 0.7933 | 0.7744 |
| 0.8253 | 4.0 | 12884 | 1.2354 | 0.7675 | 0.6796 | 0.5739 | 0.3874 | 0.4626 | 0.7765 | 0.8305 | 0.8026 | 0.7849 | 0.7630 | 0.7738 |
| 0.5851 | 5.0 | 16105 | 1.3186 | 0.7657 | 0.6796 | 0.5544 | 0.3987 | 0.4638 | 0.7805 | 0.8196 | 0.7996 | 0.7787 | 0.7720 | 0.7753 |
Base model
hfl/chinese-macbert-base