From 1b902d0227d07f2fa69d40d1401cfeb3443a911a Mon Sep 17 00:00:00 2001 From: Yulong Wang Date: Fri, 6 Aug 2021 15:09:11 -0700 Subject: [PATCH] doc: add ort-web related instructions to update onnx doc (#8500) * doc: update instructions for ort web docs * revise readme --- docs/How_To_Update_ONNX_Dev_Notes.md | 7 ++- js/README.md | 78 +++++++++++++++------------- 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/docs/How_To_Update_ONNX_Dev_Notes.md b/docs/How_To_Update_ONNX_Dev_Notes.md index 278761aa1f..d73914e76a 100644 --- a/docs/How_To_Update_ONNX_Dev_Notes.md +++ b/docs/How_To_Update_ONNX_Dev_Notes.md @@ -27,6 +27,11 @@ Search 'for version2tag', update the commit hashes. The list should contain ever 5. Send you PR, and run the CI builds. -6. If there is any unitest failure, caught by onnx_test_runner. Please also update +6. If there is a build failure in stage "Check out of dated documents" in WebAssembly CI pipeline, update ONNX Runtime Web WebGL operator support document: + - Make sure Node.js is installed (see [Prerequisites](../js/README.md#Prerequisites) for instructions). + - Follow step 1 in [js/Build](../js/README.md#Build-2) to install dependencies). + - Follow instructions in [Generate document](../js/README.md#Generating-Document) to update document. Commit changes applied to file `docs/operators.md`. + +7. If there is any unitest failure, caught by onnx_test_runner. Please also update - [onnxruntime/test/onnx/main.cc](/onnxruntime/test/onnx/main.cc) - [onnxruntime/test/testdata/onnx_backend_test_series_filters.jsonc](/onnxruntime/test/testdata/onnx_backend_test_series_filters.jsonc) diff --git a/js/README.md b/js/README.md index fc5ad6330d..f0a4a53f68 100644 --- a/js/README.md +++ b/js/README.md @@ -278,7 +278,11 @@ Currently debugging C/C++ code in WebAssembly is not supported in VSCode yet. Pl ### Generating Document -Use command `npm run build:doc` to generate the latest documents. +This section describes how to generate the latest document for ONNX Runtime Web. + +The document contains information about operators WebGL backend supports. It should align with the operator resolve rules in code and spec definition from ONNX. + +In folder `/js/web`, use command `npm run build:doc` to generate the latest documents. ### Distribution @@ -317,66 +321,66 @@ By default, ONNX Runtime React Native leverages ONNX Runtime Mobile package with 2. Build Android ONNX Runtime package - 1. To use a published Android ONNX Runtime Mobile package from Maven, go to step 5. + 1. To use a published Android ONNX Runtime Mobile package from Maven, go to step 5. - 2. Set up an Android build environment referring to [instruction](https://www.onnxruntime.ai/docs/how-to/build/android-ios.html#android) + 2. Set up an Android build environment referring to [instruction](https://www.onnxruntime.ai/docs/how-to/build/android-ios.html#android) - 3. In ``, run this python script to build ONNX Runtime Android archive file. In windows, this requires an admin account to build. To build a model specific package with reduced size, refer to [instruction](https://www.onnxruntime.ai/docs/how-to/build/reduced.html#build-ort-with-reduced-size). + 3. In ``, run this python script to build ONNX Runtime Android archive file. In windows, this requires an admin account to build. To build a model specific package with reduced size, refer to [instruction](https://www.onnxruntime.ai/docs/how-to/build/reduced.html#build-ort-with-reduced-size). - ```sh - python tools/ci_build/github/android/build_aar_package.py tools/ci_build/github/android/default_mobile_aar_build_settings.json --config MinSizeRel --android_sdk_path --android_ndk_path --build_dir --include_ops_by_config tools/ci_build/github/android/mobile_package.required_operators.config - ``` + ```sh + python tools/ci_build/github/android/build_aar_package.py tools/ci_build/github/android/default_mobile_aar_build_settings.json --config MinSizeRel --android_sdk_path --android_ndk_path --build_dir --include_ops_by_config tools/ci_build/github/android/mobile_package.required_operators.config + ``` - 4. Copy `/aar_out/MinSizeRel/com/microsoft/onnxruntime/onnxruntime-mobile//onnxruntime-mobile-.aar` into `/js/react_native/android/libs` directory. + 4. Copy `/aar_out/MinSizeRel/com/microsoft/onnxruntime/onnxruntime-mobile//onnxruntime-mobile-.aar` into `/js/react_native/android/libs` directory. - 5. Modify `Onnxruntime_mobileVersion` property in `/js/react_native/android/build.properties` to consume a locally built package or a newly published package from Maven. + 5. Modify `Onnxruntime_mobileVersion` property in `/js/react_native/android/build.properties` to consume a locally built package or a newly published package from Maven. - 6. To verify, open Android Emulator and run this command from `/js/react_native/android` + 6. To verify, open Android Emulator and run this command from `/js/react_native/android` - ```sh - adb shell am instrument -w ai.onnxruntime.react_native.test/androidx.test.runner.AndroidJUnitRunner - ``` + ```sh + adb shell am instrument -w ai.onnxruntime.react_native.test/androidx.test.runner.AndroidJUnitRunner + ``` 3. Build iOS ONNX Runtime package - 1. To use a published c/c++ ONNX Runtime Mobile package from CocoaPods, skip all steps below. + 1. To use a published c/c++ ONNX Runtime Mobile package from CocoaPods, skip all steps below. - 2. Set up iOS build environment referring to [instruction](https://www.onnxruntime.ai/docs/how-to/build/android-ios.html#ios). + 2. Set up iOS build environment referring to [instruction](https://www.onnxruntime.ai/docs/how-to/build/android-ios.html#ios). - 3. Build a fat ONNX Runtime Mobile Framework for iOS and iOS simulator from `` using this command, + 3. Build a fat ONNX Runtime Mobile Framework for iOS and iOS simulator from `` using this command, - ```sh - python tools/ci_build/github/apple/build_ios_framework.py tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json --config MinSizeRel --include_ops_by_config tools/ci_build/github/android/mobile_package.required_operators.config - ``` + ```sh + python tools/ci_build/github/apple/build_ios_framework.py tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json --config MinSizeRel --include_ops_by_config tools/ci_build/github/android/mobile_package.required_operators.config + ``` - It creates `onnxruntime.framework` in `build/iOS_framework/framework_out` directory. Create an archive file of `onnxruntime.framework` directory as follows and copy to `/js/react_native/local_pods` directory. + It creates `onnxruntime.framework` in `build/iOS_framework/framework_out` directory. Create an archive file of `onnxruntime.framework` directory as follows and copy to `/js/react_native/local_pods` directory. - ```sh - zip -r onnxruntime-mobile-c.zip onnxruntime.framework - ``` + ```sh + zip -r onnxruntime-mobile-c.zip onnxruntime.framework + ``` - 4. To verify, open iOS Simulator and run this command from `/js/react_native/ios`. Change a destination to specify a running iOS Simulator. + 4. To verify, open iOS Simulator and run this command from `/js/react_native/ios`. Change a destination to specify a running iOS Simulator. - ```sh - pod install - xcodebuild test -workspace OnnxruntimeModule.xcworkspace -scheme OnnxruntimeModuleTest -destination 'platform=iOS Simulator,name=iPhone 11,OS=14.5' - ``` + ```sh + pod install + xcodebuild test -workspace OnnxruntimeModule.xcworkspace -scheme OnnxruntimeModuleTest -destination 'platform=iOS Simulator,name=iPhone 11,OS=14.5' + ``` 4. Test an example for Android and iOS. In Windows, open Android Emulator first. `debug.keystore` must be generated ahead for Android example. - ```sh - keytool -genkey -v -keystore /js/react_native/example/android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 999999 -dname "CN=Android Debug,O=Android,C=US" - ``` + ```sh + keytool -genkey -v -keystore /js/react_native/example/android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 999999 -dname "CN=Android Debug,O=Android,C=US" + ``` - From `/js/react_native, + From `/js/react_native, - ```sh - yarn bootstrap - yarn example ios - yarn example android - ``` + ```sh + yarn bootstrap + yarn example ios + yarn example android + ``` ### NPM Packaging