Add an option to store the quantized weights as INT8 on the GNA speech sample (#11838)
This commit is contained in:
@@ -9,6 +9,7 @@ from openvino.tools.pot.utils.logger import init_logger
|
||||
from openvino.tools.pot.api.samples.utils.argument_parser import get_common_argparser
|
||||
from openvino.tools.pot.api.samples.speech.data_loader import ArkDataLoader
|
||||
from openvino.tools.pot.engines.simplified_engine import SimplifiedEngine
|
||||
from openvino.tools.pot.graph.model_utils import compress_model_weights
|
||||
|
||||
|
||||
def parse_args():
|
||||
@@ -59,6 +60,11 @@ def parse_args():
|
||||
help='Subset size for calibration',
|
||||
default=2000,
|
||||
type=int)
|
||||
parser.add_argument(
|
||||
'-q',
|
||||
'--write_quantized_weights_to_bin_file',
|
||||
help='Write the quantized weights as INT8 to the output IR bin file',
|
||||
action="store_true")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -127,6 +133,10 @@ def main():
|
||||
os.makedirs(out_dir)
|
||||
init_logger(level=args.log_level, file_name=os.path.join(out_dir, 'log.txt'))
|
||||
compressed_model = optimize_model(args)
|
||||
|
||||
if args.write_quantized_weights_to_bin_file:
|
||||
compress_model_weights(model=compressed_model)
|
||||
|
||||
save_model(compressed_model, out_dir)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user