Update tutorial documentation in write_first_model.md with quick fixes.
This commit is contained in:
parent
737f7cbdee
commit
46fbbf43a2
@ -154,7 +154,7 @@ like this:
|
|||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
defer _ = gpa.deinit();
|
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));
|
try buffers.put(arena, "bias", zml.HostBuffer.fromArray(&bias));
|
||||||
|
|
||||||
// the actual BufferStore
|
// the actual BufferStore
|
||||||
var bs: zml.aio.BufferStore = .{
|
const bs: zml.aio.BufferStore = .{
|
||||||
.arena = arena_state,
|
.arena = arena_state,
|
||||||
.buffers = buffers,
|
.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.
|
// The shape of the input tensor, we have to pass in manually.
|
||||||
var compilation = try asyncc(
|
var compilation = try asyncc(
|
||||||
zml.compileModel,
|
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.
|
// Produce a bufferized weights struct from the fake BufferStore.
|
||||||
@ -440,7 +440,7 @@ const Layer = struct {
|
|||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
defer _ = gpa.deinit();
|
defer _ = gpa.deinit();
|
||||||
try asynk.AsyncThread.main(gpa.allocator(), asyncMain, .{});
|
try asynk.AsyncThread.main(gpa.allocator(), asyncMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn asyncMain() !void {
|
pub fn asyncMain() !void {
|
||||||
@ -483,10 +483,7 @@ pub fn asyncMain() !void {
|
|||||||
|
|
||||||
// Start compiling. This uses the inferred shapes from the BufferStore.
|
// Start compiling. This uses the inferred shapes from the BufferStore.
|
||||||
// The shape of the input tensor, we have to pass in manually.
|
// The shape of the input tensor, we have to pass in manually.
|
||||||
var compilation = try asyncc(
|
var compilation = try asyncc(zml.compileModel, .{ allocator, Layer.forward, model_shapes, .{input_shape}, platform });
|
||||||
zml.compileModel,
|
|
||||||
.{ allocator, model_shapes, .forward, .{input_shape}, platform },
|
|
||||||
);
|
|
||||||
|
|
||||||
// Produce a bufferized weights struct from the fake BufferStore.
|
// Produce a bufferized weights struct from the fake BufferStore.
|
||||||
// This is like the inferred shapes, but with actual values.
|
// This is like the inferred shapes, but with actual values.
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
||||||
exec bazel run --config=silent @zml//third_party/zls:zig -- "${@}"
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
||||||
exec bazel run --config=silent @zml//third_party/zls:zls -- zig "${@}"
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"build_options": [
|
|
||||||
{
|
|
||||||
"name": "cmd",
|
|
||||||
"value": "bazel run @zml//:completion"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user