File size: 1,435 Bytes
4251815
563b894
 
 
 
4251815
 
563b894
dc3621b
 
563b894
fe2b41d
 
 
 
 
 
 
563b894
 
 
 
 
 
 
 
 
 
 
f72d0aa
 
563b894
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
language:
- en
tags:
- toxicity
license: cc-by-nc-sa-4.0
---

This model represents an ONNX-optimized version of the original [roberta_toxicity_classifier](https://huggingface.co/s-nlp/roberta_toxicity_classifier) model.
It has been specifically tailored for GPUs and may exhibit variations in performance when run on CPUs.

## Dependencies

Please install the following dependency before you begin working with the model:
```sh
pip install optimum[onnxruntime-gpu]
```

## How to use
```python
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSequenceClassification
from optimum.pipelines import pipeline

# load tokenizer and model weights
tokenizer = AutoTokenizer.from_pretrained('Deepchecks/roberta_toxicity_classifier_onnx')
model = ORTModelForSequenceClassification.from_pretrained('Deepchecks/roberta_toxicity_classifier_onnx')

# prepare the pipeline and generate inferences
pip = pipeline(task='text-classification', model=model, tokenizer=tokenizer, device=device, accelerator="ort")
res = pip(['I hate you', 'I love you'], batch_size=64, truncation="only_first")

```

## Licensing Information

[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].

[![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]

[cc-by-nc-sa]: http://creativecommons.org/licenses/by-nc-sa/4.0/
[cc-by-nc-sa-image]: https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png