nisten commited on
Commit
fbfed4d
·
verified ·
1 Parent(s): 23f231e

Update src/worker.js

Browse files
Files changed (1) hide show
  1. src/worker.js +4 -5
src/worker.js CHANGED
@@ -29,7 +29,7 @@ import {
29
  const model_id = "onnx-community/Kokoro-82M-v1.0-ONNX";
30
  let voice;
31
  const tts = await KokoroTTS.from_pretrained(model_id, {
32
- dtype: "fp16",
33
  device: "webgpu",
34
  });
35
 
@@ -78,17 +78,16 @@ const transcriber = await pipeline(
78
  await transcriber(new Float32Array(INPUT_SAMPLE_RATE)); // Compile shaders
79
 
80
  const llm_model_id = "onnx-community/Qwen3-1.7B-ONNX";
81
- const tokenizer = await AutoTokenizer.from_pretrained("Qwen/Qwen3-1.7B"); // Load tokenizer from original repo
82
  const llm = await AutoModelForCausalLM.from_pretrained(llm_model_id, {
83
- dtype: "q4f16", // This alone should make it pick model_q4f16.onnx
84
  device: "webgpu",
85
- // Don't specify model_file_name - let Transformers.js construct the path
86
  });
87
 
88
  const SYSTEM_MESSAGE = {
89
  role: "system",
90
  content:
91
- "You're a helpful and conversational voice assistant for financial managers, you have a high EQ and are great at math and behavioral finance. Keep your responses short, clear, and casual. /no_think",
92
  };
93
  await llm.generate({ ...tokenizer("x"), max_new_tokens: 1 }); // Compile shaders
94
 
 
29
  const model_id = "onnx-community/Kokoro-82M-v1.0-ONNX";
30
  let voice;
31
  const tts = await KokoroTTS.from_pretrained(model_id, {
32
+ dtype: "fp32",
33
  device: "webgpu",
34
  });
35
 
 
78
  await transcriber(new Float32Array(INPUT_SAMPLE_RATE)); // Compile shaders
79
 
80
  const llm_model_id = "onnx-community/Qwen3-1.7B-ONNX";
81
+ const tokenizer = await AutoTokenizer.from_pretrained(llm_model_id);
82
  const llm = await AutoModelForCausalLM.from_pretrained(llm_model_id, {
83
+ dtype: "q4f16",
84
  device: "webgpu",
 
85
  });
86
 
87
  const SYSTEM_MESSAGE = {
88
  role: "system",
89
  content:
90
+ "You're a helpful and conversational voice assistant. Keep your responses short, clear, and casual.",
91
  };
92
  await llm.generate({ ...tokenizer("x"), max_new_tokens: 1 }); // Compile shaders
93