Replace inline pip install with pip install from requirements*.txt (#21106)

### Description
Replace inline pip install with pip install from requirements*.txt



### Motivation and Context
so that CG can recognize

### Dependency

- [x] https://github.com/microsoft/onnxruntime/pull/21085
This commit is contained in:
Jian Chen 2024-07-22 12:39:10 -07:00 committed by GitHub
parent 17e9ea6235
commit 4e75605eec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 16 deletions

View file

@ -261,9 +261,6 @@ def parse_arguments():
"--wheel_name_suffix",
help="Suffix to append to created wheel names. This value is currently only used for nightly builds.",
)
parser.add_argument(
"--numpy_version", help="Installs a specific version of numpy before building the python binding."
)
parser.add_argument("--skip-keras-test", action="store_true", help="Skip tests with Keras if keras is installed")
# C-Sharp bindings
@ -868,16 +865,6 @@ def update_submodules(source_dir):
run_subprocess(["git", "submodule", "update", "--init", "--recursive"], cwd=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])
def setup_test_data(source_onnx_model_dir, dest_model_dir_name, build_dir, configs):
# create the symlink/shortcut of onnx models dir under build_dir
# currently, there're 2 sources of onnx models, one is build in OS image, another is
@ -2146,7 +2133,14 @@ def run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs):
numpy_init_version = numpy.__version__
pb_init_version = google.protobuf.__version__
run_subprocess(
[sys.executable, "-m", "pip", "install", "-r", "requirements-transformers-test.txt"],
[
sys.executable,
"-m",
"pip",
"install",
"-r",
"requirements/transformers-test/requirements.txt",
],
cwd=SCRIPT_DIR,
)
run_subprocess([sys.executable, "-m", "pytest", "transformers"], cwd=cwd)
@ -2818,7 +2812,10 @@ def main():
run_subprocess([emsdk_file, "activate", emsdk_version], cwd=emsdk_dir)
if args.enable_pybind and is_windows():
install_python_deps(args.numpy_version)
run_subprocess(
[sys.executable, "-m", "pip", "install", "-r", "requirements/pybind/requirements.txt"],
cwd=SCRIPT_DIR,
)
if args.use_rocm and args.rocm_version is None:
args.rocm_version = ""

View file

@ -276,7 +276,7 @@ jobs:
onnxruntimetrainingrocm-cibuild-rocm$(RocmVersion)-test \
/bin/bash -c "
set -ex; \
pip install -r /onnxruntime_src/tools/ci_build/requirements-transformers-test.txt; \
pip install -r /onnxruntime_src/tools/ci_build/requirements/transformers-test/requirements.txt; \
pytest /onnxruntime_src/onnxruntime/test/python/transformers/test_flash_attn_rocm.py -v -n 4 --reruns 1"
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Run tranformers tests'

View file

@ -0,0 +1,8 @@
setuptools
wheel
pytest
numpy>=1.19.0
sympy>=1.10
packaging
cerberus
psutil