@@ -479,9 +479,9 @@ def run(
479
479
):
480
480
t = time .time ()
481
481
include = [x .lower () for x in include ] # to lowercase
482
- formats = tuple (export_formats ()['Argument' ][1 :]) # --include arguments
483
- flags = [x in include for x in formats ]
484
- assert sum (flags ) == len (include ), f'ERROR: Invalid --include { include } , valid --include arguments are { formats } '
482
+ fmts = tuple (export_formats ()['Argument' ][1 :]) # --include arguments
483
+ flags = [x in include for x in fmts ]
484
+ assert sum (flags ) == len (include ), f'ERROR: Invalid --include { include } , valid --include arguments are { fmts } '
485
485
jit , onnx , xml , engine , coreml , saved_model , pb , tflite , edgetpu , tfjs = flags # export booleans
486
486
file = Path (url2file (weights ) if str (weights ).startswith (('http:/' , 'https:/' )) else weights ) # PyTorch weights
487
487
@@ -503,7 +503,7 @@ def run(
503
503
im = torch .zeros (batch_size , 3 , * imgsz ).to (device ) # image size(1,3,320,192) BCHW iDetection
504
504
505
505
# Update model
506
- if half and not ( coreml or xml ) :
506
+ if half and not coreml and not xml :
507
507
im , model = im .half (), model .half () # to FP16
508
508
model .train () if train else model .eval () # training mode = no Detect() layer grid construction
509
509
for k , m in model .named_modules ():
@@ -536,7 +536,7 @@ def run(
536
536
if any ((saved_model , pb , tflite , edgetpu , tfjs )):
537
537
if int8 or edgetpu : # TFLite --int8 bug https://github.com/ultralytics/yolov5/issues/5707
538
538
check_requirements (('flatbuffers==1.12' ,)) # required before `import tensorflow`
539
- assert not ( tflite and tfjs ) , 'TFLite and TF.js models must be exported separately, please pass only one type.'
539
+ assert not tflite or not tfjs , 'TFLite and TF.js models must be exported separately, please pass only one type.'
540
540
model , f [5 ] = export_saved_model (model .cpu (),
541
541
im ,
542
542
file ,
0 commit comments