diff --git a/ml-example.md b/ml-example.md index bf82f84..9b508b0 100644 --- a/ml-example.md +++ b/ml-example.md @@ -2,7 +2,7 @@

wasi-nn is a WASI API for performing machine learning (ML) inference. The API is not (yet) capable of performing ML training. WebAssembly programs that want to use a host's ML capabilities can access these capabilities through wasi-nn's core abstractions: graphs and -tensors. A user loads a model -- instantiated as a graph -- to use in an ML backend. +tensors. A user loads an ML model -- instantiated as a graph -- to use in an ML backend. Then, the user passes tensor inputs to the graph, computes the inference, and retrieves the tensor outputs.

This example world shows how to use these primitives together.

@@ -62,8 +62,8 @@ memory--e.g., using row-major ordering--and could perhaps be improved.

  • busy
  • runtime-error
  • unsupported-operation
  • -
  • model-too-large
  • -
  • model-not-found
  • +
  • too-large
  • +
  • not-found
  • Import interface wasi:nn/graph

    A graph is a loaded instance of a specific ML model (e.g., MobileNet) for a specific ML @@ -119,18 +119,18 @@ graph IR in parts (e.g., OpenVINO stores its IR and weights separately).

    -

    load-named-model: func

    +

    load-by-name: func

    Load a graph by name.

    How the host expects the names to be passed and how it stores the graphs for retrieval via this function is implementation-specific. This allows hosts to choose name schemes that range from simple to complex (e.g., URLs?) and caching mechanisms of various kinds.

    Params
    Return values

    Import interface wasi:nn/inference

    An inference "session" is encapsulated by a graph-execution-context. This structure binds a diff --git a/wasi-nn.witx b/wasi-nn.witx index efc841d..30f921b 100644 --- a/wasi-nn.witx +++ b/wasi-nn.witx @@ -11,8 +11,8 @@ $busy $runtime_error $unsupported_operation - $model_too_large - $model_not_found + $too_large + $not_found ) ) (typename $tensor_dimensions (list u32)) @@ -63,7 +63,7 @@ (result $error (expected $graph (error $nn_errno))) ) (@interface func (export "load_by_name") - (param $model_name string) + (param $name string) (result $error (expected $graph (error $nn_errno))) ) (@interface func (export "init_execution_context") diff --git a/wit/wasi-nn.wit b/wit/wasi-nn.wit index 539551f..fcb2126 100644 --- a/wit/wasi-nn.wit +++ b/wit/wasi-nn.wit @@ -3,7 +3,7 @@ package wasi:nn /// `wasi-nn` is a WASI API for performing machine learning (ML) inference. The API is not (yet) /// capable of performing ML training. WebAssembly programs that want to use a host's ML /// capabilities can access these capabilities through `wasi-nn`'s core abstractions: _graphs_ and -/// _tensors_. A user `load`s a model -- instantiated as a _graph_ -- to use in an ML _backend_. +/// _tensors_. A user `load`s an ML model -- instantiated as a _graph_ -- to use in an ML _backend_. /// Then, the user passes _tensor_ inputs to the _graph_, computes the inference, and retrieves the /// _tensor_ outputs. /// @@ -97,7 +97,7 @@ interface graph { /// How the host expects the names to be passed and how it stores the graphs for retrieval via /// this function is **implementation-specific**. This allows hosts to choose name schemes that /// range from simple to complex (e.g., URLs?) and caching mechanisms of various kinds. - load-named-model: func(name: string) -> result + load-by-name: func(name: string) -> result } /// An inference "session" is encapsulated by a `graph-execution-context`. This structure binds a @@ -138,11 +138,11 @@ interface errors { busy, // Runtime Error. runtime-error, - // Unsupported operation + // Unsupported operation. unsupported-operation, - // Model too large - model-too-large, - // Model not found - model-not-found + // Graph is too large. + too-large, + // Graph not found. + not-found } }