From c8ea154e55e8eb772f9843b6abc16ba63d770847 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 7 Feb 2020 11:38:42 -0800 Subject: [PATCH] Package data_frame_tool, include featurizers into Manilinux2010 (#2989) * Package data_frame_tool, exclude featurizers from Manilinux2010 as their fail to build. --- cmake/onnxruntime_python.cmake | 7 +++++++ onnxruntime/python/tools/featurizer_ops/README.md | 12 +++++++----- .../azure-pipelines/azure-pipelines-py-packaging.yml | 6 +++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index 4e3b2a2c14..436b2b7e52 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -145,6 +145,9 @@ file(GLOB onnxruntime_python_test_srcs CONFIGURE_DEPENDS file(GLOB onnxruntime_python_tools_srcs CONFIGURE_DEPENDS "${ONNXRUNTIME_ROOT}/python/tools/*.py" ) +file(GLOB onnxruntime_python_tools_featurizers_src CONFIGURE_DEPENDS + "${ONNXRUNTIME_ROOT}/python/tools/featurizer_ops/*.py" +) file(GLOB onnxruntime_python_datasets_srcs CONFIGURE_DEPENDS "${ONNXRUNTIME_ROOT}/python/datasets/*.py" ) @@ -161,6 +164,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/capi COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/datasets COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/tools + COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/tools/featurizer_ops COMMAND ${CMAKE_COMMAND} -E copy ${ONNXRUNTIME_ROOT}/__init__.py $/onnxruntime/ @@ -194,6 +198,9 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E copy ${onnxruntime_python_tools_srcs} $/onnxruntime/tools/ + COMMAND ${CMAKE_COMMAND} -E copy + ${onnxruntime_python_tools_featurizers_src} + $/onnxruntime/tools/featurizer_ops/ COMMAND ${CMAKE_COMMAND} -E copy ${REPO_ROOT}/VERSION_NUMBER $ diff --git a/onnxruntime/python/tools/featurizer_ops/README.md b/onnxruntime/python/tools/featurizer_ops/README.md index 5eda02a491..5a1fa44915 100644 --- a/onnxruntime/python/tools/featurizer_ops/README.md +++ b/onnxruntime/python/tools/featurizer_ops/README.md @@ -16,12 +16,14 @@ from feed_inputs import DataFrameTool # Load the onnx model sess_options = onnxrt.SessionOptions() sess_options.enable_profiling = args.profile -sess = onnxrt.InferenceSession(args.model_path, sess_options) -df = pd.DataFrame([['string_input', True, np.float32(0.25)]], index=[0], columns=['F2', 'Label', 'F1']) +df_tool = DataFrameTool(args.model_path, sess_options) -feed_helper = DataFrameTool(sess) -feeds = feed_helper.feed_nputs(df) +# Create a DataFrame that holds 3 inputs, string, bool, float in their respective columns +df = pd.DataFrame([['string_input', 3.25, 8, 16, 32, 64, True, 0.25]], + columns=['StringInput', 'DoubleInput', 'Int8Input', 'Int16Input', 'Int32Input', 'Int64Input', 'BoolInput', 'Float32Input']) + +outputs = df_tool.execute(df, []) +print('Outputs: ', outputs) -sess.run([], feeds) ``` diff --git a/tools/ci_build/github/azure-pipelines/azure-pipelines-py-packaging.yml b/tools/ci_build/github/azure-pipelines/azure-pipelines-py-packaging.yml index 1b5aae36c9..f3ff17100f 100644 --- a/tools/ci_build/github/azure-pipelines/azure-pipelines-py-packaging.yml +++ b/tools/ci_build/github/azure-pipelines/azure-pipelines-py-packaging.yml @@ -188,7 +188,7 @@ jobs: displayName: 'BUILD' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_generator "Visual Studio 16 2019" --build_wheel --enable_onnx_tests --parallel' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_generator "Visual Studio 16 2019" --build_wheel --use_featurizers --enable_onnx_tests --parallel' workingDirectory: '$(Build.BinariesDirectory)' - task: CopyFiles@2 @@ -257,7 +257,7 @@ jobs: displayName: 'build' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: --config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --cmake_generator "Visual Studio 16 2019" --msvc_toolset 14.16 --build_wheel --enable_onnx_tests --parallel --use_cuda --cuda_version=$(CUDA_VERSION) --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$(CUDA_VERSION)" --cudnn_home="C:\local\cudnn-$(CUDA_VERSION)-windows10-x64-v7.6.5.32\cuda" + arguments: --config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --use_featurizers --cmake_generator "Visual Studio 16 2019" --msvc_toolset 14.16 --build_wheel --enable_onnx_tests --parallel --use_cuda --cuda_version=$(CUDA_VERSION) --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$(CUDA_VERSION)" --cudnn_home="C:\local\cudnn-$(CUDA_VERSION)-windows10-x64-v7.6.5.32\cuda" workingDirectory: '$(Build.BinariesDirectory)' - task: CopyFiles@2 @@ -300,7 +300,7 @@ jobs: - script: | sudo python -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt' sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer - ./build.sh --config Release --skip_submodule_sync --parallel --use_openmp --build_wheel + ./build.sh --config Release --skip_submodule_sync --parallel --use_openmp --build_wheel --use_featurizers displayName: 'Command Line Script' - task: CopyFiles@2