Skip to content
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

Quantisation step for canned t5-small model persistently fails (See details) #15

Closed
PrithivirajDamodaran opened this issue Jun 10, 2021 · 2 comments

Comments

@PrithivirajDamodaran
Copy link

PrithivirajDamodaran commented Jun 10, 2021

Executed the below code, it fails with the following error. Please advice.

Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from /content/models/t5-small-decoder-quantized.onnx failed:This is an invalid model. Error: Duplicate definition of name (pkv_11).

from fastT5 import (OnnxT5, get_onnx_runtime_sessions,
generate_onnx_representation, quantize)
from transformers import AutoTokenizer

model_or_model_path = 't5-small'

# Step 1. convert huggingfaces t5 model to onnx
onnx_model_paths = generate_onnx_representation(model_or_model_path)

# Step 2. (recommended) quantize the converted model for fast inference and to reduce model size.
quant_model_paths = quantize(onnx_model_paths)

# step 3. setup onnx runtime
model_sessions = get_onnx_runtime_sessions(quant_model_paths)

# step 4. get the onnx model
model = OnnxT5(model_or_model_path, model_sessions)
@Ki6an
Copy link
Owner

Ki6an commented Jun 10, 2021

the latest version of onnxruntime is what causes the issue, you can fix it by downgrading the onnxruntime to 1.7.0 or below.

@Ki6an Ki6an closed this as completed Jun 10, 2021
@PrithivirajDamodaran
Copy link
Author

Works like a charm, Thanks Kiran!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants