Skip to content

Commit cde72c8

Browse files
Update spr-base version number (#259)
Signed-off-by: Lv, Liang1 <[email protected]> Co-authored-by: chen, suyue <[email protected]>
1 parent e996a93 commit cde72c8

File tree

8 files changed

+20
-10
lines changed

8 files changed

+20
-10
lines changed

.azure-pipelines/scripts/ut/env_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ echo "mxnet version is $mxnet_version"
2020
if [[ "${tensorflow_version}" == *"-official" ]]; then
2121
pip install tensorflow==${tensorflow_version%-official}
2222
elif [[ "${tensorflow_version}" == "spr-base" ]]; then
23-
pip install /tf_dataset/tf_binary/221204/tensorflow*.whl
23+
pip install /tf_dataset/tf_binary/221212/tensorflow*.whl
2424
if [[ $? -ne 0 ]]; then
2525
exit 1
2626
fi

neural_compressor/adaptor/tensorflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(self, framework_specific_info):
8383

8484
from pkg_resources import parse_version
8585
import tensorflow as tf
86-
self.new_api = parse_version(tf.version.VERSION) == parse_version('2.11.0202242')
86+
self.new_api = tf.version.VERSION in ('2.11.0202242', '2.11.0202250')
8787
self.qdq_enabled = self.itex_mode or self.format == 'QDQ' or self.new_api
8888
self.op_wise_sequences = self.query_handler.get_eightbit_patterns(self.qdq_enabled)
8989
self.optimization = self.query_handler.get_grappler_optimization_cfg()

neural_compressor/adaptor/tensorflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
---
1717
-
1818
version:
19-
name: ['2.11.0202242']
19+
name: ['2.11.0202242', '2.11.0202250']
2020

2121
precisions:
2222
names: int8, uint8, bf16, fp32

neural_compressor/adaptor/tf_utils/graph_converter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from .transform_graph.bias_correction import BiasCorrection
3737
from .util import generate_feed_dict, iterator_sess_run,version1_gt_version2,version1_eq_version2
3838
from .util import version1_gte_version2,version1_lte_version2,version1_lt_version2
39+
from .util import TF_SPR_BASE_VERSIONS
3940
from .quantize_graph.quantize_graph_for_intel_cpu import QuantizeGraphForIntel
4041
from .quantize_graph_common import QuantizeGraphHelper
4142
from .quantize_graph.qdq.optimize_qdq import OptimizeQDQGraph
@@ -268,7 +269,7 @@ def _check_tf_version(self):
268269
if version1_eq_version2(tf.version.VERSION, '1.15.0-up3'):
269270
is_supported_version = True
270271

271-
if version1_eq_version2(tf.version.VERSION, '2.11.0202242'):
272+
if tf.version.VERSION in TF_SPR_BASE_VERSIONS:
272273
is_supported_version = True
273274
is_sprbase_version = True
274275

neural_compressor/adaptor/tf_utils/graph_converter_without_calib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
from .graph_rewriter.int8.post_quantized_op_cse import PostCseOptimizer
4545
from .graph_rewriter.int8.meta_op_optimizer import MetaInfoChangingMemOpOptimizer
4646
from .graph_rewriter.int8.rnn_convert import QuantizedRNNConverter
47-
from .util import version1_gte_version2,version1_gt_version2,version1_eq_version2, version1_lt_version2
47+
from .util import version1_gte_version2,version1_gt_version2,version1_eq_version2,version1_lt_version2
48+
from .util import TF_SPR_BASE_VERSIONS
4849

4950
TF_SUPPORTED_MAX_VERSION = '2.11.0'
5051
TF_SUPPORTED_MIN_VERSION = '1.14.0'
@@ -118,8 +119,8 @@ def _check_tf_version(self):
118119

119120
if version1_eq_version2(tf.version.VERSION, '1.15.0-up3'):
120121
is_supported_version = True
121-
122-
if version1_eq_version2(tf.version.VERSION, '2.11.0202242'):
122+
123+
if tf.version.VERSION in TF_SPR_BASE_VERSIONS:
123124
is_supported_version = True
124125
is_sprbase_version = True
125126

neural_compressor/adaptor/tf_utils/graph_rewriter/generic/fuse_gelu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from neural_compressor.adaptor.tf_utils.graph_util import GraphAnalyzer
2121
from neural_compressor.adaptor.tf_utils.graph_util import GraphRewriterHelper as Helper
2222
from tensorflow.python.framework import dtypes
23-
from neural_compressor.adaptor.tf_utils.util import version1_eq_version2
23+
from neural_compressor.adaptor.tf_utils.util import TF_SPR_BASE_VERSIONS
2424

2525

2626
class FuseGeluOptimizer(GraphRewriterBase): # pragma: no cover
@@ -29,7 +29,7 @@ class FuseGeluOptimizer(GraphRewriterBase): # pragma: no cover
2929

3030
def do_transformation(self):
3131
if not (tf.version.VERSION in ('1.15.0-up2','1.15.0-up3') or \
32-
version1_eq_version2(tf.version.VERSION, '2.11.0202242')):
32+
tf.version.VERSION in TF_SPR_BASE_VERSIONS):
3333
return self.model
3434

3535
cur_graph = GraphAnalyzer()

neural_compressor/adaptor/tf_utils/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from .graph_util import GraphRewriterHelper
3131
from pkg_resources import parse_version
3232

33+
TF_SPR_BASE_VERSIONS = ('2.11.0202242', '2.11.0202250')
34+
3335
def version1_lt_version2(version1, version2):
3436
return parse_version(version1) < parse_version(version2)
3537

test/itex/test_tensorflow_itex_basic.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import shutil
77
import yaml
88
import platform
9+
from tensorflow.python.platform import gfile
910
from neural_compressor.adaptor.tf_utils.util import disable_random
1011
from neural_compressor.experimental import Quantization, Benchmark, common
1112
from neural_compressor.adaptor.tf_utils.util import version1_lt_version2, version1_gte_version2
@@ -239,6 +240,9 @@ def test_itex_benchmark_gpu(self):
239240
relu = tf.nn.relu(add)
240241
relu6 = tf.nn.relu6(relu, name='op_to_store')
241242
out_name = relu6.name.split(':')[0]
243+
num_of_instance = 1
244+
cores_per_instance = 1
245+
log_file = ''
242246
with tf.compat.v1.Session() as sess:
243247
sess.run(tf.compat.v1.global_variables_initializer())
244248
output_graph_def = graph_util.convert_variables_to_constants(
@@ -257,11 +261,13 @@ def test_itex_benchmark_gpu(self):
257261
evaluator.b_dataloader = common.DataLoader(dataset)
258262
num_of_instance = evaluator.conf.usr_cfg.evaluation.performance.configs.num_of_instance
259263
cores_per_instance = evaluator.conf.usr_cfg.evaluation.performance.configs.cores_per_instance
264+
log_file = '{}_{}_{}.log'.format(num_of_instance, cores_per_instance, 0)
265+
if gfile.Exists(log_file):
266+
os.remove(log_file)
260267
evaluator.model = output_graph
261268
evaluator('performance')
262269

263270
found_multi_instance_log = False
264-
log_file = '{}_{}_{}.log'.format(num_of_instance, cores_per_instance, 0)
265271
for file_name in os.listdir(os.getcwd()):
266272
if file_name == log_file:
267273
found_multi_instance_log = True

0 commit comments

Comments
 (0)