ai-text-detector-v1.01 โ€” ONNX (fp32)

Unmodified ONNX export of desklib/ai-text-detector-v1.01 (MIT license), a DeBERTa-v3-large based AI-generated-text detector. All credit for the model and its training belongs to the original authors; this repository only converts it so it can run with onnxruntime and Transformers.js (e.g. fully in the browser).

Details

  • Graph: mean pooling + single-logit classification head baked into the ONNX graph. Inputs input_ids, attention_mask; output logits of shape [batch, 1]. Apply a sigmoid to get P(AI-generated). config.json sets problem_type: multi_label_classification so Transformers.js applies the sigmoid automatically (single label: AI).
  • External data format: the graph lives in onnx/model.onnx (2 MB) and the fp32 weights in onnx/model.onnx_data (1.7 GB). Native onnxruntime picks the data file up automatically; in Transformers.js pass use_external_data_format: true. This format is required in browsers โ€” a single-file 1.7 GB model gets double-buffered during parsing and exceeds the 4 GB WebAssembly memory limit. Even with external data, in-browser inference at this size needs WebGPU (device: "webgpu"); the CPU/WASM backend cannot hold the weights plus activations.
  • Precision: fp32 only, on purpose. int8 quantization shifts this model's probabilities by up to 0.5 (DeBERTa's disentangled attention is quantization- sensitive), and fp16 is pathologically slow on onnxruntime CPU. fp32 matches the original PyTorch outputs exactly.
  • Sequence length: exported for up to 768 tokens (relative position attention).

Usage (Transformers.js)

import { pipeline } from "@huggingface/transformers";

// Requires transformers.js v4+. v3.x mis-tokenizes DeBERTa prefix spaces
// (first-word token differs from the Python tokenizer) and produces NaN on
// padded WebGPU batches; both are fixed in 4.x (verified on 4.2.0).
const detect = await pipeline(
  "text-classification",
  "GabeuxDev/ai-text-detector-v1.01-onnx",
  { dtype: "fp32", device: "webgpu" }
); // config.json already sets use_external_data_format for the loader
const [{ score }] = await detect("Text to check.");
console.log("P(AI) =", score);

Note: the model file is ~1.7 GB; in a browser this implies a large one-time download and several GB of RAM during inference.

License

MIT, inherited from the original model. See the original repository for model details, training information and evaluation.

Downloads last month
26
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for GabeuxDev/ai-text-detector-v1.01-onnx

Quantized
(1)
this model