diff --git a/src/lib/assets/js/ort_utils.js b/src/lib/assets/js/ort_utils.js index cc4f99e..a7134b9 100644 --- a/src/lib/assets/js/ort_utils.js +++ b/src/lib/assets/js/ort_utils.js @@ -275,12 +275,12 @@ const main = async (_id, _model, _modelType, _dataType, _backend) => { l(options.executionProviders) addResult(_model, _modelType, _dataType, _backend, 2, 0, [], 0); - updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Testing ${_model} (${_modelType}/${_dataType}) with ${backend} backend`); + updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Testing ${_model} (${_modelType}/${_dataType}) with ${_backend} backend`); updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Creating onnx runtime web inference session`); updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Downloading model from ${modelPath}`); const sess = await ort.InferenceSession.create(modelPath, options); - updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Warming up ...`); + updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Warming up`); let feeds = clone(getFeeds(_model, _dataType)); let warmupTime = 0; @@ -307,7 +307,7 @@ const main = async (_id, _model, _modelType, _dataType, _backend) => { updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Inference Time (Median): ${inferenceTimesMedian} ms`); await sess.release(); - updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Test ${_model} (${_modelType}/${_dataType}) with ${backend} backend completed`); + updateInfo(`${testQueueLength - testQueue.length + 1}/${testQueueLength} Test ${_model} (${_modelType}/${_dataType}) with ${_backend} backend completed`); } } diff --git a/src/lib/components/ConfigBackends.svelte b/src/lib/components/ConfigBackends.svelte index ca3c36f..0c37e3a 100644 --- a/src/lib/components/ConfigBackends.svelte +++ b/src/lib/components/ConfigBackends.svelte @@ -1,16 +1,24 @@ diff --git a/src/lib/components/ConfigDataTypes.svelte b/src/lib/components/ConfigDataTypes.svelte index b711e93..b7d8541 100644 --- a/src/lib/components/ConfigDataTypes.svelte +++ b/src/lib/components/ConfigDataTypes.svelte @@ -3,13 +3,23 @@ trimComma, arrayToStringWithComma, getURLParameterValue, - selectedDataTypes, getUniqueDataTypesByModelId, goTo, stringToArray, getModelIdfromPath } from '$lib/assets/js/utils'; - import { beforeUpdate, afterUpdate } from 'svelte'; + // import { dataTypesStore } from '$lib/store/store'; + import { beforeUpdate, onMount } from 'svelte'; + + // /** + // * @type {string[]} + // */ + // let selectedDataTypes; + // dataTypesStore.subscribe((value) => { + // selectedDataTypes = value; + // }); + + let dataTypesFromUrl; /** * @type {any} @@ -94,10 +104,27 @@ } }); - afterUpdate(() => { - for (const datatype of selectedDataTypes) { - dataTypes[datatype].selected = true; + const highlightDataTypes = () => { + dataTypesFromUrl = getURLParameterValue('datatype')?.toLocaleLowerCase().trim(); + dataTypesFromUrl = decodeURIComponent(dataTypesFromUrl); + dataTypesFromUrl = dataTypesFromUrl?.replaceAll('undefined', ''); + dataTypesFromUrl = trimComma(dataTypesFromUrl); + + if (dataTypesFromUrl === 'all') { + dataTypesFromUrl = ['fp32', 'fp16', 'int8']; + } else { + dataTypesFromUrl = stringToArray(dataTypesFromUrl); } + + if (dataTypesFromUrl.length > 0) { + for (const datatype of dataTypesFromUrl) { + dataTypes[datatype] = true; + } + } + }; + + onMount(() => { + highlightDataTypes(); }); diff --git a/src/lib/components/ConfigModelTypes.svelte b/src/lib/components/ConfigModelTypes.svelte index 4485c4e..0da340c 100644 --- a/src/lib/components/ConfigModelTypes.svelte +++ b/src/lib/components/ConfigModelTypes.svelte @@ -3,13 +3,23 @@ trimComma, arrayToStringWithComma, getURLParameterValue, - selectedModelTypes, getUniqueModelTypesByModelId, goTo, stringToArray, getModelIdfromPath } from '$lib/assets/js/utils'; - import { beforeUpdate, afterUpdate } from 'svelte'; + // import { modelTypesStore } from '$lib/store/store'; + import { beforeUpdate, onMount } from 'svelte'; + + let modelTypesFromUrl; + + // /** + // * @type {string[]} + // */ + // let selectedModelTypes; + // modelTypesStore.subscribe((value) => { + // selectedModelTypes = value; + // }); /** * @type {any} @@ -96,10 +106,27 @@ } }); - afterUpdate(() => { - for (const modeltype of selectedModelTypes) { - modelTypes[modeltype].selected = true; + const highlightModelTypes = () => { + modelTypesFromUrl = getURLParameterValue('modeltype')?.toLocaleLowerCase().trim(); + modelTypesFromUrl = decodeURIComponent(modelTypesFromUrl); + modelTypesFromUrl = modelTypesFromUrl?.replaceAll('undefined', ''); + modelTypesFromUrl = trimComma(modelTypesFromUrl); + + if (modelTypesFromUrl === 'all') { + modelTypesFromUrl = ['onnx', 'tflite', 'npy', 'pt']; + } else { + modelTypesFromUrl = stringToArray(modelTypesFromUrl); } + + if (modelTypesFromUrl.length > 0) { + for (const modeltype of modelTypesFromUrl) { + modelTypes[modeltype] = true; + } + } + }; + + onMount(() => { + highlightModelTypes(); }); diff --git a/src/lib/components/ConfigModels.svelte b/src/lib/components/ConfigModels.svelte index 4993408..82b37b0 100644 --- a/src/lib/components/ConfigModels.svelte +++ b/src/lib/components/ConfigModels.svelte @@ -8,12 +8,11 @@ getURLParameterValue, getUniqueDataTypes, getUniqueModelTypes, - selectedModels, goTo, stringToArray } from '$lib/assets/js/utils'; - import { modelTypesStore, dataTypesStore } from '$lib/store/store'; - import { afterUpdate, beforeUpdate } from 'svelte'; + import { modelTypesStore, dataTypesStore, modelsStore } from '$lib/store/store'; + import { onMount, beforeUpdate } from 'svelte'; /** * @type {string[]} @@ -31,6 +30,14 @@ selectedDataTypes = value; }); + /** + * @type {string[]} + */ + let selectedModels; + modelsStore.subscribe((value) => { + selectedModels = value; + }); + /** * @type {any[]} */ @@ -332,18 +339,77 @@ filterModelsFromSelectedModelTypeandDataTypes(); }); - afterUpdate(() => { - for (const datatype of selectedDataTypes) { - dataTypes[datatype] = true; + let dataTypesFromUrl; + const highlightDataTypes = () => { + dataTypesFromUrl = getURLParameterValue('datatype')?.toLocaleLowerCase().trim(); + dataTypesFromUrl = decodeURIComponent(dataTypesFromUrl); + dataTypesFromUrl = dataTypesFromUrl?.replaceAll('undefined', ''); + dataTypesFromUrl = trimComma(dataTypesFromUrl); + + if (dataTypesFromUrl === 'all') { + dataTypesFromUrl = ['fp32', 'fp16', 'int8']; + } else { + dataTypesFromUrl = stringToArray(dataTypesFromUrl); } - for (const modeltype of selectedModelTypes) { - modelTypes[modeltype] = true; + if (dataTypesFromUrl.length > 0) { + for (const datatype of dataTypesFromUrl) { + dataTypes[datatype] = true; + } } + }; - for (const model of selectedModels) { - filteredModelIds[model] = true; + let modelTypesFromUrl; + const highlightModelTypes = () => { + modelTypesFromUrl = getURLParameterValue('modeltype')?.toLocaleLowerCase().trim(); + modelTypesFromUrl = decodeURIComponent(modelTypesFromUrl); + modelTypesFromUrl = modelTypesFromUrl?.replaceAll('undefined', ''); + modelTypesFromUrl = trimComma(modelTypesFromUrl); + + if (modelTypesFromUrl === 'all') { + modelTypesFromUrl = ['onnx', 'tflite', 'npy', 'pt']; + } else { + modelTypesFromUrl = stringToArray(modelTypesFromUrl); } + + if (modelTypesFromUrl.length > 0) { + for (const modeltype of modelTypesFromUrl) { + modelTypes[modeltype] = true; + } + } + }; + + let modelsFromUrl; + const highlightModels = () => { + modelsFromUrl = getURLParameterValue('model')?.toLocaleLowerCase().trim(); + modelsFromUrl = decodeURIComponent(modelsFromUrl); + modelsFromUrl = modelsFromUrl?.replaceAll('undefined', ''); + modelsFromUrl = trimComma(modelsFromUrl); + modelsFromUrl = stringToArray(modelsFromUrl); + + if (modelsFromUrl.length > 0) { + for (const model of modelsFromUrl) { + filteredModelIds[model] = true; + } + } + }; + + onMount(() => { + // for (const datatype of selectedDataTypes) { + // dataTypes[datatype] = true; + // } + + // for (const modeltype of selectedModelTypes) { + // modelTypes[modeltype] = true; + // } + + // for (const model of selectedModels) { + // filteredModelIds[model] = true; + // } + + highlightDataTypes(); + highlightModelTypes(); + highlightModels(); }); diff --git a/src/lib/components/ConfigNumOfRuns.svelte b/src/lib/components/ConfigNumOfRuns.svelte index 693578a..f9899de 100644 --- a/src/lib/components/ConfigNumOfRuns.svelte +++ b/src/lib/components/ConfigNumOfRuns.svelte @@ -1,23 +1,19 @@