Instructions to use textdetox/xlmr-large-toxicity-classifier-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use textdetox/xlmr-large-toxicity-classifier-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="textdetox/xlmr-large-toxicity-classifier-v2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("textdetox/xlmr-large-toxicity-classifier-v2") model = AutoModelForSequenceClassification.from_pretrained("textdetox/xlmr-large-toxicity-classifier-v2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add id2label/label2id to config.json
#1
by vrdn23 - opened
config.json has no id2label, so transformers falls back to LABEL_0/LABEL_1 and text-embeddings-inference refuses to load the model (config.json does not contain id2label).
This adds the mapping documented in the model card: index 0 = neutral, index 1 = toxic. No weights change.
great, thank you!!
dardem changed pull request status to merged