Instructions to use GabeuxDev/ai-text-detector-v1.01-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use GabeuxDev/ai-text-detector-v1.01-onnx with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-classification', 'GabeuxDev/ai-text-detector-v1.01-onnx');
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; outputlogitsof shape[batch, 1]. Apply a sigmoid to get P(AI-generated).config.jsonsetsproblem_type: multi_label_classificationso 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 in1.7 GB). Native onnxruntime picks the data file up automatically; in Transformers.js passonnx/model.onnx_data(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
Model tree for GabeuxDev/ai-text-detector-v1.01-onnx
Base model
microsoft/deberta-v3-large Finetuned
desklib/ai-text-detector-v1.01