microsoft / microsoft/onnxruntime-inference-examples
Getting error when creating inference session *Browser*
Open
@fs-eire is already working on this.
Since Sep 24, 2021.
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 414
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 14
Description
Running into an error when trying to create an Inference session. Using React and onnx runtime web. I am using a custom model I ported over from PyTorch.
error below
TypeError: Cannot read properties of null (reading 'irVersion')
at t.loadFromOrtFormat (ort-web.min.js:6)
at t.load (ort-web.min.js:6)
at ort-web.min.js:6
at t.event (ort-web.min.js:6)
at t.initialize (ort-web.min.js:6)
at t.<anonymous> (ort-web.min.js:6)
at ort-web.min.js:6
at Object.next (ort-web.min.js:6)
at a (ort-web.min.js:6)
Here is how I am creating an array buffer from model
const created = async () => {
// fetch the model file to be used later
try {
const response = await fetch(onyxModelFilepath);
const modelFile = await response.arrayBuffer();
setModelFile(modelFile);
} catch (e) {
console.log(e);
setModelLoadingError(true);
}
};
and then creating a session from the said model which is where I am receiving the error
export async function createModel(model) {
try {
return await InferenceSession.create(model);
} catch (e) {
console.error(e);
}
}
How I converted my PyTorch model
net.eval()
input_names = ["input"]
# output names
output_names = ["output"]
# dummy input data
dummy_input = torch.randn(1, 3, 256, 256)
torch.onnx.export(
net.to(self.device),
dummy_input,
'./classic_sr_gan.onnx',
input_names=input_names,
output_names=output_names,
opset_version=11
)
original repo I cloned to train model
Let me know if you need more context/information. Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.