From 234137ec5006b3b3d7ef6defc2d4bde188f577a5 Mon Sep 17 00:00:00 2001 From: Domi31tls Date: Wed, 15 Apr 2026 18:37:20 +0200 Subject: [PATCH] fix(frozen): ajouter optimum aux hiddenimports PyInstaller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message cosmétique sur Windows : "Prêt (NER indisponible : optimum.onnxruntime introuvable. Installez 'optimum' et 'onnxruntime')". Apparaît dans la barre de statut de la GUI quand EDS-Pseudo échoue à charger, et que le fallback ner_manager_onnx.py essaie d'utiliser optimum. Cause : 'optimum' n'était pas dans hiddenimports → PyInstaller ne le bundlait pas → ner_manager_onnx.py mettait ORTModelForTokenClassification = None au niveau module → l'appel à load() levait RuntimeError. Le pipeline principal (CamemBERT-bio ONNX + EDS-Pseudo + GLiNER) ne passe PAS par ner_manager_onnx.py — il utilise camembert_ner_manager.py qui charge directement l'ONNX via onnxruntime sans optimum. Donc le masquage fonctionne correctement malgré ce message. Mais le message inquiète l'utilisateur. Fix : ajouter optimum + sous-modules aux hiddenimports. Impact taille attendu : ~30-80 MB selon les dépendances embarquées. Co-Authored-By: Claude Opus 4.6 (1M context) --- anonymisation_onefile.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/anonymisation_onefile.spec b/anonymisation_onefile.spec index c559b37..34ebf2a 100644 --- a/anonymisation_onefile.spec +++ b/anonymisation_onefile.spec @@ -40,6 +40,13 @@ a = Analysis( 'transformers', 'tokenizers', 'torch', 'pdfplumber', 'ahocorasick', 'sklearn', 'scipy', 'pydantic', 'yaml', 'PIL', 'loguru', 'regex', + # optimum : utilisé par ner_manager_onnx.py (fallback NER legacy). + # Sans ça, la GUI affiche "NER indisponible : optimum.onnxruntime introuvable" + # si EDS-Pseudo échoue. Le pipeline principal (CamemBERT-bio ONNX + + # EDS-Pseudo + GLiNER) n'en dépend pas — mais l'absence du hiddenimport + # crée un message d'erreur cosmétique gênant. + 'optimum', 'optimum.onnxruntime', 'optimum.pipelines', + 'optimum.modeling_base', 'optimum.exporters.onnx', ], cipher=block_cipher, noarchive=False,