@@ -52,7 +52,7 @@ def main():
52
52
53
53
# Component versions
54
54
tf_version = "v2.5.1"
55
- ovtf_version = "v1.0.0 "
55
+ ovtf_version = "v1.0.1 "
56
56
use_intel_tf = False
57
57
58
58
# Command line parser options
@@ -163,10 +163,11 @@ def main():
163
163
arguments = parser .parse_args ()
164
164
165
165
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" )
170
171
171
172
# Update the build time tensorflow version with the user specified version
172
173
tf_version = arguments .tf_version
@@ -186,55 +187,65 @@ def main():
186
187
# Default directories
187
188
build_dir = arguments .build_dir
188
189
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 (
192
193
"\" use_tensorflow_from_location\" and \" build_tf_from_source\" "
193
194
"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
+ )
200
201
201
202
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 ))
202
206
ver_file = arguments .use_openvino_from_location + \
203
207
'/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 ) )
206
210
with open (ver_file ) as f :
207
211
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" )
211
216
212
217
version_check ((not arguments .build_tf_from_source ),
213
218
(arguments .use_tensorflow_from_location != '' ),
214
219
arguments .disable_cpp_api )
215
220
216
221
if arguments .use_tensorflow_from_location != '' :
217
222
# 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" )
221
227
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" )
224
231
found_whl = False
225
232
found_libtf_fw = False
226
233
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 ))
228
236
for i in os .listdir (loc ):
229
237
if '.whl' in i :
230
238
found_whl = True
231
239
if 'libtensorflow_cc' in i :
232
240
found_libtf_cc = True
233
241
if 'libtensorflow_framework' in i :
234
242
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" )
238
249
239
250
try :
240
251
os .makedirs (build_dir )
@@ -246,8 +257,8 @@ def main():
246
257
openvino_tf_src_dir = os .path .abspath (pwd )
247
258
print ("OVTF SRC DIR: " + openvino_tf_src_dir )
248
259
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 ) )
251
262
os .chdir (build_dir )
252
263
253
264
venv_dir = 'venv-tf-py3'
@@ -256,12 +267,13 @@ def main():
256
267
artifacts_location = os .path .abspath (arguments .artifacts_dir )
257
268
258
269
artifacts_location = os .path .abspath (artifacts_location )
259
- print ("ARTIFACTS location: " + artifacts_location )
260
270
261
271
#If artifacts doesn't exist create
262
272
if not os .path .isdir (artifacts_location ):
263
273
os .mkdir (artifacts_location )
264
274
275
+ print ("ARTIFACTS location: " + artifacts_location )
276
+
265
277
#install virtualenv
266
278
install_virtual_env (venv_dir )
267
279
@@ -275,8 +287,6 @@ def main():
275
287
if (arguments .target_arch ):
276
288
target_arch = arguments .target_arch
277
289
278
- print ("Target Arch: %s" % target_arch )
279
-
280
290
# The cxx_abi flag is translated to _GLIBCXX_USE_CXX11_ABI
281
291
# For gcc older than 5.3, this flag is set to 0 and for newer ones,
282
292
# this is set to 1
@@ -293,26 +303,28 @@ def main():
293
303
# The tf whl should be in use_tensorflow_from_location/artifacts/tensorflow
294
304
tf_whl_loc = os .path .abspath (arguments .use_tensorflow_from_location +
295
305
'/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 ) )
298
308
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 ) )
302
312
# Make sure there is exactly 1 TF whl
303
313
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 )
305
316
# Install the found TF whl file
306
317
command_executor (["pip" , "install" , "--force-reinstall" , "-U" , tf_whl ])
307
318
tf_cxx_abi = get_tf_cxxabi ()
308
319
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" )
312
324
313
325
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 ) )
316
328
os .chdir (tf_whl_loc )
317
329
tf_in_artifacts = os .path .join (
318
330
os .path .abspath (artifacts_location ), "tensorflow" )
@@ -324,11 +336,11 @@ def main():
324
336
tf_version = get_tf_version ()
325
337
copy_tf_to_artifacts (tf_version , tf_in_artifacts , tf_whl_loc ,
326
338
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 ))
328
341
os .chdir (cwd )
329
342
else :
330
343
if not arguments .build_tf_from_source :
331
- print ("Using TensorFlow version" , tf_version )
332
344
print ("Install TensorFlow" )
333
345
334
346
if arguments .cxx11_abi_version == "0" :
@@ -342,43 +354,49 @@ def main():
342
354
if tags .interpreter == "cp36" :
343
355
command_executor ([
344
356
"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"
346
358
])
347
359
if tags .interpreter == "cp37" :
348
360
command_executor ([
349
361
"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"
351
363
])
352
364
if tags .interpreter == "cp38" :
353
365
command_executor ([
354
366
"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"
356
373
])
357
-
358
374
# ABI 1 TF required latest numpy
359
375
command_executor (
360
376
["pip" , "install" , "--force-reinstall" , "-U numpy" ])
361
377
362
378
tf_cxx_abi = get_tf_cxxabi ()
363
379
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" )
367
384
368
385
tf_src_dir = os .path .join (artifacts_location , "tensorflow" )
369
386
print ("TF_SRC_DIR: " , tf_src_dir )
370
387
# Download TF source for enabling TF python tests
371
388
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 ) )
375
392
os .chdir (artifacts_location )
376
393
print ("DOWNLOADING TF: PWD" , os .getcwd ())
377
394
download_repo ("tensorflow" ,
378
395
"https://github.com/tensorflow/tensorflow.git" ,
379
396
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 ))
382
400
os .chdir (pwd_now )
383
401
# Finally, copy the libtensorflow_framework.so to the artifacts
384
402
if (tf_version .startswith ("v1." ) or (tf_version .startswith ("1." ))):
@@ -396,8 +414,9 @@ def main():
396
414
tf_lib_file = os .path .join (tf_lib_dir , tf_fmwk_lib_name )
397
415
print ("SYSCFG LIB: " , tf_lib_file )
398
416
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 ))
401
420
if not os .path .isdir (dst_dir ):
402
421
os .mkdir (dst_dir )
403
422
dst = os .path .join (dst_dir , tf_fmwk_lib_name )
@@ -532,11 +551,11 @@ def main():
532
551
openvino_tf_cmake_flags , verbosity )
533
552
534
553
# 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" )
540
559
if not os .path .isfile (os .path .join (artifacts_location , ov_tf_whl )):
541
560
raise Exception ("Cannot locate nGraph whl in the artifacts location" )
542
561
@@ -578,8 +597,8 @@ def main():
578
597
command_executor (['ln' , '-sf' , link_src , link_dst ], verbose = True )
579
598
580
599
# 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 ) )
583
602
install_openvino_tf (tf_version , venv_dir ,
584
603
os .path .join (artifacts_location , ov_tf_whl ))
585
604
0 commit comments