second-state / WasmEdge-WASINN-examples

Apache License 2.0
217 stars 35 forks source link

[Example] ggml: use wasmedge-wasi-nn crate #108

Closed dm4 closed 2 months ago

dm4 commented 2 months ago

Because we have replaced the original wasi-nn crate with wasmedge-wasi-nn, we need to make corresponding modifications in the examples.

juntao commented 2 months ago

Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR.


Commit b15986b849221c21cb7306f835ba5a698e6b820e

Summary:

Potential Problems:

  1. Import Changes in Source Files: The source files have been updated to import from the wasmedge_wasi_nn crate instead of wasi_nn. Make sure all references to types and methods have been updated correctly as per the new crate.

  2. Binary Patch: The patch contains binary changes in the wasmedge-ggml/chatml/wasmedge-ggml-chatml.wasm file. Ensure that these changes are expected and do not introduce any unexpected behavior.

  3. Size Changes: The size of the .wasm files has changed, indicating potential differences in the compiled code. Verify that the changes in size are intended and do not adversely impact the functionality or performance.

  4. Error Handling: Error handling has been updated to use the new crate's error types (Error, BackendError). Ensure that error handling logic still works as intended with these updates.

  5. Serialization: The code uses serde_json for serialization. Verify that serialization and deserialization with this library continue to function correctly with the updated code.

  6. Context Handling: The patch includes changes in context handling. Make sure that the alterations related to GraphBuilder, GraphEncoding, and ExecutionTarget do not introduce logic errors.

  7. Crate Compatibility: Ensure that the updated wasmedge-wasi-nn crate is compatible with the existing codebase and does not break any existing functionality.

  8. Code Formatting: Verify that the code formatting remains consistent after the changes to ensure readability and maintainability.

Ensure thorough testing is conducted to validate the changes and address any potential issues that may arise from the patch.