pdufour commited on
Commit
44a6e1e
1 Parent(s): 104dfa1

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +1 -11
index.js CHANGED
@@ -19,7 +19,7 @@ const fileUpload = document.getElementById('upload');
19
  const imageContainer = document.getElementById('container');
20
  const example = document.getElementById('example');
21
 
22
- let ortSessionA, ortSessionB, ortSessionC;
23
  let config;
24
 
25
  async function initializeSessions() {
@@ -29,19 +29,16 @@ async function initializeSessions() {
29
  await getModelFile(ONNX_MODEL, `onnx/QwenVL_A_${QUANT}.onnx`),
30
  { executionProviders: ["webgpu"] }
31
  );
32
- console.log({ortSessionA});
33
 
34
  ortSessionB = await ort.InferenceSession.create(
35
  await getModelFile(ONNX_MODEL, `onnx/QwenVL_B_${QUANT}.onnx`),
36
  { executionProviders: ["webgpu"] }
37
  );
38
- console.log({ortSessionB});
39
 
40
  ortSessionC = await ort.InferenceSession.create(
41
  await getModelFile(ONNX_MODEL, `onnx/QwenVL_C_${QUANT}.onnx`),
42
  { executionProviders: ["webgpu"] }
43
  );
44
- console.log({ortSessionC});
45
 
46
  config = (await getModelJSON(BASE_MODEL, "config.json"));
47
 
@@ -77,7 +74,6 @@ export async function imageTextToText(
77
  query,
78
  vision = true
79
  ) {
80
- let ortSessionA, ortSessionB, ortSessionC, ortSessionD, ortSessionE;
81
 
82
  const prompt_head_len = new Tensor("int64", new BigInt64Array([5n]), [1]);
83
 
@@ -136,12 +132,6 @@ export async function imageTextToText(
136
 
137
  const dummy = new ort.Tensor("int32", new Int32Array([0]), []);
138
 
139
- if (!ortSessionB) {
140
- await ort.InferenceSession.create(
141
- await getModelFile(ONNX_MODEL, `onnx/QwenVL_B_${QUANT}.onnx`),
142
- { executionProviders: ["webgpu"] }
143
- );
144
- }
145
  let { hidden_states } = await ortSessionB.run({
146
  input_ids: input_ids,
147
  ids_len: ids_len,
 
19
  const imageContainer = document.getElementById('container');
20
  const example = document.getElementById('example');
21
 
22
+ let ortSessionA, ortSessionB, ortSessionC, ortSessionD, ortSessionE;
23
  let config;
24
 
25
  async function initializeSessions() {
 
29
  await getModelFile(ONNX_MODEL, `onnx/QwenVL_A_${QUANT}.onnx`),
30
  { executionProviders: ["webgpu"] }
31
  );
 
32
 
33
  ortSessionB = await ort.InferenceSession.create(
34
  await getModelFile(ONNX_MODEL, `onnx/QwenVL_B_${QUANT}.onnx`),
35
  { executionProviders: ["webgpu"] }
36
  );
 
37
 
38
  ortSessionC = await ort.InferenceSession.create(
39
  await getModelFile(ONNX_MODEL, `onnx/QwenVL_C_${QUANT}.onnx`),
40
  { executionProviders: ["webgpu"] }
41
  );
 
42
 
43
  config = (await getModelJSON(BASE_MODEL, "config.json"));
44
 
 
74
  query,
75
  vision = true
76
  ) {
 
77
 
78
  const prompt_head_len = new Tensor("int64", new BigInt64Array([5n]), [1]);
79
 
 
132
 
133
  const dummy = new ort.Tensor("int32", new Int32Array([0]), []);
134
 
 
 
 
 
 
 
135
  let { hidden_states } = await ortSessionB.run({
136
  input_ids: input_ids,
137
  ids_len: ids_len,