pdufour commited on
Commit
ce93a2e
1 Parent(s): e4c5511

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +16 -17
index.js CHANGED
@@ -46,6 +46,21 @@ async function initializeSessions() {
46
  { executionProviders: ["webgpu"] }
47
  );
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  config = (await getModelJSON(BASE_MODEL, "config.json"));
50
 
51
  status.textContent = 'Ready';
@@ -235,14 +250,7 @@ export async function imageTextToText(
235
 
236
  await ortSessionA.release();
237
  ortSessionA = null;
238
-
239
- ortSessionD = await ort.InferenceSession.create(
240
- await getModelFile(ONNX_MODEL, `onnx/QwenVL_D_${QUANT}.onnx`),
241
- {
242
- executionProviders: ["webgpu"],
243
- }
244
- );
245
-
246
  ({ hidden_states, position_ids } = await ortSessionD.run({
247
  "hidden_states.1": hidden_states,
248
  image_embed,
@@ -263,15 +271,6 @@ export async function imageTextToText(
263
  ) {
264
  let token_id;
265
 
266
- if (!ortSessionE) {
267
- ortSessionE = await ort.InferenceSession.create(
268
- await getModelFile(ONNX_MODEL, `onnx/QwenVL_E_${QUANT}.onnx`),
269
- {
270
- executionProviders: ["wasm"],
271
- },
272
- );
273
- }
274
-
275
  ({
276
  max_logit_ids: token_id,
277
  past_key_states: past_key_states,
 
46
  { executionProviders: ["webgpu"] }
47
  );
48
 
49
+ ortSessionD = await ort.InferenceSession.create(
50
+ await getModelFile(ONNX_MODEL, `onnx/QwenVL_D_${QUANT}.onnx`),
51
+ {
52
+ executionProviders: ["webgpu"],
53
+ }
54
+
55
+ ortSessionE = await ort.InferenceSession.create(
56
+ await getModelFile(ONNX_MODEL, `onnx/QwenVL_E_${QUANT}.onnx`),
57
+ {
58
+ executionProviders: ["wasm"],
59
+ },
60
+ );
61
+ );
62
+
63
+
64
  config = (await getModelJSON(BASE_MODEL, "config.json"));
65
 
66
  status.textContent = 'Ready';
 
250
 
251
  await ortSessionA.release();
252
  ortSessionA = null;
253
+
 
 
 
 
 
 
 
254
  ({ hidden_states, position_ids } = await ortSessionD.run({
255
  "hidden_states.1": hidden_states,
256
  image_embed,
 
271
  ) {
272
  let token_id;
273
 
 
 
 
 
 
 
 
 
 
274
  ({
275
  max_logit_ids: token_id,
276
  past_key_states: past_key_states,