Skip to content

Commit

Permalink
using requirements-pybind.txt instead of inline
Browse files Browse the repository at this point in the history
  • Loading branch information
jchen351 committed Jun 19, 2024
1 parent 6a0d64e commit 0f1dc32
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,21 @@ def update_submodules(source_dir):


def install_python_deps(numpy_version=""):
dep_packages = ["setuptools", "wheel", "pytest"]
dep_packages.append(f"numpy=={numpy_version}" if numpy_version else "numpy>=1.16.6")
dep_packages.append("sympy>=1.10")
dep_packages.append("packaging")
dep_packages.append("cerberus")
dep_packages.append("psutil")
run_subprocess([sys.executable, "-m", "pip", "install", *dep_packages])
requirements_file = 'requirements-pybind.txt'
if numpy_version:
# Remove current numpy version from requirements-pybind.txt and add the specified version
with open(requirements_file, 'r+') as file:
lines = file.readlines()
file.seek(0)
package_to_exclude = 'numpy'
filtered_lines = [line for line in lines if package_to_exclude not in line]
filtered_lines.append(f'numpy=={numpy_version}\n')
file.writelines(filtered_lines)
file.truncate()
run_subprocess(
[sys.executable, "-m", "pip", "install", "-r", requirements_file],
cwd=SCRIPT_DIR,
)


def setup_test_data(source_onnx_model_dir, dest_model_dir_name, build_dir, configs):
Expand Down
10 changes: 10 additions & 0 deletions tools/ci_build/requirements-pybind.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# packages used by transformers python unittest (only enabled in Linux CPU CI Pipeline)
packaging
pytest
wheel
setuptools
numpy==1.24.0 ; python_version < '3.12'
numpy==1.26.0 ; python_version >= '3.12'
sympy>=1.10
psutil
cerberus

0 comments on commit 0f1dc32

Please sign in to comment.