Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: text-classification
|
3 |
+
language: en
|
4 |
+
datasets:
|
5 |
+
- valurank/wikirev-bias
|
6 |
+
inference: false
|
7 |
+
tags:
|
8 |
+
- bias
|
9 |
+
- distilroberta
|
10 |
+
---
|
11 |
+
|
12 |
+
# ONNX version of valurank/distilroberta-bias
|
13 |
+
|
14 |
+
**This model is a conversion of [valurank/distilroberta-bias](https://huggingface.co/valurank/distilroberta-bias) to ONNX** format. It is designed to detect biases in text using the distilled version of the RoBERTa model. The model was converted to ONNX using the [🤗 Optimum](https://huggingface.co/docs/optimum/index) library.
|
15 |
+
|
16 |
+
## Model Architecture
|
17 |
+
|
18 |
+
**Base Model**: DistilRoBERTa, a distilled version of the RoBERTa model that is optimized for faster performance while maintaining similar accuracy.
|
19 |
+
|
20 |
+
**Modifications**: The model is converted to ONNX format with no additional changes.
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
Loading the model requires the [🤗 Optimum](https://huggingface.co/docs/optimum/index) library installed.
|
25 |
+
|
26 |
+
```python
|
27 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
28 |
+
from transformers import AutoTokenizer, pipeline
|
29 |
+
|
30 |
+
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained("laiyer/distilroberta-bias-onnx")
|
32 |
+
model = ORTModelForSequenceClassification.from_pretrained("laiyer/distilroberta-bias-onnx")
|
33 |
+
classifier = pipeline(
|
34 |
+
task="text-classification",
|
35 |
+
model=model,
|
36 |
+
tokenizer=tokenizer,
|
37 |
+
)
|
38 |
+
|
39 |
+
classifier_output = classifier("Your text to analyze for bias.")
|
40 |
+
score = (classifier_output[0]["score"] if classifier_output[0]["label"] == "BIASED" else 1 - classifier_output[0]["score"])
|
41 |
+
```
|