2021-04-27 07:04:25 +00:00
|
|
|
{
|
2022-03-08 04:40:24 +00:00
|
|
|
"license": "MIT",
|
|
|
|
|
"unpkg": "dist/ort.min.js",
|
|
|
|
|
"name": "onnxruntime-web",
|
2021-04-27 07:04:25 +00:00
|
|
|
"repository": {
|
2022-03-08 04:40:24 +00:00
|
|
|
"url": "https://github.com/Microsoft/onnxruntime.git",
|
2021-05-04 01:31:55 +00:00
|
|
|
"type": "git"
|
2022-03-08 04:40:24 +00:00
|
|
|
},
|
|
|
|
|
"author": "fs-eire",
|
2024-04-30 03:21:41 +00:00
|
|
|
"version": "1.19.0",
|
2022-03-08 04:40:24 +00:00
|
|
|
"jsdelivr": "dist/ort.min.js",
|
2021-12-15 07:32:06 +00:00
|
|
|
"dependencies": {
|
2022-03-08 04:40:24 +00:00
|
|
|
"flatbuffers": "^1.12.0",
|
|
|
|
|
"guid-typescript": "^1.0.9",
|
2023-07-18 23:36:39 +00:00
|
|
|
"long": "^5.2.3",
|
2022-08-25 08:40:42 +00:00
|
|
|
"onnxruntime-common": "file:../common",
|
2023-07-18 23:36:39 +00:00
|
|
|
"platform": "^1.3.6",
|
|
|
|
|
"protobufjs": "^7.2.4"
|
2022-03-08 04:40:24 +00:00
|
|
|
},
|
2021-05-04 01:31:55 +00:00
|
|
|
"scripts": {
|
2023-07-18 23:36:39 +00:00
|
|
|
"preprepare": "node -e \"require('node:fs').copyFileSync('./node_modules/long/index.d.ts', './node_modules/long/umd/index.d.ts')\"",
|
2023-10-16 16:04:54 +00:00
|
|
|
"prepare": "tsc --build ./script",
|
2023-05-20 19:20:41 +00:00
|
|
|
"build:doc": "node ./script/generate-webgl-operator-md && node ./script/generate-webgpu-operator-md",
|
2022-03-08 04:40:24 +00:00
|
|
|
"pull:wasm": "node ./script/pull-prebuilt-wasm-artifacts",
|
|
|
|
|
"test:e2e": "node ./test/e2e/run",
|
[js/web/training] added end-to-end tests (#18700)
## Summary
* following inference's [set-up for end-to-end
tests](https://github.com/microsoft/onnxruntime/tree/main/js/web/test/e2e),
created an end-to-end test runner for training
* this test runner copies testdata from the [trainingapi
folder](https://github.com/microsoft/onnxruntime/tree/main/onnxruntime/test/testdata/training_api)
* then runs two tests (training session with evalModel & optimizer
model, and training session with the minimum options), and tests if the
ORT-web training package encompasses inference
* these tests check
* createTrainingSession
* runTrainStep
* runOptimizerStep if applicable
* the parameters methods (getParametersSize, loadParametersBuffer, and
getContiguousParameters)
## TL;DR
*
[`js/web/test/training/e2e/run.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-c1359c4d401f9ba69e937814219cefe5fd11b151a6ffd084c641af3c82e8216c)
is responsible for setting up and running the end to end tests
*
[`js/web/test/training/e2e/common.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-ee5452491b7b2563d175d13d81d10f2323b12b18589aa4c5798962a8b904a4a8)
contains the test function definitions (`testInferenceFunction`,
`testTrainingFunctionMin`, `testTrainingFunctionAll`)
## Flow
* entrypoint: user runs the following command in the terminal: `npm run
test:training:e2e`
*
[`js/web/package.json`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-79275844e75c3c410bb3a71c7f59b2b633e5a3e975c804ffc47220025084da28)
was modified to include an npm script that will run `run.js` which will
run the end to end tests
*
[`js/web/test/training/e2e/run.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-c1359c4d401f9ba69e937814219cefe5fd11b151a6ffd084c641af3c82e8216c)
is responsible for
* detecting and installing local tarball packages of ORT-web
* copying training data to the `js/web/training/e2e/data` folder
* starting two Karma processes. Karma is a test runner framework that
simulates testing in the browser.
* In this case, the tests happen in Chrome. We can configure the tests
to run in Edge and other browsers in the future.
* one of these karma processes is self-hosted, meaning it pulls the
ORT-web package from local
* the other karma process is not self-hosted, meaning it pulls the
ORT-web package from another source. In this case, we start an http
server that serves the ORT-web binaries.
*
[`js/web/test/training/e2e/simple-http-server.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-f798ab485f3ec26c299fe5b2923574c9e4b090200ba20d490bbf6c183286993c)
is responsible for starting the HTTP server and serving the ORT binary
files. This code almost identical to the same code in the inference E2E
tests.
*
[`js/web/test/training/e2e/karma.conf.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-436cfe8f670c768a04895bd4a1874a5e033f85e0e2d84941c62ff1f7c30a9f28)
Karma configuration file that specifies what happens when a karma
process is started. The config specifies Mocha as the testing framework,
which will go through all the loaded files and run any tests that exist
*
[`js/web/test/training/e2e/browser-test-wasm.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-13b6155e106dddc7b531ef671186e69b2aadb8a0f4b2f3001db0991567d78221)
File that contains the tests that Mocha will pick up on and run.
* The test functions (such as testInference and testTrainingFunctionAll)
are defined in
[`js/web/test/training/e2e/common.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-ee5452491b7b2563d175d13d81d10f2323b12b18589aa4c5798962a8b904a4a8).
## Notes
* I followed the [tests for training
core](https://github.com/microsoft/onnxruntime/blob/b023de0bfc7acb2404dfdcc4adc060b7b72fdaa1/orttraining/orttraining/test/training_api/core/training_api_tests.cc)
where they randomly generated input for the training session
* E2E tests are triggered by running `npm run test:training:e2e` --
suggestions for alternative script names are appreciated!!!
## Motivation and Context
- adding training bindings for web
2024-01-12 21:33:33 +00:00
|
|
|
"test:training:e2e": "node ./test/training/e2e/run",
|
2023-11-15 17:16:29 +00:00
|
|
|
"prebuild": "tsc -p . --noEmit && tsc -p lib/wasm/proxy-worker --noEmit",
|
2022-03-08 04:40:24 +00:00
|
|
|
"build": "node ./script/build",
|
2022-07-21 05:01:08 +00:00
|
|
|
"test": "tsc --build ../scripts && node ../scripts/prepare-onnx-node-tests && node ./script/test-runner-cli",
|
2021-11-10 20:52:34 +00:00
|
|
|
"prepack": "node ./script/build && node ./script/prepack"
|
2022-03-08 04:40:24 +00:00
|
|
|
},
|
2021-12-15 07:32:06 +00:00
|
|
|
"keywords": [
|
2022-03-08 04:40:24 +00:00
|
|
|
"ONNX",
|
|
|
|
|
"ONNXRuntime",
|
2021-12-15 07:32:06 +00:00
|
|
|
"ONNX Runtime"
|
2022-03-08 04:40:24 +00:00
|
|
|
],
|
2021-04-27 07:04:25 +00:00
|
|
|
"devDependencies": {
|
2023-03-22 22:05:04 +00:00
|
|
|
"@chiragrupani/karma-chromium-edge-launcher": "^2.2.2",
|
|
|
|
|
"@types/chai": "^4.3.4",
|
|
|
|
|
"@types/emscripten": "^1.39.6",
|
2022-03-08 04:40:24 +00:00
|
|
|
"@types/flatbuffers": "^1.10.0",
|
|
|
|
|
"@types/karma": "^6.1.0",
|
2023-03-22 22:05:04 +00:00
|
|
|
"@types/minimatch": "^5.1.2",
|
2022-08-25 08:40:42 +00:00
|
|
|
"@types/minimist": "^1.2.2",
|
2023-03-22 22:05:04 +00:00
|
|
|
"@types/platform": "^1.3.4",
|
2023-11-11 00:03:38 +00:00
|
|
|
"@webgpu/types": "^0.1.38",
|
2022-03-08 04:40:24 +00:00
|
|
|
"base64-js": "^1.5.1",
|
2023-03-22 22:05:04 +00:00
|
|
|
"chai": "^4.3.7",
|
2024-01-18 21:45:42 +00:00
|
|
|
"electron": "^28.1.4",
|
2023-03-22 22:05:04 +00:00
|
|
|
"globby": "^13.1.3",
|
|
|
|
|
"karma": "^6.4.1",
|
2022-03-08 04:40:24 +00:00
|
|
|
"karma-browserstack-launcher": "^1.6.0",
|
|
|
|
|
"karma-chai": "^0.1.0",
|
2023-03-22 22:05:04 +00:00
|
|
|
"karma-chrome-launcher": "^3.1.1",
|
2022-03-08 04:40:24 +00:00
|
|
|
"karma-edge-launcher": "^0.4.2",
|
2023-03-22 22:05:04 +00:00
|
|
|
"karma-electron": "^7.3.0",
|
|
|
|
|
"karma-firefox-launcher": "^2.1.2",
|
2022-03-08 04:40:24 +00:00
|
|
|
"karma-mocha": "^2.0.1",
|
|
|
|
|
"karma-mocha-reporter": "^2.2.5",
|
2023-03-22 22:05:04 +00:00
|
|
|
"karma-safari-applescript-launcher": "^0.1.1",
|
|
|
|
|
"karma-sourcemap-loader": "^0.4.0",
|
|
|
|
|
"minimatch": "^7.4.2",
|
|
|
|
|
"minimist": "^1.2.8",
|
2022-03-08 04:40:24 +00:00
|
|
|
"numpy-parser": "^1.2.3",
|
2023-03-22 22:05:04 +00:00
|
|
|
"strip-json-comments": "^5.0.0"
|
2022-03-08 04:40:24 +00:00
|
|
|
},
|
2024-04-23 20:10:11 +00:00
|
|
|
"main": "dist/ort.node.min.js",
|
|
|
|
|
"browser": "dist/ort.min.js",
|
2023-05-04 17:05:39 +00:00
|
|
|
"exports": {
|
|
|
|
|
".": {
|
2023-10-11 16:38:51 +00:00
|
|
|
"node": "./dist/ort.node.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-11 16:38:51 +00:00
|
|
|
"default": {
|
2023-10-30 15:11:43 +00:00
|
|
|
"import": "./dist/esm/ort.min.js",
|
|
|
|
|
"require": "./dist/cjs/ort.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-11 16:38:51 +00:00
|
|
|
"default": {
|
|
|
|
|
"development": "./dist/ort.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-11 16:38:51 +00:00
|
|
|
"default": "./dist/ort.min.js"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"./experimental": {
|
2023-10-30 15:11:43 +00:00
|
|
|
"import": "./dist/esm/ort.all.min.js",
|
|
|
|
|
"require": "./dist/cjs/ort.all.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-11 16:38:51 +00:00
|
|
|
"default": {
|
|
|
|
|
"development": "./dist/ort.all.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-11 16:38:51 +00:00
|
|
|
"default": "./dist/ort.all.min.js"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"./wasm": {
|
2023-10-30 15:11:43 +00:00
|
|
|
"import": "./dist/esm/ort.wasm.min.js",
|
|
|
|
|
"require": "./dist/cjs/ort.wasm.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-30 15:11:43 +00:00
|
|
|
"default": "./dist/ort.wasm.min.js"
|
2023-10-11 16:38:51 +00:00
|
|
|
},
|
|
|
|
|
"./wasm-core": {
|
2023-10-30 15:11:43 +00:00
|
|
|
"import": "./dist/esm/ort.wasm-core.min.js",
|
|
|
|
|
"require": "./dist/cjs/ort.wasm-core.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-30 15:11:43 +00:00
|
|
|
"default": "./dist/ort.wasm-core.min.js"
|
2023-10-11 16:38:51 +00:00
|
|
|
},
|
|
|
|
|
"./webgl": {
|
2023-10-30 15:11:43 +00:00
|
|
|
"import": "./dist/esm/ort.webgl.min.js",
|
|
|
|
|
"require": "./dist/cjs/ort.webgl.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-30 15:11:43 +00:00
|
|
|
"default": "./dist/ort.webgl.min.js"
|
2023-05-04 17:05:39 +00:00
|
|
|
},
|
2023-06-07 21:52:36 +00:00
|
|
|
"./webgpu": {
|
2023-10-30 15:11:43 +00:00
|
|
|
"import": "./dist/esm/ort.webgpu.min.js",
|
|
|
|
|
"require": "./dist/cjs/ort.webgpu.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-30 15:11:43 +00:00
|
|
|
"default": "./dist/ort.webgpu.min.js"
|
2023-10-12 18:16:56 +00:00
|
|
|
},
|
|
|
|
|
"./training": {
|
2023-10-30 15:11:43 +00:00
|
|
|
"import": "./dist/esm/ort.training.wasm.min.js",
|
|
|
|
|
"require": "./dist/cjs/ort.training.wasm.min.js",
|
2024-02-08 23:56:48 +00:00
|
|
|
"types": "./types.d.ts",
|
2023-10-30 15:11:43 +00:00
|
|
|
"default": "./dist/ort.training.wasm.min.js"
|
2023-06-07 21:52:36 +00:00
|
|
|
}
|
2023-05-04 17:05:39 +00:00
|
|
|
},
|
|
|
|
|
"types": "./types.d.ts",
|
2021-12-15 07:32:06 +00:00
|
|
|
"description": "A Javascript library for running ONNX models on browsers"
|
2022-07-21 05:01:08 +00:00
|
|
|
}
|