Instructions to use vilhelmbergsoe/gradient-ai-text-detector-webgpu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use vilhelmbergsoe/gradient-ai-text-detector-webgpu with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-classification', 'vilhelmbergsoe/gradient-ai-text-detector-webgpu');
|
Download README.md from vilhelmbergsoe/gradient-ai-text-detector-webgpu: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/vilhelmbergsoe/gradient-ai-text-detector-webgpu/resolve/main/README.md
- Command line
-
hf download hf://vilhelmbergsoe/gradient-ai-text-detector-webgpu/README.md
-
curl -L -o README.md https://huggingface.co/vilhelmbergsoe/gradient-ai-text-detector-webgpu/resolve/main/README.md
1.6 kB
| library_name: transformers.js | |
| base_model: batmac/gradient-ai-text-detector-onnx | |
| base_model_relation: quantized | |
| pipeline_tag: text-classification | |
| language: [en] | |
| license: mit | |
| tags: [onnx, webgpu, ai-generated-text-detection, deberta-v2] | |
| # Gradient AI-text detector, static 8x256 for WebGPU | |
| A browser-oriented build of [ShantanuT01/gradient-ai-text-detector](https://huggingface.co/ShantanuT01/gradient-ai-text-detector) | |
| (DeBERTa-v3-large, MIT), made from the 4-bit ONNX export | |
| [batmac/gradient-ai-text-detector-onnx](https://huggingface.co/batmac/gradient-ai-text-detector-onnx) | |
| at revision `776d0164ba0de631036c70f6a146d68a7cd4ea4e`. | |
| The weights are unchanged. Two graph changes make it fast on onnxruntime-web's WebGPU provider: | |
| 1. Each relative-attention `GatherElements(data, Expand(idx))` becomes an equivalent flat `Gather` | |
| with an `[L, L]` index, so no `[batch*heads, L, L]` int64 tensor is built each run. | |
| 2. The input shape is fixed at **batch 8 x 256 tokens** and all shape arithmetic is constant-folded, | |
| so nothing round-trips GPU -> CPU mid-run. | |
| In Firefox this takes a full batch from ~5.3 s to ~3.5 s, about 0.44 s per passage. | |
| ## Usage | |
| Inputs must be exactly `input_ids` and `attention_mask` of shape `[8, 256]` (int64). Right-pad | |
| with token 0 and mask 0. Output `logits` is `[8, 1]`; apply a sigmoid yourself. The score is the | |
| raw classifier output, not a calibrated probability. | |
| Built by `scripts/build-model.sh` in the Deckard (in-browser) Firefox extension. | |
| Not endorsed by the model authors or Microsoft. Do not use as the sole basis for high-stakes | |
| decisions. | |