Skip to content

Commit a81de36

Browse files
sspintelck-inteladisan3cavusmustafapratiksha123507
authored
Release 1.0.1 (openvinotoolkit#205)
* Updated OCM for FakeQuantMinMaxVars type conditions (openvinotoolkit#195) * Add clone and cd steps on the top (openvinotoolkit#194) * Memory usage fix for directory of images (openvinotoolkit#192) * GPU_FP16 is added into CheckBackends (openvinotoolkit#190) * GPU_FP16 is added into CheckBackends * Update the count for number of devices Co-authored-by: Chandrakant Khandelwal <chandrakant.khandelwal@intel.com> * Add image tagging option in examples (openvinotoolkit#193) * Added image tagging * Update rename user options in code and readme * Update readme for image rename example * Update OVTF version string (openvinotoolkit#196) * Update code based on scan reports (openvinotoolkit#199) * Revert subprocess check_output to Popen * Revert Popen to check_output in test_utils Co-authored-by: Suryaprakash Shanmugam <suryaprakash.shanmugam@intel.com> * Refactor code & Bug fixes (openvinotoolkit#200) * Revert change in build script that was causing OV build to fail (openvinotoolkit#202) * Add note for macOS Python3.6 support (openvinotoolkit#204) Co-authored-by: Chandrakant Khandelwal <chandrakant.khandelwal@intel.com> Co-authored-by: Aditya Sanivarapu <adityax.sanivarapu@intel.com> Co-authored-by: Mustafa Cavus <mustafa.cavus@intel.com> Co-authored-by: pratiksha123507 <pratikshax.bapusaheb.vanse@intel.com>
1 parent 902c635 commit a81de36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+825
-505
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This repository contains the source code of **OpenVINO™ integration with Tenso
1818
### Prerequisites
1919

2020
- Ubuntu 18.04, 20.04 or macOS 11.2.3
21-
- Python* 3.6, 3.7, 3.8 or 3.9
21+
- Python* 3.6<sup>1</sup>, 3.7, 3.8 or 3.9
2222
- TensorFlow* v2.5.1
2323

2424
Check our [Interactive Installation Table](https://openvinotoolkit.github.io/openvino_tensorflow/) for a menu of installation options. The table will help you configure the installation process.
@@ -52,7 +52,7 @@ To see if **OpenVINO™ integration with TensorFlow** is properly installed, run
5252
This should produce an output like:
5353

5454
TensorFlow version: 2.5.1
55-
OpenVINO integration with TensorFlow version: b'1.0.0'
55+
OpenVINO integration with TensorFlow version: b'1.0.1'
5656
OpenVINO version used for this build: b'2021.4.1'
5757
TensorFlow version used for this build: v2.5.1
5858
CXX11_ABI flag used for this build: 0
@@ -97,3 +97,5 @@ We will review your contribution as soon as possible. If any additional fixes or
9797

9898
---
9999
\* Other names and brands may be claimed as the property of others.
100+
101+
<sup>1</sup> Python 3.6 support is available only for Ubuntu

README_cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
它会生成以下输出:
5454

5555
TensorFlow version: 2.5.1
56-
OpenVINO integration with TensorFlow version: b'1.0.0'
56+
OpenVINO integration with TensorFlow version: b'1.0.1'
5757
OpenVINO version used for this build: b'2021.4.1'
5858
TensorFlow version used for this build: v2.5.1
5959
CXX11_ABI flag used for this build: 0

build_ov.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ def main():
3838

3939
if not os.path.isdir(arguments.output_dir):
4040
os.makedirs(arguments.output_dir)
41-
assert os.path.exists(
42-
arguments.output_dir), "path doesn't exist {0}".format(
43-
arguments.output_dir)
41+
if not os.path.exists(arguments.output_dir):
42+
raise AssertionError("Path doesn't exist {0}".format(
43+
arguments.output_dir))
4444
os.chdir(arguments.output_dir)
45-
assert os.path.exists(
46-
arguments.output_dir), "Directory doesn't exist {0}".format(
47-
arguments.output_dir)
45+
if not os.path.exists(arguments.output_dir):
46+
raise AssertionError("Directory doesn't exist {0}".format(
47+
arguments.output_dir))
4848
if not os.path.isdir(os.path.join(arguments.output_dir, "openvino")):
4949
# Download OpenVINO
5050
download_repo(
@@ -54,19 +54,19 @@ def main():
5454
submodule_update=True)
5555
else:
5656
pwd = os.getcwd()
57-
assert os.path.exists(
58-
arguments.output_dir), "path doesn't exist {0}".format(
59-
arguments.output_dir)
57+
if not os.path.exists(arguments.output_dir):
58+
raise AssertionError("Path doesn't exist {0}".format(
59+
arguments.output_dir))
6060
os.chdir(os.path.join(arguments.output_dir, "openvino"))
6161
call(["git", "fetch"])
6262
command_executor(["git", "checkout", openvino_version])
6363
call(["git", "pull"])
64-
assert os.path.exists(pwd), "Path doesn't exist {0}".format(pwd)
64+
if not os.path.exists(pwd):
65+
raise AssertionError("Path doesn't exist {0}".format(pwd))
6566
os.chdir(pwd)
66-
assert os.path.exists(
67-
os.path.join(arguments.output_dir,
68-
"openvino")), "Path doesn't exist {0}/openvino".format(
69-
arguments.output_dir)
67+
if not os.path.exists(os.path.join(arguments.output_dir, "openvino")):
68+
raise AssertionError("Path doesn't exist {0}/openvino".format(
69+
arguments.output_dir))
7070
openvino_src_dir = os.path.join(arguments.output_dir, "openvino")
7171
print("OV_SRC_DIR: ", openvino_src_dir)
7272

@@ -98,4 +98,4 @@ def main():
9898
# ./build_ovtf.py --use_openvino_from_location /prebuilt/ov/dir/artifacts/openvino
9999
# cd ..; mkdir ovtf_2; cd ovtf_2
100100
# git clone https://github.com/openvinotoolkit/openvino_tensorflow.git
101-
# ./build_ovtf.py --use_openvino_from_location /prebuilt/ov/dir/artifacts/openvino
101+
# ./build_ovtf.py --use_openvino_from_location /prebuilt/ov/dir/artifacts/openvino

build_ovtf.py

+86-67
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def main():
5252

5353
# Component versions
5454
tf_version = "v2.5.1"
55-
ovtf_version = "v1.0.0"
55+
ovtf_version = "v1.0.1"
5656
use_intel_tf = False
5757

5858
# Command line parser options
@@ -163,10 +163,11 @@ def main():
163163
arguments = parser.parse_args()
164164

165165
if arguments.cxx11_abi_version == "1" and not arguments.build_tf_from_source:
166-
assert (tf_version == arguments.tf_version), (
167-
"Currently ABI1 Tensorflow %s wheel is unavailable. " %
168-
arguments.tf_version +
169-
"Please consider adding --build_tf_from_source")
166+
if not (tf_version == arguments.tf_version):
167+
raise AssertionError(
168+
"Currently ABI1 Tensorflow %s wheel is unavailable. " %
169+
arguments.tf_version +
170+
"Please consider adding --build_tf_from_source")
170171

171172
# Update the build time tensorflow version with the user specified version
172173
tf_version = arguments.tf_version
@@ -186,55 +187,65 @@ def main():
186187
# Default directories
187188
build_dir = arguments.build_dir
188189

189-
assert not (
190-
arguments.use_tensorflow_from_location != '' and
191-
arguments.build_tf_from_source), (
190+
if (arguments.use_tensorflow_from_location != '' and
191+
arguments.build_tf_from_source):
192+
raise AssertionError(
192193
"\"use_tensorflow_from_location\" and \"build_tf_from_source\" "
193194
"cannot be used together.")
194-
195-
assert not (arguments.openvino_version not in [
196-
"2021.4.1", "2021.4", "2021.3", "2021.2"
197-
]), (
198-
"Only 2021.2, 2021.3, 2021.4 and 2021.4.1 OpenVINO versions are supported"
199-
)
195+
if (arguments.openvino_version not in [
196+
"2021.4.1", "2021.4", "2021.3", "2021.2"
197+
]):
198+
raise AssertionError(
199+
"Only 2021.2, 2021.3, 2021.4 and 2021.4.1 OpenVINO versions are supported"
200+
)
200201

201202
if arguments.use_openvino_from_location != '':
203+
if not os.path.isdir(arguments.use_openvino_from_location):
204+
raise AssertionError("Path doesn't exist {0}".format(
205+
arguments.use_openvino_from_location))
202206
ver_file = arguments.use_openvino_from_location + \
203207
'/deployment_tools/inference_engine/version.txt'
204-
assert os.path.exists(ver_file), "Path doesn't exist {0}".format(
205-
ver_file)
208+
if not os.path.exists(ver_file):
209+
raise AssertionError("Path doesn't exist {0}".format(ver_file))
206210
with open(ver_file) as f:
207211
line = f.readline()
208-
assert line.find(arguments.openvino_version) != -1, "OpenVINO version " + \
209-
arguments.openvino_version + \
210-
" does not match the version specified in use_openvino_from_location"
212+
if not line.find(arguments.openvino_version) != -1:
213+
raise AssertionError("OpenVINO version " + \
214+
arguments.openvino_version + \
215+
" does not match the version specified in use_openvino_from_location")
211216

212217
version_check((not arguments.build_tf_from_source),
213218
(arguments.use_tensorflow_from_location != ''),
214219
arguments.disable_cpp_api)
215220

216221
if arguments.use_tensorflow_from_location != '':
217222
# Check if the prebuilt folder has necessary files
218-
assert os.path.isdir(
219-
arguments.use_tensorflow_from_location
220-
), "Prebuilt TF path " + arguments.use_tensorflow_from_location + " does not exist"
223+
if not os.path.isdir(arguments.use_tensorflow_from_location):
224+
raise AssertionError("Prebuilt TF path " +
225+
arguments.use_tensorflow_from_location +
226+
" does not exist")
221227
loc = arguments.use_tensorflow_from_location + '/artifacts/tensorflow'
222-
assert os.path.isdir(
223-
loc), "Could not find artifacts/tensorflow directory"
228+
if not os.path.isdir(loc):
229+
raise AssertionError(
230+
"Could not find artifacts/tensorflow directory")
224231
found_whl = False
225232
found_libtf_fw = False
226233
found_libtf_cc = False
227-
assert os.path.exists(loc), "Path doesn't exist {0}".format(loc)
234+
if not os.path.exists(loc):
235+
raise AssertionError("Path doesn't exist {0}".format(loc))
228236
for i in os.listdir(loc):
229237
if '.whl' in i:
230238
found_whl = True
231239
if 'libtensorflow_cc' in i:
232240
found_libtf_cc = True
233241
if 'libtensorflow_framework' in i:
234242
found_libtf_fw = True
235-
assert found_whl, "Did not find TF whl file"
236-
assert found_libtf_fw, "Did not find libtensorflow_framework"
237-
assert found_libtf_cc, "Did not find libtensorflow_cc"
243+
if not found_whl:
244+
raise AssertionError("Did not find TF whl file")
245+
if not found_libtf_fw:
246+
raise AssertionError("Did not find libtensorflow_framework")
247+
if not found_libtf_cc:
248+
raise AssertionError("Did not find libtensorflow_cc")
238249

239250
try:
240251
os.makedirs(build_dir)
@@ -246,8 +257,8 @@ def main():
246257
openvino_tf_src_dir = os.path.abspath(pwd)
247258
print("OVTF SRC DIR: " + openvino_tf_src_dir)
248259
build_dir_abs = os.path.abspath(build_dir)
249-
assert os.path.exists(build_dir_abs), "Directory doesn't exist {}".format(
250-
build_dir_abs)
260+
if not os.path.exists(build_dir_abs):
261+
raise AssertionError("Directory doesn't exist {}".format(build_dir_abs))
251262
os.chdir(build_dir)
252263

253264
venv_dir = 'venv-tf-py3'
@@ -256,12 +267,13 @@ def main():
256267
artifacts_location = os.path.abspath(arguments.artifacts_dir)
257268

258269
artifacts_location = os.path.abspath(artifacts_location)
259-
print("ARTIFACTS location: " + artifacts_location)
260270

261271
#If artifacts doesn't exist create
262272
if not os.path.isdir(artifacts_location):
263273
os.mkdir(artifacts_location)
264274

275+
print("ARTIFACTS location: " + artifacts_location)
276+
265277
#install virtualenv
266278
install_virtual_env(venv_dir)
267279

@@ -275,8 +287,6 @@ def main():
275287
if (arguments.target_arch):
276288
target_arch = arguments.target_arch
277289

278-
print("Target Arch: %s" % target_arch)
279-
280290
# The cxx_abi flag is translated to _GLIBCXX_USE_CXX11_ABI
281291
# For gcc older than 5.3, this flag is set to 0 and for newer ones,
282292
# this is set to 1
@@ -293,26 +303,28 @@ def main():
293303
# The tf whl should be in use_tensorflow_from_location/artifacts/tensorflow
294304
tf_whl_loc = os.path.abspath(arguments.use_tensorflow_from_location +
295305
'/artifacts/tensorflow')
296-
assert os.path.exists(tf_whl_loc), "path doesn't exist {0}".format(
297-
tf_whl_loc)
306+
if not os.path.exists(tf_whl_loc):
307+
raise AssertionError("path doesn't exist {0}".format(tf_whl_loc))
298308
possible_whl = [i for i in os.listdir(tf_whl_loc) if '.whl' in i]
299-
assert len(
300-
possible_whl
301-
) == 1, "Expected one TF whl file, but found " + len(possible_whl)
309+
if not len(possible_whl) == 1:
310+
raise AssertionError("Expected one TF whl file, but found " +
311+
len(possible_whl))
302312
# Make sure there is exactly 1 TF whl
303313
tf_whl = os.path.abspath(tf_whl_loc + '/' + possible_whl[0])
304-
assert os.path.isfile(tf_whl), "Did not find " + tf_whl
314+
if not os.path.isfile(tf_whl):
315+
raise AssertionError("Did not find " + tf_whl)
305316
# Install the found TF whl file
306317
command_executor(["pip", "install", "--force-reinstall", "-U", tf_whl])
307318
tf_cxx_abi = get_tf_cxxabi()
308319

309-
assert (arguments.cxx11_abi_version == tf_cxx_abi), (
310-
"Desired ABI version and user built tensorflow library provided with "
311-
"use_tensorflow_from_location are incompatible")
320+
if not (arguments.cxx11_abi_version == tf_cxx_abi):
321+
raise AssertionError(
322+
"Desired ABI version and user built tensorflow library provided with "
323+
"use_tensorflow_from_location are incompatible")
312324

313325
cwd = os.getcwd()
314-
assert os.path.exists(tf_whl_loc), "Path doesn't exist {0}".format(
315-
tf_whl_loc)
326+
if not os.path.exists(tf_whl_loc):
327+
raise AssertionError("Path doesn't exist {0}".format(tf_whl_loc))
316328
os.chdir(tf_whl_loc)
317329
tf_in_artifacts = os.path.join(
318330
os.path.abspath(artifacts_location), "tensorflow")
@@ -324,11 +336,11 @@ def main():
324336
tf_version = get_tf_version()
325337
copy_tf_to_artifacts(tf_version, tf_in_artifacts, tf_whl_loc,
326338
use_intel_tf)
327-
assert os.path.exists(cwd), "Path doesn't exist {0}".format(cwd)
339+
if not os.path.exists(cwd):
340+
raise AssertionError("Path doesn't exist {0}".format(cwd))
328341
os.chdir(cwd)
329342
else:
330343
if not arguments.build_tf_from_source:
331-
print("Using TensorFlow version", tf_version)
332344
print("Install TensorFlow")
333345

334346
if arguments.cxx11_abi_version == "0":
@@ -342,43 +354,49 @@ def main():
342354
if tags.interpreter == "cp36":
343355
command_executor([
344356
"pip", "install", "--force-reinstall",
345-
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v1.0.0/tensorflow_abi1-2.5.1-cp36-cp36m-manylinux2010_x86_64.whl"
357+
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v1.0.1/tensorflow_abi1-2.5.1-cp36-cp36m-manylinux2010_x86_64.whl"
346358
])
347359
if tags.interpreter == "cp37":
348360
command_executor([
349361
"pip", "install", "--force-reinstall",
350-
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v1.0.0/tensorflow_abi1-2.5.1-cp37-cp37m-manylinux2010_x86_64.whl"
362+
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v1.0.1/tensorflow_abi1-2.5.1-cp37-cp37m-manylinux2010_x86_64.whl"
351363
])
352364
if tags.interpreter == "cp38":
353365
command_executor([
354366
"pip", "install", "--force-reinstall",
355-
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v1.0.0/tensorflow_abi1-2.5.1-cp38-cp38-manylinux2010_x86_64.whl"
367+
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v1.0.1/tensorflow_abi1-2.5.1-cp38-cp38-manylinux2010_x86_64.whl"
368+
])
369+
if tags.interpreter == "cp39":
370+
command_executor([
371+
"pip", "install", "--force-reinstall",
372+
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v1.0.1/tensorflow_abi1-2.5.1-cp39-cp39-manylinux2010_x86_64.whl"
356373
])
357-
358374
# ABI 1 TF required latest numpy
359375
command_executor(
360376
["pip", "install", "--force-reinstall", "-U numpy"])
361377

362378
tf_cxx_abi = get_tf_cxxabi()
363379

364-
assert (arguments.cxx11_abi_version == tf_cxx_abi), (
365-
"Desired ABI version and tensorflow library installed with "
366-
"pip are incompatible")
380+
if not (arguments.cxx11_abi_version == tf_cxx_abi):
381+
raise AssertionError(
382+
"Desired ABI version and tensorflow library installed with "
383+
"pip are incompatible")
367384

368385
tf_src_dir = os.path.join(artifacts_location, "tensorflow")
369386
print("TF_SRC_DIR: ", tf_src_dir)
370387
# Download TF source for enabling TF python tests
371388
pwd_now = os.getcwd()
372-
assert os.path.exists(
373-
artifacts_location), "Path doesn't exist {0}".format(
374-
artifacts_location)
389+
if not os.path.exists(artifacts_location):
390+
raise AssertionError(
391+
"Path doesn't exist {0}".format(artifacts_location))
375392
os.chdir(artifacts_location)
376393
print("DOWNLOADING TF: PWD", os.getcwd())
377394
download_repo("tensorflow",
378395
"https://github.com/tensorflow/tensorflow.git",
379396
tf_version)
380-
assert os.path.exists(pwd_now), "Path doesn't exist {0}".format(
381-
pwd_now)
397+
print("Using TensorFlow version", tf_version)
398+
if not os.path.exists(pwd_now):
399+
raise AssertionError("Path doesn't exist {0}".format(pwd_now))
382400
os.chdir(pwd_now)
383401
# Finally, copy the libtensorflow_framework.so to the artifacts
384402
if (tf_version.startswith("v1.") or (tf_version.startswith("1."))):
@@ -396,8 +414,9 @@ def main():
396414
tf_lib_file = os.path.join(tf_lib_dir, tf_fmwk_lib_name)
397415
print("SYSCFG LIB: ", tf_lib_file)
398416
dst_dir = os.path.join(artifacts_location, "tensorflow")
399-
assert os.path.exists(
400-
dst_dir), "Directory doesn't exist {0}".format(dst_dir)
417+
if not os.path.exists(dst_dir):
418+
raise AssertionError(
419+
"Directory doesn't exist {0}".format(dst_dir))
401420
if not os.path.isdir(dst_dir):
402421
os.mkdir(dst_dir)
403422
dst = os.path.join(dst_dir, tf_fmwk_lib_name)
@@ -532,11 +551,11 @@ def main():
532551
openvino_tf_cmake_flags, verbosity)
533552

534553
# Make sure that the openvino_tensorflow whl is present in the artfacts directory
535-
assert os.path.exists(artifacts_location), "Path not found {}".format(
536-
artifacts_location)
537-
assert os.path.isfile(os.path.join(
538-
artifacts_location,
539-
ov_tf_whl)), "Cannot locate nGraph whl in the artifacts location"
554+
if not os.path.exists(artifacts_location):
555+
raise AssertionError("Path not found {}".format(artifacts_location))
556+
if not os.path.isfile(os.path.join(artifacts_location, ov_tf_whl)):
557+
raise AssertionError(
558+
"Cannot locate nGraph whl in the artifacts location")
540559
if not os.path.isfile(os.path.join(artifacts_location, ov_tf_whl)):
541560
raise Exception("Cannot locate nGraph whl in the artifacts location")
542561

@@ -578,8 +597,8 @@ def main():
578597
command_executor(['ln', '-sf', link_src, link_dst], verbose=True)
579598

580599
# Run a quick test
581-
assert os.path.exists(artifacts_location), "Path doesn't exist {}".format(
582-
artifacts_location)
600+
if not os.path.exists(artifacts_location):
601+
raise AssertionError("Path doesn't exist {}".format(artifacts_location))
583602
install_openvino_tf(tf_version, venv_dir,
584603
os.path.join(artifacts_location, ov_tf_whl))
585604

0 commit comments

Comments
 (0)