Skip to content

Commit

Permalink
Merge pull request openvinotoolkit#102 from eaidova/ea/add_all_layers…
Browse files Browse the repository at this point in the history
…_option

add --all_layers option
  • Loading branch information
eaidova committed Dec 22, 2023
2 parents 27b3d88 + cf8f29f commit 6787f31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions llm_bench/python/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,8 +1151,6 @@ def main():
parser.add_argument('-o', '--output_dir', required=True, help='output directory for saving model')
parser.add_argument('--save_orig', action='store_true', help='save pytorch model on disk')
parser.add_argument('-p', '--precision', choices=['FP32', 'FP16'], default='FP32', help='base conversion precision')
parser.add_argument('--bettertransformer', action='store_true',
help='Apply bettertransformer to enable ScaledDotProductAttention operation for a part of the models')

compression_group = parser.add_argument_group('Weights compression parameters')
compression_group.add_argument(
Expand Down Expand Up @@ -1187,6 +1185,11 @@ def main():
default=None,
type=int,
)
compression_group.add_argument(
"--all_layers",
action="store_true",
help="Compress all layers including embeddings and prediction head"
)
add_stateful_model_arguments(parser)

args = parser.parse_args()
Expand Down
2 changes: 2 additions & 0 deletions llm_bench/python/utils/conversion_utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def compress_ov_model_weights_helper(ov_model, tok, config, out_path, compress_w
compression_args["ratio"] = args.ratio
if args.group_size is not None:
compression_args["group_size"] = args.group_size
if args.all_layers:
compression_args["all_layers"] = True
log.info("Compression options:")
log.info(compression_args)
compressed_ov_model = compress_weights(ov_model, **compression_args)
Expand Down

0 comments on commit 6787f31

Please sign in to comment.