Sync from GitHub e182787
Browse files- frontend/index.html +15 -1
frontend/index.html
CHANGED
|
@@ -790,11 +790,25 @@ function repairGuy() {
|
|
| 790 |
// cache. We ship ONLY the q8 files (verified MatMulNBits-free), so there
|
| 791 |
// is no q4 to pick, no hub round-trip, and no cached-q4 ghost. dtype is
|
| 792 |
// a single string (applied to every session); device defaults to wasm.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 793 |
const { pipeline, env } = await import('https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.2.0');
|
| 794 |
env.allowRemoteModels = false; // never touch the hub — local files only
|
| 795 |
env.allowLocalModels = true;
|
| 796 |
env.localModelPath = '/vendor/'; // model id is appended → /vendor/moonshine-tiny-ONNX/…
|
| 797 |
-
this.asr = await pipeline('automatic-speech-recognition', 'moonshine-tiny-ONNX', {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
|
| 799 |
// 3) the mic: Silero VAD segments speech; onSpeechEnd is our send trigger
|
| 800 |
this.vad = await window.vad.MicVAD.new({
|
|
|
|
| 790 |
// cache. We ship ONLY the q8 files (verified MatMulNBits-free), so there
|
| 791 |
// is no q4 to pick, no hub round-trip, and no cached-q4 ghost. dtype is
|
| 792 |
// a single string (applied to every session); device defaults to wasm.
|
| 793 |
+
//
|
| 794 |
+
// graphOptimizationLevel:'disabled' is the load-bearing fix. The q8
|
| 795 |
+
// decoder ships embed_tokens.weight as a DequantizeLinear weight that
|
| 796 |
+
// is TIED (reused as the LM-head MatMul). At session creation ORT's
|
| 797 |
+
// extended-level QDQ pass (TransposeDQWeightsForMatMulNBits) tries to
|
| 798 |
+
// transpose+fuse that DQ weight into a MatMulNBits op; the transpose
|
| 799 |
+
// renames the node to …weight_transposed_DequantizeLinear but the scale
|
| 800 |
+
// is still …weight_merged_0_scale, the two no longer match, and create()
|
| 801 |
+
// aborts with "Missing required scale". The model is fine — the fusion
|
| 802 |
+
// is the bug — so we just turn the optimizer off (DQ runs natively).
|
| 803 |
const { pipeline, env } = await import('https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.2.0');
|
| 804 |
env.allowRemoteModels = false; // never touch the hub — local files only
|
| 805 |
env.allowLocalModels = true;
|
| 806 |
env.localModelPath = '/vendor/'; // model id is appended → /vendor/moonshine-tiny-ONNX/…
|
| 807 |
+
this.asr = await pipeline('automatic-speech-recognition', 'moonshine-tiny-ONNX', {
|
| 808 |
+
dtype: 'q8',
|
| 809 |
+
device: 'wasm',
|
| 810 |
+
session_options: { graphOptimizationLevel: 'disabled' },
|
| 811 |
+
});
|
| 812 |
|
| 813 |
// 3) the mic: Silero VAD segments speech; onSpeechEnd is our send trigger
|
| 814 |
this.vad = await window.vad.MicVAD.new({
|