Update tutorial documentation in write_first_model.md with quick fixes.

This commit is contained in:
Foke Singh 2023-11-30 12:14:33 +00:00
parent 737f7cbdee
commit 46fbbf43a2
4 changed files with 5 additions and 22 deletions

View File

@ -154,7 +154,7 @@ like this:
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
try asynk.AsyncThread.main(gpa.allocator(), asyncMain, .{});
try asynk.AsyncThread.main(gpa.allocator(), asyncMain);
}
@ -222,7 +222,7 @@ try buffers.put(arena, "weight", zml.HostBuffer.fromArray(&weights));
try buffers.put(arena, "bias", zml.HostBuffer.fromArray(&bias));
// the actual BufferStore
var bs: zml.aio.BufferStore = .{
const bs: zml.aio.BufferStore = .{
.arena = arena_state,
.buffers = buffers,
};
@ -253,7 +253,7 @@ const model_shapes = try zml.aio.populateModel(Layer, allocator, bs);
// The shape of the input tensor, we have to pass in manually.
var compilation = try asyncc(
zml.compileModel,
.{ allocator, model_shapes, .forward, .{input_shape}, platform },
.{ allocator, Layer.forward, model_shapes, .{input_shape}, platform },
);
// Produce a bufferized weights struct from the fake BufferStore.
@ -440,7 +440,7 @@ const Layer = struct {
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
try asynk.AsyncThread.main(gpa.allocator(), asyncMain, .{});
try asynk.AsyncThread.main(gpa.allocator(), asyncMain);
}
pub fn asyncMain() !void {
@ -483,10 +483,7 @@ pub fn asyncMain() !void {
// Start compiling. This uses the inferred shapes from the BufferStore.
// The shape of the input tensor, we have to pass in manually.
var compilation = try asyncc(
zml.compileModel,
.{ allocator, model_shapes, .forward, .{input_shape}, platform },
);
var compilation = try asyncc(zml.compileModel, .{ allocator, Layer.forward, model_shapes, .{input_shape}, platform });
// Produce a bufferized weights struct from the fake BufferStore.
// This is like the inferred shapes, but with actual values.

View File

@ -1,3 +0,0 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
exec bazel run --config=silent @zml//third_party/zls:zig -- "${@}"

View File

@ -1,3 +0,0 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
exec bazel run --config=silent @zml//third_party/zls:zls -- zig "${@}"

View File

@ -1,8 +0,0 @@
{
"build_options": [
{
"name": "cmd",
"value": "bazel run @zml//:completion"
}
]
}