Views
No views yet
[!WARNING] THIS PROJECT HAS BEEN ARCHIVED.This project and its associated code on GitHub are no longer under active development or maintained.
0 for normal outputs and 1 for rejection detected.0 for normal output and 1 for rejection detected.distilroberta-base is case-sensitive model.1from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("ProtectAI/distilroberta-base-rejection-v1")
5model = AutoModelForSequenceClassification.from_pretrained("ProtectAI/distilroberta-base-rejection-v1")
6
7classifier = pipeline(
8 "text-classification",
9 model=model,
10 tokenizer=tokenizer,
11 truncation=True,
12 max_length=512,
13 device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
14)
15
16print(classifier("Sorry, but I can't assist with that."))1from optimum.onnxruntime import ORTModelForSequenceClassification
2from transformers import AutoTokenizer, pipeline
3
4tokenizer = AutoTokenizer.from_pretrained("ProtectAI/distilroberta-base-rejection-v1", subfolder="onnx")
5model = ORTModelForSequenceClassification.from_pretrained("ProtectAI/distilroberta-base-rejection-v1", export=False, subfolder="onnx")
6
7classifier = pipeline(
8 task="text-classification",
9 model=model,
10 tokenizer=tokenizer,
11 truncation=True,
12 max_length=512,
13)
14
15print(classifier("Sorry, but I can't assist with that."))| Training Loss | Epoch | Step | Validation Loss | Accuracy | Recall | Precision | F1 |
|---|---|---|---|---|---|---|---|
| 0.0525 | 1.0 | 3536 | 0.0355 | 0.9912 | 0.9583 | 0.9675 | 0.9629 |
| 0.0219 | 2.0 | 7072 | 0.0312 | 0.9919 | 0.9917 | 0.9434 | 0.9669 |
| 0.0121 | 3.0 | 10608 | 0.0350 | 0.9939 | 0.9905 | 0.9596 | 0.9748 |
@misc{distilroberta-base-rejection-v1,
author = {ProtectAI.com},
title = {Fine-Tuned DistilRoberta-Base for Rejection in the output Detection},
year = {2024},
publisher = {HuggingFace},
url = {https://huggingface.co/ProtectAI/distilroberta-base-rejection-v1},
}