Skip to content

Commit bf22784

Browse files
committed
Fixed use_bf16 default value error
Signed-off-by: Cheng, Penghui <[email protected]>
1 parent 1b32eb6 commit bf22784

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

neural_compressor/conf/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ def percent_to_float(data):
840840
str: ops_schema
841841
},
842842
},
843-
Optional('use_bf16', default=False): bool,
843+
Optional('use_bf16', default=True): bool,
844844
Optional('graph_optimization'): graph_optimization_schema,
845845
Optional('mixed_precision'): mixed_precision_schema,
846846

neural_compressor/conf/pythonic_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ def __init__(self,
3939
max_trials=100,
4040
performance_only=False,
4141
reduce_range=None,
42-
use_bf16=False,
42+
use_bf16=True,
4343
accuracy_criterion=accuracy_criterion):
44+
extra_precisions = ["bf16"] if use_bf16 else []
4445
super().__init__(inputs, outputs, backend, device, calibration_sampling_size, op_type_list,
4546
op_name_list, strategy, objective, timeout, max_trials, performance_only,
46-
reduce_range, use_bf16, accuracy_criterion)
47+
reduce_range, extra_precisions, accuracy_criterion)
4748
self._approach = approach
4849

4950
@property

neural_compressor/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,16 +530,16 @@ def strategy(self, strategy):
530530

531531
class PostTrainingQuantConfig(_BaseQuantizationConfig):
532532
def __init__(self,
533-
device='cpu',
533+
device="cpu",
534534
backend="NA",
535535
inputs=[],
536536
outputs=[],
537-
approach='auto',
537+
approach="auto",
538538
calibration_sampling_size=[100],
539539
op_type_list=None,
540540
op_name_list=None,
541541
reduce_range=None,
542-
extra_precisions = [],
542+
extra_precisions = ["bf16"],
543543
tuning_criterion=tuning_criterion,
544544
accuracy_criterion=accuracy_criterion,
545545
):
@@ -578,7 +578,7 @@ def __init__(self,
578578
op_type_list=None,
579579
op_name_list=None,
580580
reduce_range=None,
581-
extra_precisions=[]):
581+
extra_precisions=["bf16"]):
582582
super().__init__(inputs=inputs, outputs=outputs, device=device, backend=backend,
583583
op_type_list=op_type_list, op_name_list=op_name_list,
584584
reduce_range=reduce_range, extra_precisions=extra_precisions)

0 commit comments

Comments
 (0)