gheim 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/cjs/index.cjs +20 -6
- package/dist/cjs/openai/index.cjs +20 -6
- package/dist/esm/index.js +20 -6
- package/dist/esm/openai/index.js +20 -6
- package/dist/types/detectors/calibrated.d.ts +29 -19
- package/dist/types/detectors/calibrated.d.ts.map +1 -1
- package/dist/types/detectors/index.d.ts +3 -3
- package/dist/types/detectors/index.d.ts.map +1 -1
- package/dist/types/detectors/local.d.ts +29 -2
- package/dist/types/detectors/local.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,14 +41,15 @@ The core package itself has no runtime dependencies.
|
|
|
41
41
|
(transformers.js). The package's default model is
|
|
42
42
|
[`joelbarmettler/gheim-ch-560m`](https://huggingface.co/joelbarmettler/gheim-ch-560m)
|
|
43
43
|
— a 560M xlm-roberta-large fine-tune optimised for Swiss-market PII
|
|
44
|
-
(strict
|
|
44
|
+
(test strict F1 0.910, char F1 0.946 on Swiss text, see
|
|
45
45
|
[MODEL_CARD.md](https://github.com/joelbarmettlerUZH/gheim/blob/main/MODEL_CARD.md)).
|
|
46
46
|
Any HuggingFace token-classification model that emits the same 33-class
|
|
47
47
|
BIOES schema can be substituted via `model:`.
|
|
48
48
|
|
|
49
49
|
| Model | Best for | Parameters | Notes |
|
|
50
50
|
|---|---|---:|---|
|
|
51
|
-
| [`joelbarmettler/gheim-ch-560m`](https://huggingface.co/joelbarmettler/gheim-ch-560m) **(default)** | Swiss
|
|
51
|
+
| [`joelbarmettler/gheim-ch-560m`](https://huggingface.co/joelbarmettler/gheim-ch-560m) **(default)** | Production / commercial. Swiss court / parliament / web text with CH-format account numbers (IBAN, AHV, VAT-CHE) | 560M | Apache 2.0. Test strict F1 0.910, char F1 0.946. Hub repo ships both fp32 and `onnx/model_quantized.onnx` — load with `dtype: "q8"` for browser deployment. |
|
|
52
|
+
| [`joelbarmettler/gheim-ch-560m-research`](https://huggingface.co/joelbarmettler/gheim-ch-560m-research) | Research / non-commercial. Stronger cross-domain transfer on Swiss-news text (swissner PER char F1 0.90 vs 0.70 on the default) | 560M | **CC BY-NC-SA 4.0 + Reuters research-only rider.** safetensors only — no browser-targeted ONNX. |
|
|
52
53
|
| [`openai/privacy-filter`](https://huggingface.co/openai/privacy-filter) | English-first or general use, long-context (up to 128k tokens) | 1.4B (50M active, MoE) | Apache 2.0. Wider language coverage, larger weights. |
|
|
53
54
|
|
|
54
55
|
```ts
|
|
@@ -58,6 +59,9 @@ import { LocalDetector } from "gheim";
|
|
|
58
59
|
// the browser and falls back to WASM; in Node it's WASM directly.
|
|
59
60
|
const det = new LocalDetector({ dtype: "q8" });
|
|
60
61
|
|
|
62
|
+
// Stronger cross-domain transfer (research, non-commercial; safetensors only):
|
|
63
|
+
const detResearch = new LocalDetector({ model: "joelbarmettler/gheim-ch-560m-research" });
|
|
64
|
+
|
|
61
65
|
// Alternative for English or general use:
|
|
62
66
|
const detEn = new LocalDetector({ model: "openai/privacy-filter" });
|
|
63
67
|
```
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -391,13 +391,14 @@ class LocalDetector {
|
|
|
391
391
|
chunkOverlapTokens;
|
|
392
392
|
batchSize;
|
|
393
393
|
actualDevice = null;
|
|
394
|
+
actualDtype = null;
|
|
394
395
|
_pipeline = null;
|
|
395
396
|
_loadPromise = null;
|
|
396
397
|
_onProgress;
|
|
397
398
|
constructor(opts = {}) {
|
|
398
399
|
this.model = opts.model ?? DEFAULT_MODEL2;
|
|
399
400
|
this.device = opts.device ?? "auto";
|
|
400
|
-
this.dtype = opts.dtype ?? "
|
|
401
|
+
this.dtype = opts.dtype ?? "auto";
|
|
401
402
|
this.aggregationStrategy = opts.aggregationStrategy ?? "simple";
|
|
402
403
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS;
|
|
403
404
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS;
|
|
@@ -409,8 +410,14 @@ class LocalDetector {
|
|
|
409
410
|
if (opts.pipelineInstance) {
|
|
410
411
|
this._pipeline = opts.pipelineInstance;
|
|
411
412
|
this.actualDevice = this.device === "auto" ? null : this.device;
|
|
413
|
+
this.actualDtype = this.dtype === "auto" ? null : this.dtype;
|
|
412
414
|
}
|
|
413
415
|
}
|
|
416
|
+
_resolveDtype(device) {
|
|
417
|
+
if (this.dtype !== "auto")
|
|
418
|
+
return this.dtype;
|
|
419
|
+
return device === "webgpu" ? "fp16" : "q8";
|
|
420
|
+
}
|
|
414
421
|
async load() {
|
|
415
422
|
if (this._pipeline)
|
|
416
423
|
return this._pipeline;
|
|
@@ -422,14 +429,16 @@ class LocalDetector {
|
|
|
422
429
|
let lastErr;
|
|
423
430
|
for (let i = 0;i < sequence.length; i++) {
|
|
424
431
|
const dev = sequence[i] ?? "wasm";
|
|
432
|
+
const resolvedDtype = this._resolveDtype(dev);
|
|
425
433
|
try {
|
|
426
434
|
const pipe = await mod.pipeline("token-classification", this.model, {
|
|
427
435
|
device: dev,
|
|
428
|
-
dtype:
|
|
436
|
+
dtype: resolvedDtype,
|
|
429
437
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, dev) : undefined
|
|
430
438
|
});
|
|
431
439
|
this._pipeline = pipe;
|
|
432
440
|
this.actualDevice = dev;
|
|
441
|
+
this.actualDtype = resolvedDtype;
|
|
433
442
|
return pipe;
|
|
434
443
|
} catch (e) {
|
|
435
444
|
lastErr = e;
|
|
@@ -445,6 +454,7 @@ class LocalDetector {
|
|
|
445
454
|
async _planDeviceSequence() {
|
|
446
455
|
if (this.device !== "auto")
|
|
447
456
|
return [this.device];
|
|
457
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
448
458
|
const seq = [];
|
|
449
459
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
450
460
|
if (nav?.gpu?.requestAdapter) {
|
|
@@ -454,7 +464,7 @@ class LocalDetector {
|
|
|
454
464
|
seq.push("webgpu");
|
|
455
465
|
} catch {}
|
|
456
466
|
}
|
|
457
|
-
seq.push("wasm");
|
|
467
|
+
seq.push(isBrowser ? "wasm" : "cpu");
|
|
458
468
|
return seq;
|
|
459
469
|
}
|
|
460
470
|
_emitProgress(raw, device) {
|
|
@@ -886,6 +896,7 @@ class CalibratedDetector {
|
|
|
886
896
|
chunkOverlapTokens;
|
|
887
897
|
trimWhitespace;
|
|
888
898
|
actualDevice = null;
|
|
899
|
+
actualDtype = null;
|
|
889
900
|
_model = null;
|
|
890
901
|
_tokenizer = null;
|
|
891
902
|
_id2label = {};
|
|
@@ -896,7 +907,7 @@ class CalibratedDetector {
|
|
|
896
907
|
this.model = opts.model ?? DEFAULT_MODEL3;
|
|
897
908
|
this.oBias = opts.oBias ?? 0.5;
|
|
898
909
|
this.device = opts.device ?? "auto";
|
|
899
|
-
this.dtype = opts.dtype ?? "
|
|
910
|
+
this.dtype = opts.dtype ?? "auto";
|
|
900
911
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS2;
|
|
901
912
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS2;
|
|
902
913
|
this.trimWhitespace = opts.trimWhitespace ?? true;
|
|
@@ -914,8 +925,9 @@ class CalibratedDetector {
|
|
|
914
925
|
const mod = await loadTransformersJs2();
|
|
915
926
|
let preferredDevice = this.device;
|
|
916
927
|
if (this.device === "auto") {
|
|
928
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
917
929
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
918
|
-
preferredDevice = "wasm";
|
|
930
|
+
preferredDevice = isBrowser ? "wasm" : "cpu";
|
|
919
931
|
if (nav?.gpu?.requestAdapter) {
|
|
920
932
|
try {
|
|
921
933
|
const adapter = await nav.gpu.requestAdapter();
|
|
@@ -924,14 +936,16 @@ class CalibratedDetector {
|
|
|
924
936
|
} catch {}
|
|
925
937
|
}
|
|
926
938
|
}
|
|
939
|
+
const resolvedDtype = this.dtype === "auto" ? preferredDevice === "webgpu" ? "fp16" : "q8" : this.dtype;
|
|
927
940
|
const tokenizer = await mod.AutoTokenizer.from_pretrained(this.model);
|
|
928
941
|
const model = await mod.AutoModelForTokenClassification.from_pretrained(this.model, {
|
|
929
942
|
device: preferredDevice,
|
|
930
|
-
dtype:
|
|
943
|
+
dtype: resolvedDtype,
|
|
931
944
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, preferredDevice) : undefined
|
|
932
945
|
});
|
|
933
946
|
this._tokenizer = tokenizer;
|
|
934
947
|
this._model = model;
|
|
948
|
+
this.actualDtype = resolvedDtype;
|
|
935
949
|
this._id2label = model.config.id2label;
|
|
936
950
|
const label2id = model.config.label2id;
|
|
937
951
|
this._oId = label2id?.["O"] ?? 0;
|
|
@@ -277,13 +277,14 @@ class LocalDetector {
|
|
|
277
277
|
chunkOverlapTokens;
|
|
278
278
|
batchSize;
|
|
279
279
|
actualDevice = null;
|
|
280
|
+
actualDtype = null;
|
|
280
281
|
_pipeline = null;
|
|
281
282
|
_loadPromise = null;
|
|
282
283
|
_onProgress;
|
|
283
284
|
constructor(opts = {}) {
|
|
284
285
|
this.model = opts.model ?? DEFAULT_MODEL2;
|
|
285
286
|
this.device = opts.device ?? "auto";
|
|
286
|
-
this.dtype = opts.dtype ?? "
|
|
287
|
+
this.dtype = opts.dtype ?? "auto";
|
|
287
288
|
this.aggregationStrategy = opts.aggregationStrategy ?? "simple";
|
|
288
289
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS;
|
|
289
290
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS;
|
|
@@ -295,8 +296,14 @@ class LocalDetector {
|
|
|
295
296
|
if (opts.pipelineInstance) {
|
|
296
297
|
this._pipeline = opts.pipelineInstance;
|
|
297
298
|
this.actualDevice = this.device === "auto" ? null : this.device;
|
|
299
|
+
this.actualDtype = this.dtype === "auto" ? null : this.dtype;
|
|
298
300
|
}
|
|
299
301
|
}
|
|
302
|
+
_resolveDtype(device) {
|
|
303
|
+
if (this.dtype !== "auto")
|
|
304
|
+
return this.dtype;
|
|
305
|
+
return device === "webgpu" ? "fp16" : "q8";
|
|
306
|
+
}
|
|
300
307
|
async load() {
|
|
301
308
|
if (this._pipeline)
|
|
302
309
|
return this._pipeline;
|
|
@@ -308,14 +315,16 @@ class LocalDetector {
|
|
|
308
315
|
let lastErr;
|
|
309
316
|
for (let i = 0;i < sequence.length; i++) {
|
|
310
317
|
const dev = sequence[i] ?? "wasm";
|
|
318
|
+
const resolvedDtype = this._resolveDtype(dev);
|
|
311
319
|
try {
|
|
312
320
|
const pipe = await mod.pipeline("token-classification", this.model, {
|
|
313
321
|
device: dev,
|
|
314
|
-
dtype:
|
|
322
|
+
dtype: resolvedDtype,
|
|
315
323
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, dev) : undefined
|
|
316
324
|
});
|
|
317
325
|
this._pipeline = pipe;
|
|
318
326
|
this.actualDevice = dev;
|
|
327
|
+
this.actualDtype = resolvedDtype;
|
|
319
328
|
return pipe;
|
|
320
329
|
} catch (e) {
|
|
321
330
|
lastErr = e;
|
|
@@ -331,6 +340,7 @@ class LocalDetector {
|
|
|
331
340
|
async _planDeviceSequence() {
|
|
332
341
|
if (this.device !== "auto")
|
|
333
342
|
return [this.device];
|
|
343
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
334
344
|
const seq = [];
|
|
335
345
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
336
346
|
if (nav?.gpu?.requestAdapter) {
|
|
@@ -340,7 +350,7 @@ class LocalDetector {
|
|
|
340
350
|
seq.push("webgpu");
|
|
341
351
|
} catch {}
|
|
342
352
|
}
|
|
343
|
-
seq.push("wasm");
|
|
353
|
+
seq.push(isBrowser ? "wasm" : "cpu");
|
|
344
354
|
return seq;
|
|
345
355
|
}
|
|
346
356
|
_emitProgress(raw, device) {
|
|
@@ -772,6 +782,7 @@ class CalibratedDetector {
|
|
|
772
782
|
chunkOverlapTokens;
|
|
773
783
|
trimWhitespace;
|
|
774
784
|
actualDevice = null;
|
|
785
|
+
actualDtype = null;
|
|
775
786
|
_model = null;
|
|
776
787
|
_tokenizer = null;
|
|
777
788
|
_id2label = {};
|
|
@@ -782,7 +793,7 @@ class CalibratedDetector {
|
|
|
782
793
|
this.model = opts.model ?? DEFAULT_MODEL3;
|
|
783
794
|
this.oBias = opts.oBias ?? 0.5;
|
|
784
795
|
this.device = opts.device ?? "auto";
|
|
785
|
-
this.dtype = opts.dtype ?? "
|
|
796
|
+
this.dtype = opts.dtype ?? "auto";
|
|
786
797
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS2;
|
|
787
798
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS2;
|
|
788
799
|
this.trimWhitespace = opts.trimWhitespace ?? true;
|
|
@@ -800,8 +811,9 @@ class CalibratedDetector {
|
|
|
800
811
|
const mod = await loadTransformersJs2();
|
|
801
812
|
let preferredDevice = this.device;
|
|
802
813
|
if (this.device === "auto") {
|
|
814
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
803
815
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
804
|
-
preferredDevice = "wasm";
|
|
816
|
+
preferredDevice = isBrowser ? "wasm" : "cpu";
|
|
805
817
|
if (nav?.gpu?.requestAdapter) {
|
|
806
818
|
try {
|
|
807
819
|
const adapter = await nav.gpu.requestAdapter();
|
|
@@ -810,14 +822,16 @@ class CalibratedDetector {
|
|
|
810
822
|
} catch {}
|
|
811
823
|
}
|
|
812
824
|
}
|
|
825
|
+
const resolvedDtype = this.dtype === "auto" ? preferredDevice === "webgpu" ? "fp16" : "q8" : this.dtype;
|
|
813
826
|
const tokenizer = await mod.AutoTokenizer.from_pretrained(this.model);
|
|
814
827
|
const model = await mod.AutoModelForTokenClassification.from_pretrained(this.model, {
|
|
815
828
|
device: preferredDevice,
|
|
816
|
-
dtype:
|
|
829
|
+
dtype: resolvedDtype,
|
|
817
830
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, preferredDevice) : undefined
|
|
818
831
|
});
|
|
819
832
|
this._tokenizer = tokenizer;
|
|
820
833
|
this._model = model;
|
|
834
|
+
this.actualDtype = resolvedDtype;
|
|
821
835
|
this._id2label = model.config.id2label;
|
|
822
836
|
const label2id = model.config.label2id;
|
|
823
837
|
this._oId = label2id?.["O"] ?? 0;
|
package/dist/esm/index.js
CHANGED
|
@@ -334,13 +334,14 @@ class LocalDetector {
|
|
|
334
334
|
chunkOverlapTokens;
|
|
335
335
|
batchSize;
|
|
336
336
|
actualDevice = null;
|
|
337
|
+
actualDtype = null;
|
|
337
338
|
_pipeline = null;
|
|
338
339
|
_loadPromise = null;
|
|
339
340
|
_onProgress;
|
|
340
341
|
constructor(opts = {}) {
|
|
341
342
|
this.model = opts.model ?? DEFAULT_MODEL2;
|
|
342
343
|
this.device = opts.device ?? "auto";
|
|
343
|
-
this.dtype = opts.dtype ?? "
|
|
344
|
+
this.dtype = opts.dtype ?? "auto";
|
|
344
345
|
this.aggregationStrategy = opts.aggregationStrategy ?? "simple";
|
|
345
346
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS;
|
|
346
347
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS;
|
|
@@ -352,8 +353,14 @@ class LocalDetector {
|
|
|
352
353
|
if (opts.pipelineInstance) {
|
|
353
354
|
this._pipeline = opts.pipelineInstance;
|
|
354
355
|
this.actualDevice = this.device === "auto" ? null : this.device;
|
|
356
|
+
this.actualDtype = this.dtype === "auto" ? null : this.dtype;
|
|
355
357
|
}
|
|
356
358
|
}
|
|
359
|
+
_resolveDtype(device) {
|
|
360
|
+
if (this.dtype !== "auto")
|
|
361
|
+
return this.dtype;
|
|
362
|
+
return device === "webgpu" ? "fp16" : "q8";
|
|
363
|
+
}
|
|
357
364
|
async load() {
|
|
358
365
|
if (this._pipeline)
|
|
359
366
|
return this._pipeline;
|
|
@@ -365,14 +372,16 @@ class LocalDetector {
|
|
|
365
372
|
let lastErr;
|
|
366
373
|
for (let i = 0;i < sequence.length; i++) {
|
|
367
374
|
const dev = sequence[i] ?? "wasm";
|
|
375
|
+
const resolvedDtype = this._resolveDtype(dev);
|
|
368
376
|
try {
|
|
369
377
|
const pipe = await mod.pipeline("token-classification", this.model, {
|
|
370
378
|
device: dev,
|
|
371
|
-
dtype:
|
|
379
|
+
dtype: resolvedDtype,
|
|
372
380
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, dev) : undefined
|
|
373
381
|
});
|
|
374
382
|
this._pipeline = pipe;
|
|
375
383
|
this.actualDevice = dev;
|
|
384
|
+
this.actualDtype = resolvedDtype;
|
|
376
385
|
return pipe;
|
|
377
386
|
} catch (e) {
|
|
378
387
|
lastErr = e;
|
|
@@ -388,6 +397,7 @@ class LocalDetector {
|
|
|
388
397
|
async _planDeviceSequence() {
|
|
389
398
|
if (this.device !== "auto")
|
|
390
399
|
return [this.device];
|
|
400
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
391
401
|
const seq = [];
|
|
392
402
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
393
403
|
if (nav?.gpu?.requestAdapter) {
|
|
@@ -397,7 +407,7 @@ class LocalDetector {
|
|
|
397
407
|
seq.push("webgpu");
|
|
398
408
|
} catch {}
|
|
399
409
|
}
|
|
400
|
-
seq.push("wasm");
|
|
410
|
+
seq.push(isBrowser ? "wasm" : "cpu");
|
|
401
411
|
return seq;
|
|
402
412
|
}
|
|
403
413
|
_emitProgress(raw, device) {
|
|
@@ -829,6 +839,7 @@ class CalibratedDetector {
|
|
|
829
839
|
chunkOverlapTokens;
|
|
830
840
|
trimWhitespace;
|
|
831
841
|
actualDevice = null;
|
|
842
|
+
actualDtype = null;
|
|
832
843
|
_model = null;
|
|
833
844
|
_tokenizer = null;
|
|
834
845
|
_id2label = {};
|
|
@@ -839,7 +850,7 @@ class CalibratedDetector {
|
|
|
839
850
|
this.model = opts.model ?? DEFAULT_MODEL3;
|
|
840
851
|
this.oBias = opts.oBias ?? 0.5;
|
|
841
852
|
this.device = opts.device ?? "auto";
|
|
842
|
-
this.dtype = opts.dtype ?? "
|
|
853
|
+
this.dtype = opts.dtype ?? "auto";
|
|
843
854
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS2;
|
|
844
855
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS2;
|
|
845
856
|
this.trimWhitespace = opts.trimWhitespace ?? true;
|
|
@@ -857,8 +868,9 @@ class CalibratedDetector {
|
|
|
857
868
|
const mod = await loadTransformersJs2();
|
|
858
869
|
let preferredDevice = this.device;
|
|
859
870
|
if (this.device === "auto") {
|
|
871
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
860
872
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
861
|
-
preferredDevice = "wasm";
|
|
873
|
+
preferredDevice = isBrowser ? "wasm" : "cpu";
|
|
862
874
|
if (nav?.gpu?.requestAdapter) {
|
|
863
875
|
try {
|
|
864
876
|
const adapter = await nav.gpu.requestAdapter();
|
|
@@ -867,14 +879,16 @@ class CalibratedDetector {
|
|
|
867
879
|
} catch {}
|
|
868
880
|
}
|
|
869
881
|
}
|
|
882
|
+
const resolvedDtype = this.dtype === "auto" ? preferredDevice === "webgpu" ? "fp16" : "q8" : this.dtype;
|
|
870
883
|
const tokenizer = await mod.AutoTokenizer.from_pretrained(this.model);
|
|
871
884
|
const model = await mod.AutoModelForTokenClassification.from_pretrained(this.model, {
|
|
872
885
|
device: preferredDevice,
|
|
873
|
-
dtype:
|
|
886
|
+
dtype: resolvedDtype,
|
|
874
887
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, preferredDevice) : undefined
|
|
875
888
|
});
|
|
876
889
|
this._tokenizer = tokenizer;
|
|
877
890
|
this._model = model;
|
|
891
|
+
this.actualDtype = resolvedDtype;
|
|
878
892
|
this._id2label = model.config.id2label;
|
|
879
893
|
const label2id = model.config.label2id;
|
|
880
894
|
this._oId = label2id?.["O"] ?? 0;
|
package/dist/esm/openai/index.js
CHANGED
|
@@ -234,13 +234,14 @@ class LocalDetector {
|
|
|
234
234
|
chunkOverlapTokens;
|
|
235
235
|
batchSize;
|
|
236
236
|
actualDevice = null;
|
|
237
|
+
actualDtype = null;
|
|
237
238
|
_pipeline = null;
|
|
238
239
|
_loadPromise = null;
|
|
239
240
|
_onProgress;
|
|
240
241
|
constructor(opts = {}) {
|
|
241
242
|
this.model = opts.model ?? DEFAULT_MODEL2;
|
|
242
243
|
this.device = opts.device ?? "auto";
|
|
243
|
-
this.dtype = opts.dtype ?? "
|
|
244
|
+
this.dtype = opts.dtype ?? "auto";
|
|
244
245
|
this.aggregationStrategy = opts.aggregationStrategy ?? "simple";
|
|
245
246
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS;
|
|
246
247
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS;
|
|
@@ -252,8 +253,14 @@ class LocalDetector {
|
|
|
252
253
|
if (opts.pipelineInstance) {
|
|
253
254
|
this._pipeline = opts.pipelineInstance;
|
|
254
255
|
this.actualDevice = this.device === "auto" ? null : this.device;
|
|
256
|
+
this.actualDtype = this.dtype === "auto" ? null : this.dtype;
|
|
255
257
|
}
|
|
256
258
|
}
|
|
259
|
+
_resolveDtype(device) {
|
|
260
|
+
if (this.dtype !== "auto")
|
|
261
|
+
return this.dtype;
|
|
262
|
+
return device === "webgpu" ? "fp16" : "q8";
|
|
263
|
+
}
|
|
257
264
|
async load() {
|
|
258
265
|
if (this._pipeline)
|
|
259
266
|
return this._pipeline;
|
|
@@ -265,14 +272,16 @@ class LocalDetector {
|
|
|
265
272
|
let lastErr;
|
|
266
273
|
for (let i = 0;i < sequence.length; i++) {
|
|
267
274
|
const dev = sequence[i] ?? "wasm";
|
|
275
|
+
const resolvedDtype = this._resolveDtype(dev);
|
|
268
276
|
try {
|
|
269
277
|
const pipe = await mod.pipeline("token-classification", this.model, {
|
|
270
278
|
device: dev,
|
|
271
|
-
dtype:
|
|
279
|
+
dtype: resolvedDtype,
|
|
272
280
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, dev) : undefined
|
|
273
281
|
});
|
|
274
282
|
this._pipeline = pipe;
|
|
275
283
|
this.actualDevice = dev;
|
|
284
|
+
this.actualDtype = resolvedDtype;
|
|
276
285
|
return pipe;
|
|
277
286
|
} catch (e) {
|
|
278
287
|
lastErr = e;
|
|
@@ -288,6 +297,7 @@ class LocalDetector {
|
|
|
288
297
|
async _planDeviceSequence() {
|
|
289
298
|
if (this.device !== "auto")
|
|
290
299
|
return [this.device];
|
|
300
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
291
301
|
const seq = [];
|
|
292
302
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
293
303
|
if (nav?.gpu?.requestAdapter) {
|
|
@@ -297,7 +307,7 @@ class LocalDetector {
|
|
|
297
307
|
seq.push("webgpu");
|
|
298
308
|
} catch {}
|
|
299
309
|
}
|
|
300
|
-
seq.push("wasm");
|
|
310
|
+
seq.push(isBrowser ? "wasm" : "cpu");
|
|
301
311
|
return seq;
|
|
302
312
|
}
|
|
303
313
|
_emitProgress(raw, device) {
|
|
@@ -729,6 +739,7 @@ class CalibratedDetector {
|
|
|
729
739
|
chunkOverlapTokens;
|
|
730
740
|
trimWhitespace;
|
|
731
741
|
actualDevice = null;
|
|
742
|
+
actualDtype = null;
|
|
732
743
|
_model = null;
|
|
733
744
|
_tokenizer = null;
|
|
734
745
|
_id2label = {};
|
|
@@ -739,7 +750,7 @@ class CalibratedDetector {
|
|
|
739
750
|
this.model = opts.model ?? DEFAULT_MODEL3;
|
|
740
751
|
this.oBias = opts.oBias ?? 0.5;
|
|
741
752
|
this.device = opts.device ?? "auto";
|
|
742
|
-
this.dtype = opts.dtype ?? "
|
|
753
|
+
this.dtype = opts.dtype ?? "auto";
|
|
743
754
|
this.chunkTokens = opts.chunkTokens ?? DEFAULT_CHUNK_TOKENS2;
|
|
744
755
|
this.chunkOverlapTokens = opts.chunkOverlapTokens ?? DEFAULT_OVERLAP_TOKENS2;
|
|
745
756
|
this.trimWhitespace = opts.trimWhitespace ?? true;
|
|
@@ -757,8 +768,9 @@ class CalibratedDetector {
|
|
|
757
768
|
const mod = await loadTransformersJs2();
|
|
758
769
|
let preferredDevice = this.device;
|
|
759
770
|
if (this.device === "auto") {
|
|
771
|
+
const isBrowser = typeof globalThis.window !== "undefined";
|
|
760
772
|
const nav = typeof navigator !== "undefined" ? navigator : null;
|
|
761
|
-
preferredDevice = "wasm";
|
|
773
|
+
preferredDevice = isBrowser ? "wasm" : "cpu";
|
|
762
774
|
if (nav?.gpu?.requestAdapter) {
|
|
763
775
|
try {
|
|
764
776
|
const adapter = await nav.gpu.requestAdapter();
|
|
@@ -767,14 +779,16 @@ class CalibratedDetector {
|
|
|
767
779
|
} catch {}
|
|
768
780
|
}
|
|
769
781
|
}
|
|
782
|
+
const resolvedDtype = this.dtype === "auto" ? preferredDevice === "webgpu" ? "fp16" : "q8" : this.dtype;
|
|
770
783
|
const tokenizer = await mod.AutoTokenizer.from_pretrained(this.model);
|
|
771
784
|
const model = await mod.AutoModelForTokenClassification.from_pretrained(this.model, {
|
|
772
785
|
device: preferredDevice,
|
|
773
|
-
dtype:
|
|
786
|
+
dtype: resolvedDtype,
|
|
774
787
|
progress_callback: this._onProgress ? (raw) => this._emitProgress(raw, preferredDevice) : undefined
|
|
775
788
|
});
|
|
776
789
|
this._tokenizer = tokenizer;
|
|
777
790
|
this._model = model;
|
|
791
|
+
this.actualDtype = resolvedDtype;
|
|
778
792
|
this._id2label = model.config.id2label;
|
|
779
793
|
const label2id = model.config.label2id;
|
|
780
794
|
this._oId = label2id?.["O"] ?? 0;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Calibrated detector —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Calibrated detector — subtracts a constant `oBias` from the O-class
|
|
3
|
+
* logit before argmax. Originally introduced to recover the v1 model's
|
|
4
|
+
* "single-category mode" pathology (Müller + IBAN co-occurrence flipped
|
|
5
|
+
* the person prediction to O); the v3 / gheim-ch-560m training pipeline
|
|
6
|
+
* largely resolved that pathology, but the calibration still buys a
|
|
7
|
+
* small precision/recall improvement and remains the default.
|
|
5
8
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* additive bias on O flips those marginal cases without inducing false
|
|
11
|
-
* positives on PII-free text.
|
|
9
|
+
* Sweep on gheim-ch-560m (see eval/calibration_sweep.json):
|
|
10
|
+
* `oBias=0.5` is the Pareto-clean default — probe perfect-rate is flat
|
|
11
|
+
* at 91.5% across bias 0.0 and 0.5, and test char-F1 lifts by 0.27pp.
|
|
12
|
+
* Higher biases (1.0–1.5) trade test F1 for marginal probe gains.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* A separate sweep on the int8 ONNX path via `transformers.js`
|
|
15
|
+
* (eval/calibration_sweep_q8.json) showed a much larger calibration
|
|
16
|
+
* effect (+1.4pp probe, +0.43pp char-F1 at 0.5). That gap is not a
|
|
17
|
+
* property of the int8 quantisation — Python `onnxruntime` on the same
|
|
18
|
+
* int8 file gives 91.0% probe perfect-rate, essentially fp32-equivalent
|
|
19
|
+
* — but of a runtime divergence inside `onnxruntime-web` / WASM that
|
|
20
|
+
* the calibration partially papers over. The reliable fix is to use the
|
|
21
|
+
* `model_fp16.onnx` variant when WebGPU is available (which is what
|
|
22
|
+
* LocalDetector's default `dtype: "auto"` does); int8 should be treated
|
|
23
|
+
* as a low-RAM fallback. See eval/q8_quality_report.md for the
|
|
24
|
+
* diagnostic.
|
|
17
25
|
*
|
|
18
26
|
* `defaultDetector()` returns this with oBias=0.5, so users get the
|
|
19
27
|
* better behavior automatically.
|
|
@@ -26,14 +34,13 @@ export interface CalibratedDetectorOptions {
|
|
|
26
34
|
model?: string;
|
|
27
35
|
/**
|
|
28
36
|
* Constant subtracted from the O-class logit before argmax. Default
|
|
29
|
-
* `0.5` is the Pareto-clean point
|
|
30
|
-
* (eval/calibration_sweep.json):
|
|
37
|
+
* `0.5` is the Pareto-clean point on the reference (fp32/fp16) path:
|
|
31
38
|
*
|
|
32
39
|
* - oBias=0.0 uncalibrated (matches the raw model)
|
|
33
|
-
* - oBias=0.5
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
40
|
+
* - oBias=0.5 +0.27pp test char-F1, no probe cost (91.5% perfect)
|
|
41
|
+
* - oBias=1.0+ marginal probe gains, test F1 starts to fall off
|
|
42
|
+
*
|
|
43
|
+
* See eval/calibration_sweep.json.
|
|
37
44
|
*/
|
|
38
45
|
oBias?: number;
|
|
39
46
|
/** Backend selector. See {@link LocalDetectorOptions.device}. */
|
|
@@ -60,6 +67,9 @@ export declare class CalibratedDetector implements Detector {
|
|
|
60
67
|
readonly trimWhitespace: boolean;
|
|
61
68
|
/** Backend actually used after `load()` resolves; `null` before. */
|
|
62
69
|
actualDevice: string | null;
|
|
70
|
+
/** Dtype actually used after `load()` resolves; `null` before. Differs
|
|
71
|
+
* from {@link dtype} only when `dtype: "auto"` was requested. */
|
|
72
|
+
actualDtype: string | null;
|
|
63
73
|
private _model;
|
|
64
74
|
private _tokenizer;
|
|
65
75
|
private _id2label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calibrated.d.ts","sourceRoot":"","sources":["../../../src/detectors/calibrated.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"calibrated.d.ts","sourceRoot":"","sources":["../../../src/detectors/calibrated.ts"],"names":[],"m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IAC/C,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAA0C;gBAE3D,IAAI,GAAE,yBAA8B;IAiB1C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAoDrB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;YAYxD,cAAc;YA0Bd,aAAa;IA6F3B,OAAO,CAAC,aAAa;CAiBtB"}
|
|
@@ -11,8 +11,8 @@ import type { Detector } from "./base.ts";
|
|
|
11
11
|
/** Pick a reasonable default: remote when `GHEIM_API_KEY` is set in env,
|
|
12
12
|
* else a calibrated local model.
|
|
13
13
|
*
|
|
14
|
-
* The calibrated default (`oBias=0.5`)
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* The calibrated default (`oBias=0.5`) is Pareto-clean on gheim-ch-560m:
|
|
15
|
+
* +0.27pp test char-F1 with no probe cost (91.5% perfect at both 0.0
|
|
16
|
+
* and 0.5). See eval/calibration_sweep.json. */
|
|
17
17
|
export declare function defaultDetector(): Detector;
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,aAAa,IAAI,oBAAoB,EACrC,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,aAAa,IAAI,oBAAoB,EACrC,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C;;;;;iDAKiD;AACjD,wBAAgB,eAAe,IAAI,QAAQ,CAI1C"}
|
|
@@ -29,7 +29,15 @@ export interface LocalDetectorOptions {
|
|
|
29
29
|
* (no probe, no fallback — your choice is respected and may throw).
|
|
30
30
|
*/
|
|
31
31
|
device?: string;
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Quantization dtype: `"fp32" | "fp16" | "q8" | "q4" | "auto"`. Defaults
|
|
34
|
+
* to `"auto"`, which picks based on the resolved backend: `"fp16"` when
|
|
35
|
+
* WebGPU was selected (large but byte-equivalent to fp32 on the forensic
|
|
36
|
+
* probe), `"q8"` otherwise (~550 MB; safe everywhere, but degrades on
|
|
37
|
+
* the `onnxruntime-web` WASM kernel on Swiss edge cases — see
|
|
38
|
+
* eval/q8_quality_report.md). Set explicitly to opt out of this
|
|
39
|
+
* trade-off.
|
|
40
|
+
*/
|
|
33
41
|
dtype?: string;
|
|
34
42
|
/** Aggregation strategy passed to the pipeline call. */
|
|
35
43
|
aggregationStrategy?: string;
|
|
@@ -98,10 +106,21 @@ export declare class LocalDetector implements Detector {
|
|
|
98
106
|
* the model is loaded. Different from {@link device} only when
|
|
99
107
|
* `device: "auto"` was requested. */
|
|
100
108
|
actualDevice: string | null;
|
|
109
|
+
/** Dtype that ended up being used after `load()` resolves. `null` until
|
|
110
|
+
* the model is loaded. Different from {@link dtype} only when
|
|
111
|
+
* `dtype: "auto"` was requested — in that case it resolves to `"fp16"`
|
|
112
|
+
* on WebGPU and `"q8"` everywhere else. */
|
|
113
|
+
actualDtype: string | null;
|
|
101
114
|
private _pipeline;
|
|
102
115
|
private _loadPromise;
|
|
103
116
|
private readonly _onProgress?;
|
|
104
117
|
constructor(opts?: LocalDetectorOptions);
|
|
118
|
+
/** Resolve `dtype: "auto"` for a concrete device: fp16 on WebGPU (byte-
|
|
119
|
+
* equivalent to fp32 on the forensic probe), q8 on WASM/CPU. The
|
|
120
|
+
* WASM-q8 path is known to degrade on Swiss edge cases via
|
|
121
|
+
* `onnxruntime-web`, but it's the small-file fallback for low-RAM
|
|
122
|
+
* contexts where WebGPU isn't available. Explicit dtype passes through. */
|
|
123
|
+
private _resolveDtype;
|
|
105
124
|
/**
|
|
106
125
|
* Load the model. Idempotent; concurrent calls share a single load.
|
|
107
126
|
* With `device: "auto"`, probes `navigator.gpu.requestAdapter()` and
|
|
@@ -109,7 +128,15 @@ export declare class LocalDetector implements Detector {
|
|
|
109
128
|
* if construction throws (and reporting both attempts via `onProgress`).
|
|
110
129
|
*/
|
|
111
130
|
load(): Promise<PipelineCallable>;
|
|
112
|
-
/** Build the ordered list of backends to attempt.
|
|
131
|
+
/** Build the ordered list of backends to attempt.
|
|
132
|
+
*
|
|
133
|
+
* In a browser we try WebGPU (if a real adapter is reachable) and fall
|
|
134
|
+
* back to WASM. In Node, transformers.js uses onnxruntime-node, which
|
|
135
|
+
* speaks "cpu" / "cuda" / "webgpu" — never "wasm" — so the fallback
|
|
136
|
+
* has to be "cpu" instead. We detect "browser-ness" via `typeof window`;
|
|
137
|
+
* Node 21+ now ships a global `navigator`, so that's no longer a
|
|
138
|
+
* reliable discriminator on its own.
|
|
139
|
+
*/
|
|
113
140
|
private _planDeviceSequence;
|
|
114
141
|
/** Translate a raw transformers.js progress callback into our normalized event. */
|
|
115
142
|
private _emitProgress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/detectors/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEhD,eAAO,MAAM,aAAa,iCAAiC,CAAC;AAQ5D,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/detectors/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEhD,eAAO,MAAM,aAAa,iCAAiC,CAAC;AAQ5D,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gheim",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "PII round-trip for LLM APIs: anonymize before the request, de-anonymize the stream on the way back.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Joel Barmettler <joel.barmettler@gmail.com>",
|