Instructions to use Insusty/on-device-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER2
How to use Insusty/on-device-models with GLiNER2:
from gliner2 import AutoExtractor extractor = AutoExtractor.from_pretrained("Insusty/on-device-models") # Extract entities text = "Apple CEO Tim Cook announced iPhone 15 in Cupertino yesterday." result = extractor.extract_entities(text, ["company", "person", "product", "location"]) print(result) - Transformers.js
How to use Insusty/on-device-models with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('token-classification', 'Insusty/on-device-models'); - Notebooks
- Google Colab
- Kaggle
|
Download README.md from Insusty/on-device-models: direct link, hf CLI and curl.
- Browser
- Download file 6.47 kB
-
https://huggingface.co/Insusty/on-device-models/resolve/main/README.md
- Command line
-
hf download hf://Insusty/on-device-models/README.md
-
curl -L -o README.md https://huggingface.co/Insusty/on-device-models/resolve/main/README.md
6.47 kB
| license: apache-2.0 | |
| language: | |
| - en | |
| - fr | |
| - es | |
| - de | |
| - it | |
| - pt | |
| - nl | |
| library_name: onnx | |
| pipeline_tag: token-classification | |
| tags: | |
| - gliner2 | |
| - pii | |
| - ner | |
| - redaction | |
| - onnx | |
| - transformers.js | |
| base_model: | |
| - fastino/gliner2-privacy-filter-PII-multi | |
| - fastino/gliner2-multi-v1 | |
| # Insusty on-device models | |
| Browser-ready ONNX exports of two GLiNER2 checkpoints by [Fastino AI](https://huggingface.co/fastino), used by the Insusty Prompt Coach (Insusty Privacy Coach) Chrome extension for **AI redaction on the device**: before a prompt is sent to ChatGPT, Claude or Gemini, the extension looks in it for what the user's custom labels describe (by default, people's names) and offers to hide it. The model runs locally in the browser, on onnxruntime-web; the prompt text is never sent anywhere to be checked. These files are the only thing the extension downloads from this repository, once, when AI redaction is turned on. | |
| Nothing here is a new or retrained model: each folder holds the upstream weights in another file format. | |
| ## The models | |
| ### `gliner2-pii-multi-v1/`: GLiNER2-PII (the extension's default) | |
| - **What it is:** [`fastino/gliner2-privacy-filter-PII-multi`](https://huggingface.co/fastino/gliner2-privacy-filter-PII-multi), pinned at commit `1cb4166094dc58fa8d836429f060d6c95f62b495`: GLiNER2 fine-tuned by Fastino AI to find personally identifiable information. It reads a set of entity types, each with a name and a description, and scores every span of the text (up to 8 words) for each type, so its answers are positions in the text. | |
| - **Used for:** the default on-device model of AI redaction. The extension gives it the user's custom labels as entity types (a new install has one, **Name**: "A person's name."). | |
| - **Languages:** English, French, Spanish, German, Italian, Portuguese and Dutch, per the upstream model card. Insusty has measured English and French only. | |
| - **Download:** 446,053,793 bytes (about 425 MB) for the whole folder. | |
| ### `gliner2-multi-v1/`: GLiNER2 Multi | |
| - **What it is:** [`fastino/gliner2-multi-v1`](https://huggingface.co/fastino/gliner2-multi-v1), pinned at commit `ce747d79a8e362d3dee0b0b26d1201f7f1a8615a`: Fastino AI's general multilingual GLiNER2, which extracts entities of any type given by name and description. | |
| - **Used for:** a second on-device model the user can choose for AI redaction, with the same labels. | |
| - **Languages:** French, English, Spanish, German, Italian and Portuguese, per the upstream model card. Insusty has measured English and French only. | |
| - **Download:** 446,391,439 bytes (about 426 MB) for the whole folder. | |
| Both are built on [mDeBERTa-v3-base](https://huggingface.co/microsoft/mdeberta-v3-base) (about 307M parameters with its embedding table). While one is loaded, the extension's model worker holds about 2.3 to 2.9 GB of memory; it never loads both at once. | |
| ## What each folder holds | |
| Each folder is the output of `scripts/models/gliner2-export.py` in the extension's repository, run with the Python packages pinned in `scripts/models/requirements.txt`. The export is byte-for-byte reproducible from the pinned upstream weights, and it is checked against the reference `gliner2` library on test sentences (the same entities, scores within 0.02). | |
| - `encoder.onnx`: the mDeBERTa-v3 encoder, stored compressed: its linear weights as fp16 and its word-embedding table as int8 with one fp32 scale per row. Compute stays fp32 (int8 compute breaks mDeBERTa models). | |
| - `head.onnx`: the GLiNER2 heads entity extraction runs after the encoder: the count gate, the count-aware label queries and the span scores. Its linear weights are stored fp16 like the encoder's. | |
| - `tokenizer.json`, `tokenizer_config.json`: the checkpoint's tokenizer, as Transformers.js reads it. | |
| - `gliner2.json`: the special token ids, span width and hidden size the runtime needs. | |
| - `manifest.json`: every file above with its size and SHA-256, the upstream repository, revision and licence, and the export version. | |
| The extension pins each `manifest.json` by its SHA-256 and downloads from one fixed commit of this repository, never its moving `main`, so a later push here never changes what an installed extension loads: a file whose size or hash differs from the pins is refused. | |
| | Folder | `manifest.json` SHA-256 | | |
| | --- | --- | | |
| | `gliner2-pii-multi-v1/` | `850ab927745757dbbcf37c2618e3d059178ac2498d3d705b2432e00cab7e8dc6` | | |
| | `gliner2-multi-v1/` | `cbf180db4edcfb334b43b0e19ab3e8b1a880b66b60448280b287d0a116c9fe26` | | |
| ## How well it works, and its limits | |
| Insusty measured the default Name label on the person-name annotations of published datasets (Gretel English and French, Nemotron-PII, and TAB), running these exports on onnxruntime-web WASM. The settings were chosen on development samples; these numbers are from held-out samples (480 documents, 923 names), scored once: | |
| | Model | Recall | Precision | F1 | Name-free documents flagged | | |
| | --- | --- | --- | --- | --- | | |
| | GLiNER2-PII (`gliner2-pii-multi-v1`) | 85.5 | 84.7 | 85.1 | 11.7% | | |
| | GLiNER2 Multi (`gliner2-multi-v1`) | 82.9 | 83.1 | 83.0 | 17.3% | | |
| On French documents GLiNER2-PII reaches recall 83.8 and F1 80.7. | |
| - **It misses things and flags things.** About one name in seven is missed, and about one prompt in nine without a name has something flagged. The extension checks the model's answers in code before they can redact anything, and they never weaken its own rule-based detection. | |
| - **Only names were measured.** Other custom labels (customer ids, project names and so on) work through the label's name, description and examples, but Insusty has no numbers for them. | |
| - **English and French only were measured**; the other languages are the upstream models' claims. | |
| - **Entity extraction only.** The export keeps the heads entity extraction needs; GLiNER2's classification, structured-data and relation-extraction tasks are not in these files. | |
| - **Spans of up to 8 words**, read in windows of 256 words that share 32. | |
| - **Speed and memory.** A document takes about 2.7 s at the median on 4 WASM threads, and the process peaks at about 2.9 GB, so it needs a machine with memory to spare. | |
| ## Licence and attribution | |
| Apache License 2.0, the licence of the upstream checkpoints: GLiNER2-PII and GLiNER2 Multi are Copyright Fastino AI. They are built on mDeBERTa-v3-base (MIT, Copyright Microsoft Corporation), whose tokenizer they ship. The full licence is at https://www.apache.org/licenses/LICENSE-2.0. | |