Comments (18)
Mine is solved. Not very difficult to solve. The problem is related to ONNX.
Solution1(It should solve most people's problem, but I didn't use it):
One of the issues and solutions is ONNX does not support all the features of a Pytorch. Sometimes you have to degrade the version of ONNX to the older one to have certain features. On the other hand, you may find out the older version doesn't support another important feature. But trust me, you will find a better way to solve it, which is what I did when I was using on ReactJs.
Solution2
It was my solution that was about digging into ONNX itself. Thus, I suggest you talk to the ONNX coder to solve your issue.
Not that difficult to solve. Here is mine which is solved and runs perfectly🤣
If you have an interesting project. feel free to contact me. Maybe there is a possibility that I can solve it if I have free time on that day if it is running in Tensorflow, Kernes(TF2), or Pytorch.
from onnxjs.
Can this be solved or not?
I am having same error using below code, which worked fine in onnxruntime
python and CPP.
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/onnx.min.js"></script>
<!-- Code that consume ONNX.js -->
<script>
// create a session
const myOnnxSession = new onnx.InferenceSession();
// load the ONNX model file
myOnnxSession.loadModel("./200_0.19.onnx").then(() => {
// generate model input
// const inferenceInputs = getInputs();
// console.log(inferenceInputs)
// execute the model
// myOnnxSession.run(inferenceInputs).then((output) => {
// // consume the output
// const outputTensor = output.values().next().value;
// console.log(`model output tensor: ${outputTensor.data}.`);
// });
});
</script>
I built onnxjs using master branch of this repository, but still getting same error.
from onnxjs.
what the heck guys, "I solved this" then no more details, or "Here's 2 solutions: one, I don't know if it works, and second one is talk the ONNX coder"
I was hoping for an actual solution to this...
from onnxjs.
Repeating what I said above, the Shape operation was added after the latest version (v0.1.8) was released. We won't be able to use the Shape operation until a new version is released.
You can verify this by downloading the snapshot of the code for the release and see that it does not contain the file lib/ops/Shape.ts
from onnxjs.
I still see this error using version 0.1.8.
from onnxjs.
onnxjs-node
cannot work in browser environments. it does not work with worker-loader
either, as the latter is specifically targeting running in webworker.
supporting Shape
is a known issue as referenced in #84
from onnxjs.
The operator Shape
is now available in version 0.1.8.
from onnxjs.
The shape.ts file hit the master branch on Sep 1 but 0.1.8 was released on August 28, so maybe it just missed the cut to make it into 0.1.8?
from onnxjs.
Mine is 0.1.8 too! I am not using a nodejs, but Reactjs.
from onnxjs.
What backend are u using?
It's only implemented in the cpu backend.
from onnxjs.
It was all backend failed. The problem is solved.
from onnxjs.
I do not understand your message, but good thing if it works.
from onnxjs.
Hi, I am using backendHint="cpu" with onnxjs 0.1.8 but got the same error
TypeError: cannot resolve operator 'Shape' with opsets: ai.onnx v9
at Object.e.resolveOperator (onnx.min.js:1)
at t.resolve (onnx.min.js:14)
at e.initializeOps (onnx.min.js:14)
at onnx.min.js:14
at t.event (onnx.min.js:1)
at e.initialize (onnx.min.js:14)
at e.<anonymous> (onnx.min.js:14)
at onnx.min.js:14
at Object.next (onnx.min.js:14)
at a (onnx.min.js:14)
@JonathanSum how did you solve the problem?
@28Smiles maybe any advices how to solve it?
from onnxjs.
Uncaught (in promise) TypeError: cannot resolve operator 'SVMClassifier' with opsets: ai.onnx v9, ai.onnx.ml v
Built onnxjs with master branch & it seems that SVMClassifier is not supported ops for wasm.
(list of supported functions are mentioned)
from onnxjs.
I also have same issue saying "Uncaught (in promise) TypeError: cannot resolve operator 'Shape' with opsets: ai.onnx v9".
Should I modify a model I using not to pass "shape" things???
I feel it will be ok if I can rewrite "Shape" to "ReShape" in the onnx model, but is this possible?
If not, I should retrain things right?
from onnxjs.
@JonathanSum
Congratulations.
Is there any ported SVMClassifier ops that can be easily integrated with wasm_ops
from onnxjs.
This is not necessarily a webpack issue (as far as I know)... there are multiple reasons why this error might occur. The most common reason is using really custom reshaping operation in your PyTorch's model definition in python... like x.view(-1, x.size(0))
, or x.reshape(x.shape[0], ...)
....
What solved the issue for me is by making sure that your python code is saying explicit numbers (1, 2, 256, 512, ...)... not x.size(0)
For this, you might need to log every reshaping step and print the shapes, and then use those values to make reshaping explicit and convert the model again to onnx format.
Hope this finally helps 😪
from onnxjs.
getting the TypeError: cannot resolve operator 'Shape' with opsets: ai.onnx v10
with a mobilenet model from onnx model zoo?
https://github.com/onnx/models/blob/master/vision/classification/mobilenet/model/mobilenetv2-7.onnx
using [email protected]
from onnxjs.
Related Issues (20)
- webgl seems not to work (or be used) HOT 3
- cannot resolve operator 'Pow' with opsets: ai.onnx v9 HOT 1
- add example: RangeError: index out of range: 128 + 1 > 128
- Scikit-Learn to Onnx to Onnx.js problems HOT 10
- Support for SELU HOT 1
- Chrome Extension Manifest V3 and onnx.js
- Adding TopK: docs/operators.md pre-commit hook failed HOT 2
- TopK-1 CPU unittests HOT 1
- Fully convolutional network - cannot reuse inference session with different input shape HOT 1
- attribute.ts:122 Uncaught (in promise) Error: graph attribute is not supported yet HOT 2
- Active Development HOT 1
- Is there any function to ouput weight matrix for layers? HOT 1
- Error: input 'attention_mask' is missing in 'feeds'. HOT 1
- TypeError: cannot resolve operator 'Shape' with opsets: ai.onnx v12 HOT 3
- Error: unrecognized input '' for node: Resize_61 HOT 1
- ResNet50 Example with 94mb resnet50.onnx times out on Chrome with "Page Unresponsive" HOT 1
- Formator for pre-commit (PR Help) HOT 1
- TypeError: cannot resolve operator 'ReduceL2' with opsets: ai.onnx v10 HOT 1
- TypeError: cannot resolve operator 'Shape' with opsets: ai.onnx v11 HOT 2
- Add operator on the fly with js script
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onnxjs.