Skip to content

Commit

Permalink
fix gptq models conversion (openvinotoolkit#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Dec 22, 2023
1 parent 6787f31 commit bf42971
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llm_bench/python/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ def ts_patched_forward(
args.compress_weights and not is_torch_compression(args) and is_ov_model_provided(args.model_id, args.output_dir, args.precision)
)
gptq_applied = is_gptq(config)
precision = precision if not gptq_applied else GPTQ_DIR.format(args.precision)
precision = precision if not gptq_applied else GPTQ_DIR.format(presision=args.precision)
if post_init is not None:
model_kwargs = {"torch_dtype": torch.float32}
pt_model = None
Expand Down Expand Up @@ -885,7 +885,7 @@ def convert_to_ov(pt_model, tok, out_path, compress_to_fp16=False):
)
compress_to_fp16 = is_fp16(args)
gptq_applied = is_gptq(config)
precision = precision if not gptq_applied else GPTQ_DIR.format(args.precision)
precision = precision if not gptq_applied else GPTQ_DIR.format(precision=args.precision)
tokenizer_id = args.tokenizer_id or args.model_id
tok = AutoTokenizer.from_pretrained(tokenizer_id, trust_remote_code=True)
ov_out_path = Path(args.output_dir) / PYTORCH_DIR / OV_DIR / precision
Expand Down Expand Up @@ -981,7 +981,7 @@ def convert_to_ov(pt_model, tok, out_path, compress_to_fp16=False):
tokenizer_id = args.tokenizer_id or args.model_id
tok = AutoTokenizer.from_pretrained(tokenizer_id, trust_remote_code=True)
gptq_applied = is_gptq(config)
precision = precision if not gptq_applied else GPTQ_DIR.format(args.precision)
precision = precision if not gptq_applied else GPTQ_DIR.format(precision=args.precision)
if post_init is not None:
model_kwargs = {"torch_dtype": torch.float32}
pt_model = None
Expand Down
1 change: 1 addition & 0 deletions llm_bench/python/utils/conversion_utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def is_ov_model_provided(model_id, model_dir, precision, model_name="openvino_mo
model_dirs.append(Path(model_id) / precision)
model_dirs.append(Path(model_id) / OV_DIR / precision)
model_dirs.append(Path(model_id) / PYTORCH_DIR / OV_DIR / precision)
model_dir = Path(model_dir)
model_dirs.append(model_dir)
model_dirs.append(model_dir / precision)
model_dirs.append(model_dir / OV_DIR / precision)
Expand Down

0 comments on commit bf42971

Please sign in to comment.