Skip to content

Commit 3b0590c

Browse files
authored
tf-2.7 (#1762)
* tf-2.7 Signed-off-by: Guenther Schmuelling <[email protected]> * no released tensorflow-text.2.7 yet, try 2.6 Signed-off-by: Guenther Schmuelling <[email protected]> * give quant test some tolerance Signed-off-by: Guenther Schmuelling <[email protected]> * make ptol usage consistent Signed-off-by: Guenther Schmuelling <[email protected]>
1 parent 79a99f4 commit 3b0590c

File tree

5 files changed

+71
-7
lines changed

5 files changed

+71
-7
lines changed

ci_build/azure_pipelines/pretrained_model_test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
jobs:
44
- template: 'templates/job_generator.yml'
55
parameters:
6-
python_versions: ['3.7']
7-
tf_versions: ['2.4.1']
6+
# 2.6, tflite/tfjs
7+
python_versions: ['3.8']
8+
tf_versions: ['2.6.2']
89
skip_tflite_tests: 'False'
910
skip_tfjs_tests: 'False'
1011
skip_tf_tests: 'True'
@@ -14,8 +15,18 @@ jobs:
1415

1516
- template: 'templates/job_generator.yml'
1617
parameters:
18+
# 2.6, tf
1719
python_versions: ['3.7']
1820
tf_versions: ['1.15.5','2.6.2']
1921
job:
2022
steps:
2123
- template: 'pretrained_model_test.yml'
24+
25+
- template: 'templates/job_generator.yml'
26+
parameters:
27+
# 2.7, tf
28+
python_versions: ['3.9']
29+
tf_versions: ['2.7.0']
30+
job:
31+
steps:
32+
- template: 'pretrained_model_test.yml'

ci_build/azure_pipelines/templates/setup.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ steps:
4545
then
4646
pip install tensorflow-text>=2.6
4747
fi
48+
if [[ $CI_TF_VERSION == 2.7* ]] ;
49+
then
50+
pip install tensorflow-text>=2.6
51+
fi
4852
fi
4953
5054
python setup.py install

ci_build/azure_pipelines/unit_test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@
33
stages:
44
- stage:
55
jobs:
6+
- template: 'templates/job_generator.yml'
7+
parameters:
8+
# TFJS tf 2.7
9+
python_versions: ['3.9']
10+
tf_versions: ['2.7.0']
11+
onnx_opsets: ['']
12+
skip_tfjs_tests: 'False'
13+
skip_tf_tests: 'True'
14+
job:
15+
steps:
16+
- template: 'unit_test.yml'
17+
report_coverage: 'True'
18+
19+
- template: 'templates/job_generator.yml'
20+
parameters:
21+
# TFLite tf 2.7
22+
python_versions: ['3.8']
23+
tf_versions: ['2.7.0']
24+
onnx_opsets: ['']
25+
skip_tflite_tests: 'False'
26+
skip_tf_tests: 'True'
27+
job:
28+
steps:
29+
- template: 'unit_test.yml'
30+
report_coverage: 'True'
31+
32+
- template: 'templates/job_generator.yml'
33+
parameters:
34+
# tf 2.7
35+
python_versions: ['3.8']
36+
tf_versions: ['2.7.0']
37+
onnx_opsets: ['']
38+
job:
39+
steps:
40+
- template: 'unit_test.yml'
41+
report_coverage: 'True'
42+
643
- template: 'templates/job_generator.yml'
744
parameters:
845
# TFJS tf 2.6

tests/run_pretrained_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def run_tflite():
604604
for tf_res, onnx_res in zip(tf_results, onnx_results):
605605
good_cnt = np.count_nonzero(np.isclose(tf_res, onnx_res, rtol=self.rtol, atol=self.atol))
606606
bad_cnt = tf_res.size - good_cnt
607-
if bad_cnt > self.ptol / 100 * tf_res.size:
607+
if bad_cnt > self.ptol * tf_res.size:
608608
# Prints a nice error message with stats
609609
np.testing.assert_allclose(tf_res, onnx_res, rtol=self.rtol, atol=self.atol)
610610
logger.info("Results: OK")

tests/run_pretrained_models.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,17 @@ googlenet_v4_slim:
209209
- InceptionV4/Logits/Predictions:0
210210
rtol: 0.1
211211

212+
squeezenet:
213+
disabled: true
214+
url: https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/squeezenet_2018_04_27.tgz
215+
model: squeezenet.pb
216+
input_get: get_beach
217+
inputs:
218+
"Placeholder:0": [1, 224, 224, 3]
219+
outputs:
220+
- softmax_tensor:0
221+
- ArgMax:0
222+
212223
mobilenet_v3_large_float:
213224
tf_min_version: 1.14 # explicit_paddings for Conv2D
214225
url: https://storage.googleapis.com/mobilenet_v3/checkpoints/v3-large_224_1.0_float.tgz
@@ -493,7 +504,7 @@ deeplabv3_mnv2_ade20k_uint8_tflite_dequantize:
493504
model: "deeplabv3_mnv2_ade20k_uint8.tflite"
494505
model_type: tflite
495506
input_get: get_ade20k_uint8
496-
ptol: 1.0
507+
ptol: 0.1 # unreliable because of quantization
497508
dequantize: true
498509
inputs:
499510
"MobilenetV2/MobilenetV2/input": [1, 512, 512, 3]
@@ -510,7 +521,7 @@ deeplabv3_mnv2_ade20k_uint8_tflite:
510521
opset_constraints:
511522
"onnx":
512523
"min": 10
513-
ptol: 1.5
524+
ptol: 0.1
514525
dequantize: false
515526
inputs:
516527
"MobilenetV2/MobilenetV2/input": [1, 512, 512, 3]
@@ -524,7 +535,7 @@ deeplabv3_mnv2_ade20k_int8_tflite_dequantize:
524535
model: "deeplabv3_mnv2_ade20k_int8.tflite"
525536
model_type: tflite
526537
input_get: get_ade20k_uint8 # the input is uint8 despite the model name
527-
ptol: 3.0
538+
ptol: 0.1
528539
dequantize: true
529540
inputs:
530541
"MobilenetV2/MobilenetV2/input": [1, 512, 512, 3]
@@ -541,7 +552,7 @@ deeplabv3_mnv2_ade20k_int8_tflite:
541552
opset_constraints:
542553
"onnx":
543554
"min": 13
544-
ptol: 1.9
555+
ptol: 0.1
545556
dequantize: false
546557
inputs:
547558
"MobilenetV2/MobilenetV2/input": [1, 512, 512, 3]
@@ -568,6 +579,7 @@ mobilebert_tflite:
568579
- end_logits
569580
- start_logits
570581

582+
571583
palm_detection_tflite:
572584
tf_min_version: 2.1
573585
disabled: false

0 commit comments

Comments
 (0)