Downloads · 30 days
12
15% of all-time downloads
Eslzzyl/aigc-detector-en-onnx
aigc-detector-en-onnx is a text classification model from Eslzzyl. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
ONNX INT8 quantized model exported from yuchuantian/AIGCdetectorenv3, for detecting whether English text is AI-generated.
Downloads · 30 days
12
15% of all-time downloads
All-time downloads
82
Public
Repo size
126 MB
Likes
0
Public
Click a slice to open those files.
.onnx126 MB · 96%
From the Hugging Face model README
ONNX INT8 quantized model exported from yuchuantian/AIGC_detector_env3, for detecting whether English text is AI-generated.
RobertaForSequenceClassification (RoBERTa-base, 12-layer, 768-hidden)input_ids, attention_mask (int64) — note: no token_type_idslogits (float32, shape [batch, 2]) → [Human_Written, AI_Generated]from tokenizers import Tokenizer
import onnxruntime as ort
import numpy as np
tokenizer = Tokenizer.from_file("tokenizer.json")
tokenizer.enable_padding(pad_id=1, pad_token="<pad>")
tokenizer.enable_truncation(max_length=512)
session = ort.InferenceSession("onnx/model_quantized.onnx")
text = "This is a text to detect."
enc = tokenizer.encode(text)
logits = session.run(None, {
"input_ids": np.array([enc.ids], dtype=np.int64),
"attention_mask": np.array([enc.attention_mask], dtype=np.int64),
})[0]
# softmax → [human_prob, ai_prob]
probs = np.exp(logits - logits.max(axis=-1, keepdims=True))
probs = probs / probs.sum(axis=-1, keepdims=True)
is_ai = probs[0][1] > probs[0][0]
Runtime dependencies: onnxruntime + tokenizers only. No PyTorch or Transformers needed.