ONNX Model Zoo

Anonym-IA/V2-camembert-ner-pii-onnx-int8

By Anonym-IA · ↓ 5 · ♥ 0 · Updated 2026-01-19

What's in this repo

This page lists the files in Anonym-IA/V2-camembert-ner-pii-onnx-int8, including model_quantized.onnx.

  • 1 ONNX models (.onnx files)
  • 10 files, including 6 .json, 1 .md, 1 .onnx, 1 .model
  • Last updated 2026-01-19

ONNX files

File Size Download
onnx/model_quantized.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

V2 CamemBERT-NER-PII French - ONNX INT8 Quantifié

Version ONNX INT8 quantifiée du modèle CamemBERT-NER-PII V2 optimisée pour navigateurs et appareils mobiles.

📦 Taille et Performance

  • Modèle ONNX INT8 : ~110 MB (réduction de 75% vs FP32)
  • Mémoire requise : ~200 MB
  • Temps d'inférence : 150-400ms pour 512 tokens
  • Précision : ~70-80% du modèle FP32 (dégradation notable)
  • Chargement : ~3x plus rapide que FP32
  • ⚠️ Configuration : AVX2 (seule config fonctionnelle, scores réduits)

✅ Avantages vs FP32

Caractéristique INT8 (Ce modèle) FP32
Taille ~110 MB ✅ ~440 MB
Vitesse chargement ~2-3s ✅ ~6-10s
Mémoire utilisée ~200 MB ✅ ~600 MB
Précision ~70-80% ⚠️ 100%
Scores confiance ~50-60% ⚠️ ~95-98%
Usage recommandé Navigateurs (contraintes) Serveurs, précision

🚀 Utilisation avec Transformers.js

Installation

npm install @huggingface/transformers

Code JavaScript

import { pipeline, env } from '@huggingface/transformers';

// Configuration optimale
env.backends.onnx.wasm.numThreads = 4;

// Charger le modèle ONNX INT8 quantifié
const ner = await pipeline(
  'token-classification',
  'Anonym-IA/V2-camembert-ner-pii-onnx-int8',
  { quantized: true }  // Important pour INT8
);

// Détecter les PII
const text = "Jean Dupont habite au 12 rue de la Paix, 75001 Paris";
const entities = await ner(text, { aggregation_strategy: 'simple' });

console.log(entities);
// [
//   { entity_group: 'PRENOM_PERSONNE', word: 'Jean', score: 0.94, ... },
//   { entity_group: 'NOM_PERSONNE', word: 'Dupont', score: 0.91, ... },
//   ...
// ]

Anonymisation côté client (exemple complet)

async function anonymizeInBrowser(text) {
  const entities = await ner(text, { aggregation_strategy: 'simple' });

  let anonymized = text;
  const mapping = {};
  const counters = {};

  // Tri par position décroissante
  entities.sort((a, b) => b.start - a.start);

  for (const entity of entities) {
    const type = entity.entity_group;
    counters[type] = (counters[type] || 0) + 1;
    const marker = `[${type}${counters[type]}]`;

    mapping[marker] = entity.word;
    anonymized = anonymized.slice(0, entity.start) +
                 marker +
                 anonymized.slice(entity.end);
  }

  return { anonymized, mapping };
}

// Utilisation
const result = await anonymizeInBrowser(
  "Jean Dupont habite au 12 rue de la Paix, 75001 Paris"
);

console.log(result.anonymized);
// "[PN1] [NOM1] habite au [NUM1] [VOIE1], [CP1] [VI1]"

console.log(result.mapping);
// { "[PN1]": "Jean", "[NOM1]": "Dupont", ... }

📊 Performance navigateur

Testé sur :

  • ✅ Chrome/Edge (meilleur)
  • ✅ Firefox
  • ⚠️ Safari (plus lent mais fonctionnel)

Benchmarks (MacBook Pro M1) :

  • Temps de chargement : ~2-3 secondes
  • Inférence (256 tokens) : ~200ms
  • Mémoire utilisée : ~180 MB

Benchmarks (Windows Desktop i7) :

  • Temps de chargement : ~3-4 secondes
  • Inférence (256 tokens) : ~300ms
  • Mémoire utilisée : ~220 MB

🔧 Optimisations recommandées

Multi-threading

env.backends.onnx.wasm.numThreads = navigator.hardwareConcurrency || 4;

Cache du modèle (évite rechargement)

env.cacheDir = './.cache/transformers';

WebGPU (si disponible)

// Utilise GPU navigateur pour accélération matérielle
env.backends.onnx.executionProviders = ['webgpu', 'wasm'];

🆚 Comparaison avec FP32

⚠️ RECOMMANDATION : Privilégiez FP32 sauf contraintes strictes de taille

Utilisez INT8 UNIQUEMENT si :

  • ⚠️ Contraintes de bande passante critiques (< 200 MB)
  • ⚠️ Vous acceptez une dégradation de ~20-30% de précision
  • ⚠️ Les scores de confiance réduits (~50-60%) sont acceptables
  • ⚠️ Navigateurs avec mémoire très limitée

Utilisez FP32 (recommandé) si :

  • ✅ Précision importante pour votre cas d'usage
  • ✅ Bande passante permet ~450 MB
  • ✅ Scores de confiance élevés requis (~95-98%)
  • ✅ Serveur avec ressources suffisantes

📄 Autres versions

Modèle PyTorch (serveur Python)

Anonym-IA/V2-camembert-ner-pii-french

Modèle ONNX FP32 (précision maximale)

Anonym-IA/V2-camembert-ner-pii-onnx-fp32

🏷️ Entités détectées

Identiques au modèle PyTorch :

  • Personnes (noms, prénoms)
  • Adresses (numéros, voies, villes, codes postaux)
  • Contact (emails, téléphones)
  • Identifiants (NIR, IBAN, dossiers, cadastre)
  • Organisations (sociétés)
  • Et 70+ autres catégories PII

🔧 Quantification

  • Méthode : Quantification dynamique INT8
  • Poids : FP32 → INT8 (32 bits → 8 bits)
  • Configuration : AVX2 (seule config fonctionnelle)
  • Calibration : Aucune requise (quantification dynamique)
  • ⚠️ Note : ARM64 et AVX512 détruisent complètement les prédictions (0 détections). AVX2 réduit les scores (~50-60% vs 95-98%) mais détecte au moins les entités.

🔗 Liens

  • Modèle PyTorch : https://huggingface.co/Anonym-IA/V2-camembert-ner-pii-french
  • ONNX FP32 : https://huggingface.co/Anonym-IA/V2-camembert-ner-pii-onnx-fp32
  • GitHub : Anonym-IA_LLM_Pseudonymisation
  • Transformers.js : https://huggingface.co/docs/transformers.js

Généré automatiquement le 2026-01-19 21:55:37

Model info

token-classification transformers.js
transformers.js onnx camembert token-classification int8 quantized browser named-entity-recognition pii lightweight fr dataset:TypicaAI/pii-masking-60k_fr
↓ 5 ♥ 0

Created: 2026-01-19

Updated: 2026-01-19

View on Hugging Face

Files (10)

.gitattributes
README.md
added_tokens.json
config.json
onnx/model_quantized.onnx ONNX
ort_config.json
sentencepiece.bpe.model
special_tokens_map.json
tokenizer.json
tokenizer_config.json

Related models