Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] default preset to mixed #2839

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions nncf/quantization/algorithms/min_max/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,7 @@ def __init__(

# preset definition
if self._preset is None:
if model_type == ModelType.TRANSFORMER:
self._preset = QuantizationPreset.MIXED
else:
self._preset = QuantizationPreset.PERFORMANCE
self._preset = QuantizationPreset.MIXED

self._override_device()
self._set_mode_based_defaults()
Expand Down
12 changes: 10 additions & 2 deletions tests/openvino/tools/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import nncf
from nncf.common.deprecation import warning_deprecated
from nncf.common.logging.logger import nncf_logger
from nncf.common.logging.logger import set_log_file
from nncf.common.quantization.structs import QuantizationPreset
from nncf.common.quantization.structs import QuantizationScheme
Expand Down Expand Up @@ -1076,22 +1077,29 @@ def update_nncf_algorithms_config(nncf_algorithms_config: Dict[str, Dict[str, An
print(f"Updated subset_size value for {nncf_method} method to {new_subset_size} ")


def upd_preset(nncf_algorithms_config: Dict[str, Dict[str, Any]]) -> None:
for _, config in nncf_algorithms_config.items():
upd_preset = "mixed"
config["preset"] = QuantizationPreset(upd_preset)
nncf_logger.info(f"Updated preset value to {upd_preset} ")


def main():
args = parse_args()
if args.impl is not None:
print("--impl option is deprecated and will have no effect. Only native calibration allowed.")
config = Config.read_config(args.config)
config = filter_configuration(config)

set_log_file(f"{args.output_dir}/log.txt")
xml_path, bin_path = get_model_paths(config.model)
accuracy_checker_config = get_accuracy_checker_config(config.engine)
nncf_algorithms_config = get_nncf_algorithms_config(config.compression, args.output_dir)
upd_preset(nncf_algorithms_config)
assert args.batch_size >= 0
if args.batch_size > 1:
update_accuracy_checker_config(accuracy_checker_config, args.batch_size)
update_nncf_algorithms_config(nncf_algorithms_config, args.batch_size)

set_log_file(f"{args.output_dir}/log.txt")
output_dir = os.path.join(args.output_dir, "optimized")
os.makedirs(output_dir, exist_ok=True)

Expand Down
Loading