No such file or directory with --use_external_data_form and int8 (#6867)

Implemented following change to avoid the error when using both --use_external_data_form and --precision int8 with GPT2LMHeadModel, which results in
line 161, in save_external_data; open(external_data_file_path, 'ab').close()
FileNotFoundError: [Errno 2] No such file or directory:
This may also be related to the identified bug #6047.
This commit is contained in:
Reuben Zotz-Wilson 2021-03-05 00:14:23 +01:00 committed by GitHub
parent 679718b12f
commit 107c9672fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,6 +68,7 @@ class QuantizeHelper:
if use_external_data_format:
from pathlib import Path
Path(quantized_model_path).parent.mkdir(parents=True, exist_ok=True)
onnx.external_data_helper.convert_model_to_external_data(quantized_onnx_model,
all_tensors_to_one_file=True,
location=Path(quantized_model_path).name + ".data")