update instructions

following, `prepare` doesn't alloc anymore, `ExeWithWeights` is
`ModuleExe`
This commit is contained in:
Foke Singh 2023-10-26 13:56:56 +00:00
parent 27c8309424
commit eb20548241
2 changed files with 5 additions and 4 deletions

View File

@ -144,12 +144,12 @@ corresponding types.
3. Compile the model struct and its `forward` function into an executable. 3. Compile the model struct and its `forward` function into an executable.
`foward` is a `Tensor -> Tensor` function, executable is a `foward` is a `Tensor -> Tensor` function, executable is a
`zml.Exe(Model.forward)` `zml.FnExe(Model.forward)`
4. Load the model weights from disk, onto accelerator memory -> 4. Load the model weights from disk, onto accelerator memory ->
`zml.Bufferized(Model)` struct (with `zml.Buffer` inside) `zml.Bufferized(Model)` struct (with `zml.Buffer` inside)
5. Bind the model weights to the executable `zml.ExeWithWeight(Model.forward)` 5. Bind the model weights to the executable `zml.ModuleExe(Model.forward)`
6. Load some user inputs (custom struct), encode them into arrays of numbers 6. Load some user inputs (custom struct), encode them into arrays of numbers
(`zml.HostBuffer`), and copy them to the accelerator (`zml.Buffer`). (`zml.HostBuffer`), and copy them to the accelerator (`zml.Buffer`).

View File

@ -282,7 +282,8 @@ executable.
```zig ```zig
// pass the model weights to the compiled module to create an executable module // pass the model weights to the compiled module to create an executable module
var executable = try compiled.prepare(arena, model_weights); // all required memory has been allocated in `compile`.
var executable = compiled.prepare(model_weights);
defer executable.deinit(); defer executable.deinit();
``` ```
@ -498,7 +499,7 @@ pub fn asyncMain() !void {
// pass the model weights to the compiled module to create an executable // pass the model weights to the compiled module to create an executable
// module // module
var executable = try compiled.prepare(arena, model_weights); var executable = compiled.prepare(model_weights);
defer executable.deinit(); defer executable.deinit();
// prepare an input buffer // prepare an input buffer