Instructions to use Deepchecks/roberta_toxicity_classifier_onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Deepchecks/roberta_toxicity_classifier_onnx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Deepchecks/roberta_toxicity_classifier_onnx")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Deepchecks/roberta_toxicity_classifier_onnx") model = AutoModelForSequenceClassification.from_pretrained("Deepchecks/roberta_toxicity_classifier_onnx") - Notebooks
- Google Colab
- Kaggle
Commit ·
f72d0aa
1
Parent(s): fe2b41d
Update README.md
Browse files
README.md
CHANGED
|
@@ -27,8 +27,8 @@ tokenizer = AutoTokenizer.from_pretrained('Deepchecks/roberta_toxicity_classifie
|
|
| 27 |
model = ORTModelForSequenceClassification.from_pretrained('Deepchecks/roberta_toxicity_classifier_onnx')
|
| 28 |
|
| 29 |
# prepare the pipeline and generate inferences
|
| 30 |
-
pip = pipeline(task='text-classification', model=
|
| 31 |
-
res = pip(
|
| 32 |
|
| 33 |
```
|
| 34 |
|
|
|
|
| 27 |
model = ORTModelForSequenceClassification.from_pretrained('Deepchecks/roberta_toxicity_classifier_onnx')
|
| 28 |
|
| 29 |
# prepare the pipeline and generate inferences
|
| 30 |
+
pip = pipeline(task='text-classification', model=model, tokenizer=tokenizer, device=device, accelerator="ort")
|
| 31 |
+
res = pip(['I hate you', 'I love you'], batch_size=64, truncation="only_first")
|
| 32 |
|
| 33 |
```
|
| 34 |
|