Downloads · 30 days
25
2% of all-time downloads
huolongguo10/check_sec
check_sec is a text classification model from huolongguo10. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as openrail.
检查web参数安全性,支持多种payload(v0.1.2) 注意:该版本不再维护,请使用tiny版。
Downloads · 30 days
25
2% of all-time downloads
All-time downloads
1.2K
Public
Parameters
109M
4.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin438 MB · 50%
How the weights are stored.
F32109M · 100%
From the Hugging Face model README
检查web参数安全性,支持多种payload(v0.1.2) 注意:该版本不再维护,请使用tiny版。
LABEL_0: secure
LABEL_1: insecure(可能包含payload)
import transformers
from transformers import BertTokenizer, DataCollatorWithPadding
from transformers import AutoModelForSequenceClassification
tokenizer = BertTokenizer.from_pretrained('huolongguo10/check_sec_tiny')
model = AutoModelForSequenceClassification.from_pretrained('huolongguo10/check_sec_tiny', num_labels=2)
import torch
def check(text):
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_id = logits.argmax().item()
print(f'{logits.argmax().item()}:{text}')
return 'secure' if predicted_class_id==0 else 'insecure'