enable ort-extensions in wasm release builds (#14239)

enable ort-extensions in wasm release builds. sentence piece, gpt2, bert
and word piece tokenizers for now.

wasm size will grow from 8.4MB to 8.9MB.
This commit is contained in:
Guenther Schmuelling 2023-01-17 12:39:13 -08:00 committed by GitHub
parent 2db57a53a3
commit 60290393f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -21,6 +21,20 @@ if (onnxruntime_REDUCED_OPS_BUILD)
set(OCOS_ENABLE_SELECTED_OPLIST ON CACHE INTERNAL "")
endif()
if (onnxruntime_WEBASSEMBLY_DEFAULT_EXTENSION_FLAGS)
set(OCOS_ENABLE_SPM_TOKENIZER ON CACHE INTERNAL "")
set(OCOS_ENABLE_GPT2_TOKENIZER ON CACHE INTERNAL "")
set(OCOS_ENABLE_WORDPIECE_TOKENIZER ON CACHE INTERNAL "")
set(OCOS_ENABLE_BERT_TOKENIZER ON CACHE INTERNAL "")
set(OCOS_ENABLE_TF_STRING ON CACHE INTERNAL "")
set(SPM_USE_BUILTIN_PROTOBUF OFF CACHE INTERNAL "")
set(OCOS_ENABLE_STATIC_LIB ON CACHE INTERNAL "")
set(OCOS_ENABLE_BLINGFIRE OFF CACHE INTERNAL "")
set(OCOS_ENABLE_CV2 OFF CACHE INTERNAL "")
set(OCOS_ENABLE_OPENCV_CODECS OFF CACHE INTERNAL "")
set(OCOS_ENABLE_VISION OFF CACHE INTERNAL "")
endif()
# when onnxruntime-extensions is not a subdirectory of onnxruntime,
# output binary directory must be explicitly specified.
# and the output binary path is the same as CMake FetchContent pattern

View file

@ -50,7 +50,7 @@ stages:
parameters:
CommitOverride: true
BuildConfig: 'Debug'
ExtraBuildArgs: '$(ExtraBuildArgs)'
ExtraBuildArgs: '--use_extensions --cmake_extra_defines onnxruntime_WEBASSEMBLY_DEFAULT_EXTENSION_FLAGS=ON $(ExtraBuildArgs)'
PoolName: ${{ parameters.PoolName }}
- stage: Build_web_Debug
@ -71,7 +71,7 @@ stages:
parameters:
CommitOverride: true
BuildConfig: 'Release'
ExtraBuildArgs: '--skip_tests --enable_wasm_api_exception_catching --disable_rtti $(ExtraBuildArgs)'
ExtraBuildArgs: '--skip_tests --enable_wasm_api_exception_catching --disable_rtti --use_extensions --cmake_extra_defines onnxruntime_WEBASSEMBLY_DEFAULT_EXTENSION_FLAGS=ON $(ExtraBuildArgs)'
PoolName: ${{ parameters.PoolName }}
- ${{ if eq(parameters.BuildStaticLib, 'true') }}: