Instructions to use openai-community/roberta-large-openai-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openai-community/roberta-large-openai-detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="openai-community/roberta-large-openai-detector")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("openai-community/roberta-large-openai-detector") model = AutoModelForSequenceClassification.from_pretrained("openai-community/roberta-large-openai-detector", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
config.json: add id2label / label2id (0 = Fake, 1 = Real)
config.json has no id2label, so pipeline('text-classification') returns LABEL_0 / LABEL_1 and users cannot tell which one means machine-generated. OpenAI's original detector server reads the softmax as fake, real = probs (gpt-2-output-dataset, detector/server.py), so index 0 is Fake; checked on the first 40 texts of OpenAI's output dataset: mean P(index 0) = 0.987 on xl-1542M-k40.test and 0.05 on webtext.test. This PR adds id2label = {0: Fake, 1: Real} and the matching label2id; weights are unchanged.
Found while benchmarking open-source AI-text detectors.
Thanks for this, and for verifying it properly: the mapping is not guessed, it is checked against OpenAI's original detector server, which reads the softmax as fake first, and against the output dataset itself (mean P(index 0) of 0.987 on the xl test split against 0.05 on webtext). With id2label missing, every pipeline user gets LABEL_0 and LABEL_1 with no way to tell which side is machine generated, so the fix removes a real footgun for anyone benchmarking detectors. Weights untouched, config only, exactly the right scope.