Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ORT 1.18.1 Release] Update ORT numpy dependency to >=1.21.6,<2.0 #21141

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1390,14 +1390,6 @@ string(APPEND ORT_BUILD_INFO "build type=${CMAKE_BUILD_TYPE}")
string(APPEND ORT_BUILD_INFO ", cmake cxx flags: ${CMAKE_CXX_FLAGS}")
configure_file(onnxruntime_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/onnxruntime_config.h)
get_property(onnxruntime_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (onnxruntime_GENERATOR_IS_MULTI_CONFIG)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/Debug/requirements.txt)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/Release/requirements.txt)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/requirements.txt)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/MinSizeRel/requirements.txt)
else()
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/requirements.txt)
endif()

if (onnxruntime_USE_CUDA)
set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)
Expand Down
3 changes: 3 additions & 0 deletions cmake/onnxruntime_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy
${ONNXRUNTIME_ROOT}/__init__.py
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
COMMAND ${CMAKE_COMMAND} -E copy
${REPO_ROOT}/requirements.txt
$<TARGET_FILE_DIR:${build_output_target}>
COMMAND ${CMAKE_COMMAND} -E copy
${REPO_ROOT}/ThirdPartyNotices.txt
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
optimum>=1.14.1
transformers>=4.33.2,<= 4.37.2
torch>=2.2.0
numpy>=1.21.6,<2.0
onnx==1.16.0
datasets>=2.8.0
protobuf==3.20.2
psutil
psutil
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
numpy>=1.21.6,<2.0
onnx==1.16.0
transformers>=4.36.2
onnxscript>=0.1.0.dev20240126
1 change: 1 addition & 0 deletions onnxruntime/test/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
numpy>=1.21.6,<2.0
onnx==1.16.0
pytest
2 changes: 1 addition & 1 deletion requirements.txt.in → requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
coloredlogs
flatbuffers
numpy >= @Python_NumPy_VERSION@
numpy>=1.21.6,<2.0
packaging
protobuf
sympy
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ steps:
workingFolder: '$(Build.BinariesDirectory)'

- script: |
python -m pip install --upgrade "setuptools>=68.2.2" wheel numpy flatbuffers
python -m pip install --upgrade "setuptools>=68.2.2" wheel "numpy>=1.21.6,<2.0" flatbuffers
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ RUN ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ${CONDA_ENVIRONMENT_PATH}/bi
# Install migraphx
RUN apt update && apt install -y migraphx

RUN pip install numpy packaging ml_dtypes==0.3.0
RUN pip install "numpy>=1.21.6,<2.0" packaging ml_dtypes==0.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pip3 install --user --upgrade pip

pip3 install --user numpy==1.19.0 torch pytest
pip3 install --user "numpy>=1.21.6,<2.0" torch pytest
pip3 install --user /build/Release/dist/*.whl

export PYTHONPATH=/onnxruntime_src/tools:/usr/local/lib/python3.8/site-packages:$PYTHONPATH
Expand All @@ -10,7 +10,7 @@
python3 -m pytest -v /onnxruntime_src/tools/test/test_custom_ops_pytorch_exporter.py || exit 1

for filename in /onnxruntime_src/onnxruntime/test/python/contrib_ops/onnx_test_* ; do
cd /build/Release && python3 -m pytest -v $filename || exit 1

Check warning on line 13 in tools/ci_build/github/linux/test_custom_ops_pytorch_export.sh

View workflow job for this annotation

GitHub Actions / Optional Lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. Raw Output: ./tools/ci_build/github/linux/test_custom_ops_pytorch_export.sh:13:45: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
done

cd /build/Release && ./onnxruntime_test_all --gtest_filter=ShapeInferenceTests.* || exit 1
7 changes: 6 additions & 1 deletion tools/ci_build/github/windows/helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,12 @@ function Install-ONNX {
}

Write-Host "Installing python packages..."
[string[]]$pip_args = "-m", "pip", "install", "-qq", "--disable-pip-version-check", "setuptools>=68.2.2", "wheel", "numpy", "protobuf==$protobuf_version"

# Get the required numpy version from onnxruntime's requirements.txt (e.g., numpy>=1.21.6,<2.0)
$numpy_req_match_info = Get-Content "$src_root\requirements.txt" | Select-String -pattern 'numpy'
$numpy_to_install = $numpy_req_match_info.ToString()

[string[]]$pip_args = "-m", "pip", "install", "-qq", "--disable-pip-version-check", "setuptools>=68.2.2", "wheel", "$numpy_to_install", "protobuf==$protobuf_version"
&"python.exe" $pip_args
if ($lastExitCode -ne 0) {
exit $lastExitCode
Expand Down
Loading