-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
onnx.load() | DecodeError: Error parsing message #10342
Comments
I had to re-develop this notebook in order to work with Albert. Might the
|
I can successfully evaluate the model before exporting to ONNX. Yet the export code hasn't been altered. |
You can also file an issue with ONNX for broader audience (onnx standard library is a separate product). |
We have a tool that could export and test ALBert. Currently, it only support one input (input_ids): Both fp32 and int8 ONNX model generated in this way could run in my machine. |
Is If so, where can I run this in my AWS SageMaker Jupyter Lab? Thanks for getting back guys :) |
I updated the torch.onnx.export(model, # model being run
inputs['input_ids'], # model input (or a tuple for multiple inputs)
#inputs['attention_mask'],
#inputs['token_type_ids']), # model input (or a tuple for multiple inputs)
onnx_model_path, # where to save the model (can be a file or file-like object)
opset_version=11, # the ONNX version to export the model to
do_constant_folding=True, # whether to execute constant folding for optimization
input_names=['input_ids', # the model's input names
'input_mask',
'segment_ids'],
output_names=['output'], # the model's output names
dynamic_axes={'input_ids': symbolic_names, # variable length axes
'input_mask' : symbolic_names,
'segment_ids' : symbolic_names})
logger.info("ONNX Model exported to {0}".format(onnx_model_path)) This lead to the same DecodeError on |
I had to Terminal:
Outputs:
Move outputs to use/ download:
|
Can you pass a parameter to have the models be Optimised? Is there a usage documentation on these commands? |
@tianleiwu I ran both Traceback:
|
The problem is pre-quantisation. Any Quantisation code I try, throws the same error. I've swapped out: from transformers import (BertConfig, BertForSequenceClassification, BertTokenizer,) for: from transformers import (AlbertConfig, AlbertForSequenceClassification, AlbertTokenizer,) However, |
The problem isn't Optimisation. I've ran my version of the Notebook with and without Optimisation code; the same error returns. Running the original Notebook without Optimisation gives same outputs, and scores. |
Might my issue be with Also, How can I check if my .onnx files are corrupted or not? @edgchen1 @yuslepukhin @tianleiwu |
I am using textattack/albert-base-v2-MRPC: git clone https://huggingface.co/textattack/albert-base-v2-MRPC
mv albert-base-v2-MRPC/ SageMaker/ And updated: configs.model_name_or_path = "albert-base-v2-MRPC" Only for it to throw the same error. |
I've set up a Google Colab with the runtime |
The problem was with updating the Changes: configs.output_dir = "albert-base-v2-MRPC"
configs.model_name_or_path = "albert-base-v2-MRPC" I then came across this separate issue, where I hadn't Lastly, HuggingFace 🤗 does not have an equivalent to Feel free to comment for further clarification. |
@danielbellhv, you can try the following command instead since you want to run MRPC: Try Related onnx export code can be found in
|
Bug issue.
Goal: re-develop this BERT Notebook to use textattack/albert-base-v2-MRPC.
Kernel:
conda_pytorch_p36
. Deleted all output files and did Restart & Run All.I can successfully create and save an ONNX model from HuggingFace Transformers model in run time memory. Error occurs when
onnx.load()
, from storage into memory.Are my ONNX files corrupted?
albert.onnx
andalber.opt.onnx
here.Section 2.1 - export in-memory PyTorch model as ONNX model:
Then optimisation:
Section 2.2 Quantize ONNX model:
Traceback:
Output Files:
Please let me know if there's anything else I can add to post.
The text was updated successfully, but these errors were encountered: