onnxruntime/tools/ci_build/github/azure-pipelines
Caroline Zhu 4dbaa73738
[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](b023de0bfc/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 13:33:33 -08:00
..
nodejs/templates Move a nodejs test to a different machine pool (#17970) 2023-10-17 09:30:14 -07:00
nuget/templates Fix Nuget CUDA Packaging pipeline (#19054) 2024-01-11 11:59:21 -08:00
stages Fix Nuget CUDA Packaging pipeline (#19054) 2024-01-11 11:59:21 -08:00
templates [js/web/training] added end-to-end tests (#18700) 2024-01-12 13:33:33 -08:00
triggers Pr trggiers generated by code (#17247) 2023-08-30 05:57:03 +08:00
android-arm64-v8a-QNN-crosscompile-ci-pipeline.yml [QNN EP] Update QNN SDK to version 2.17.0 (#18684) 2023-12-06 11:05:41 -08:00
android-x86_64-crosscompile-ci-pipeline.yml Attempt to make the usage of the Android emulator in CIs more robust (#17903) 2023-10-15 08:42:36 +10:00
binary-size-checks-pipeline.yml Avoid taking dependency on dl.fedoraproject.org (#16202) 2023-06-02 07:41:46 -07:00
build-perf-test-binaries-pipeline.yml Remove enable_mac_silicon settings (#19108) 2024-01-12 11:01:39 -08:00
c-api-noopenmp-packaging-pipelines.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
clean-build-docker-image-cache-pipeline.yml
cuda-packaging-pipeline.yml Fix Nuget CUDA Packaging pipeline (#19054) 2024-01-11 11:59:21 -08:00
linux-ci-pipeline.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
linux-cpu-aten-pipeline.yml Update nodejs to 18.x (#17657) 2023-09-25 14:12:11 -07:00
linux-cpu-eager-pipeline.yml Pr trggiers generated by code (#17247) 2023-08-30 05:57:03 +08:00
linux-cpu-minimal-build-ci-pipeline.yml Set NDK version in Linux CPU Minimal Build E2E CI Pipeline (#18810) 2023-12-14 08:08:41 -08:00
linux-dnnl-ci-pipeline.yml Upgrade Centos7 to Alamlinux8 (#16907) 2023-08-29 21:05:36 -07:00
linux-gpu-ci-pipeline.yml Create a new Nuget Package pipeline for CUDA 12 (#18135) 2023-11-28 09:03:46 -08:00
linux-gpu-tensorrt-ci-pipeline.yml Create a new Nuget Package pipeline for CUDA 12 (#18135) 2023-11-28 09:03:46 -08:00
linux-gpu-tensorrt-daily-perf-pipeline.yml [EP Perf] Fix missing Azure cli & use onnx zoo model inside image (#18917) 2024-01-01 17:14:39 -08:00
linux-migraphx-ci-pipeline.yml [ROCm] Update CI/Packaging pipeline to ROCm6.0 (#18985) 2024-01-03 17:25:15 +08:00
linux-multi-gpu-tensorrt-ci-pipeline.yml Update nodejs to 18.x (#17657) 2023-09-25 14:12:11 -07:00
linux-openvino-ci-pipeline.yml Update nodejs to 18.x (#17657) 2023-09-25 14:12:11 -07:00
linux-qnn-ci-pipeline.yml [QNN EP] Support multithreaded inference of a single session (#18981) 2024-01-04 13:32:48 -08:00
mac-ci-pipeline.yml Pr trggiers generated by code (#17247) 2023-08-30 05:57:03 +08:00
mac-coreml-ci-pipeline.yml Update min macos version (#18251) 2023-11-10 11:08:17 -08:00
mac-ios-ci-pipeline.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
mac-ios-packaging-pipeline.yml Remove swift files on ORT main repo (#17799) 2023-10-05 15:27:15 -07:00
mac-objc-static-analysis-ci-pipeline.yml Update absl and gtest to fix an ARM64EC build error (#18735) 2023-12-07 15:55:17 -08:00
mac-react-native-ci-pipeline.yml Pr trggiers generated by code (#17247) 2023-08-30 05:57:03 +08:00
npm-packaging-pipeline.yml use EO pool for windows web_cpu stage (#18737) 2023-12-07 10:10:00 -08:00
nuget-cuda-publishing-pipeline.yml Update Nuget publishing jobs (#18851) 2023-12-19 16:54:46 -08:00
orttraining-linux-ci-pipeline.yml Update nodejs to 18.x (#17657) 2023-09-25 14:12:11 -07:00
orttraining-linux-gpu-ci-pipeline.yml Update nodejs to 18.x (#17657) 2023-09-25 14:12:11 -07:00
orttraining-linux-gpu-ortmodule-distributed-test-ci-pipeline.yml ONNX-Native Tensor Parallel: Using Distributed MatMul as Example (#17695) 2023-10-05 14:22:25 -07:00
orttraining-linux-nightly-ortmodule-test-pipeline.yml update acpt image for the training ci nightly (#17521) 2023-09-12 22:32:20 -07:00
orttraining-mac-ci-pipeline.yml Pr trggiers generated by code (#17247) 2023-08-30 05:57:03 +08:00
orttraining-pai-ci-pipeline.yml [ROCm] Update CI/Packaging pipeline to ROCm6.0 (#18985) 2024-01-03 17:25:15 +08:00
orttraining-py-packaging-pipeline-cpu.yml Remove enable_mac_silicon settings (#19108) 2024-01-12 11:01:39 -08:00
orttraining-py-packaging-pipeline-cuda.yml Updates to training pipelines to reduce CI time (#18116) 2023-10-26 14:58:57 -07:00
orttraining-py-packaging-pipeline-cuda12.yml Training packaging pipeline for cuda12 (#18524) 2023-11-21 13:19:21 -08:00
orttraining-py-packaging-pipeline-rocm.yml [ROCm] Update CI/Packaging pipeline to ROCm6.0 (#18985) 2024-01-03 17:25:15 +08:00
post-merge-jobs.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
publish-nuget.yml Update Nuget publishing jobs (#18851) 2023-12-19 16:54:46 -08:00
py-cuda-package-test-pipeline.yml Adding new pipeline for python cuda testing (#18718) 2023-12-18 18:13:03 -08:00
py-cuda-packaging-pipeline.yml Update the template files to correct stage to fix the python cuda 12 packaging pipeline (#18651) 2023-12-01 07:57:46 -08:00
py-cuda-publishing-pipeline.yml Adding a new pipeline for publishing to Python Cuda 12 packages. (#18712) 2023-12-11 14:17:46 -08:00
py-package-build-pipeline.yml Avoid taking dependency on dl.fedoraproject.org (#16202) 2023-06-02 07:41:46 -07:00
py-package-test-pipeline.yml Replace all Azure-Pipelines-EO-Windows2022-aiinfrat to Onnxruntime-Win-CPU-2022 (#18614) 2023-11-29 10:32:42 -08:00
py-packaging-pipeline.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
qnn-ep-nuget-packaging-pipeline.yml [QNN Nuget Pipeline] Build with ML ops and detect ORT version (#19024) 2024-01-08 12:44:12 -08:00
web-ci-pipeline.yml [web] a few updates to web pipeline (#17485) 2023-09-11 11:43:42 -07:00
win-ci-fuzz-testing.yml [Fix] exception in Fuzz Test pipeline (#18984) 2024-01-03 14:53:31 +08:00
win-ci-pipeline.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
win-gpu-ci-pipeline.yml Move Windows GPU training job to A10 (#19041) 2024-01-08 09:19:58 -08:00
win-gpu-reduce-op-ci-pipeline.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
win-gpu-tensorrt-ci-pipeline.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
win-qnn-arm64-ci-pipeline.yml [QNN EP] Support multithreaded inference of a single session (#18981) 2024-01-04 13:32:48 -08:00
win-qnn-ci-pipeline.yml [QNN EP] Support multithreaded inference of a single session (#18981) 2024-01-04 13:32:48 -08:00