Restore changes removed by PR #571 (numpy version) (#603)

add options numpy_version, skip-keras-test to build.py, gives more options to build onnxruntime
This commit is contained in:
Xavier Dupré 2019-03-13 10:55:56 +01:00 committed by GitHub
parent eab1f5463c
commit 7dd9bc4d78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,6 +81,9 @@ Use the individual flags to only run the specified stages.
# Python bindings
parser.add_argument("--enable_pybind", action='store_true', help="Enable Python Bindings.")
parser.add_argument("--build_wheel", action='store_true', help="Build Python Wheel. ")
parser.add_argument("--numpy_version", default='1.15.0', 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
parser.add_argument("--build_csharp", action='store_true', help="Build C#.Net DLL and NuGet package")
@ -201,8 +204,9 @@ def install_ubuntu_deps(args):
except Exception as e:
raise BuildError("Error setting up required APT packages. {}".format(str(e)))
def install_python_deps():
dep_packages = ['setuptools', 'wheel', 'numpy==1.15.0']
def install_python_deps(numpy_version=""):
dep_packages = ['setuptools', 'wheel']
dep_packages.append('numpy==%s' % numpy_version if numpy_version else 'numpy')
run_subprocess([sys.executable, '-m', 'pip', 'install', '--trusted-host', 'files.pythonhosted.org'] + dep_packages)
def check_md5(filename, expected_md5):
@ -477,15 +481,16 @@ def run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs, enab
run_subprocess([os.path.join(cwd,'onnx_test_runner'), 'test_models'], cwd=cwd)
if config != 'Debug':
run_subprocess([sys.executable, 'onnx_backend_test_series.py'], cwd=cwd, dll_path=dll_path)
try:
import onnxmltools
import keras
onnxml_test = True
except ImportError:
warnings.warn("onnxmltools and keras are not installed. Following test cannot be run.")
onnxml_test = False
if onnxml_test:
run_subprocess([sys.executable, 'onnxruntime_test_python_keras.py'], cwd=cwd, dll_path=dll_path)
if not args.skip_keras_test:
try:
import onnxmltools
import keras
onnxml_test = True
except ImportError:
warnings.warn("onnxmltools and keras are not installed. Following test cannot be run.")
onnxml_test = False
if onnxml_test:
run_subprocess([sys.executable, 'onnxruntime_test_python_keras.py'], cwd=cwd, dll_path=dll_path)
def run_onnx_tests(build_dir, configs, onnx_test_data_dir, provider, enable_parallel_executor_test, num_parallel_models):
for config in configs:
@ -628,7 +633,7 @@ def main():
if not is_docker():
install_python_deps()
if (args.enable_pybind and is_windows()):
install_python_deps()
install_python_deps(args.numpy_version)
if (not args.skip_submodule_sync):
update_submodules(source_dir)