-
Notifications
You must be signed in to change notification settings - Fork 39
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
[Examples] Add the named model feature into pytorch demo. #27
Conversation
Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR. Commit e54da7c2a7b1ca36e3d0bd1be52f84ef8e5d5dfcKey changes in the patch:
Potential problems:
|
|
||
|
||
```bash | ||
wasmedge --dir .:. --nn-preload demo:PyTorch:CPU:mobilenet.pt wasmedge-wasinn-example-mobilenet-image-named-model.wasm demo input.jpg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what the demo:PyTorch:CPU:mobilenet.pt
name means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is defined in the named model feature: --nn-preload
Ref: WebAssembly/wasi-nn#36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this format could be determined by the runtime implementation.
I mostly followed his original proposal style <name>:<encoding>:<model path>
.
But I add the necessary info for build model graph, format will follow <name>:<encoding>:<target>:<model path>
.
And the name need the same with load_from_cache(<name>) inside .rs
I will update README.md later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the encoding and target are determined by the API calls in the code. What if the information in the name conflicts with the settings in the code? Why do we have to repeat ourselves here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, wasi_ephemeral_nn::load_by_name
doesn't have parameters to specify the target and encoding of building the graph. Similarly, you can't assign a name to a model through build_from_files
( or bytes
) relying on wasi_ephemeral_nn::load
(loading a model from WebAssembly). These two mechanisms, IIUC from the API definition, there don't have interoperability. By the way, there's a scenario where --nn-preload
multiple models with conflicting names can occur (our implementation the later one will overwrite the earlier one).
3793eda
to
2316419
Compare
Signed-off-by: vincent <[email protected]>
2316419
to
e54da7c
Compare
This PR is pending for the wasinn plugin 0.13.4 release.Ready