WebAssembly / wasi-nn

Neural Network proposal for WASI
429 stars 34 forks source link

Number of graph encodings #30

Open EdorianDark opened 1 year ago

EdorianDark commented 1 year ago

An alternative of specifying an encoding for each possible back end would be to use Open Neural Network Exchange. It is possible to export a model from Pytorch or Tensorflow into the onnx format and use then a runtime like Pytorch or Tensorflow for interference. That would mean, that users could use their favorite framework and only one backend would have to be supported. This would be more in the spirit of WebNN, which doesn't specify the back end.

Interesting for wasmtime could be tract an implementation of onnx in Rust.

abrown commented 1 year ago

I do not think (yet) that this specification should pick a single encoding format for models. ONNX may be a good choice for some users but not for others; it is hard to justify picking "the standard encoding format" in this specification. If the ecosystem eventually moves to a single encoding format, then I agree that wasi-nn should fix the encoding format and just use that. Until then, it seems useful to allow users to choose.

EdorianDark commented 1 year ago

If I read WebNN correctly, then there is no encoding format defined. Instead there are some builder constructors, which are then used to build the graph. Since the graph building is not in the hot path, this should not lead to problems. Could that be an alternative also here?