Update docs and example BUILD files to reflect the switch from zig_cc_binary to zig_binary.
This commit is contained in:
parent
cf00506dbb
commit
a512b9c8a2
@ -41,9 +41,9 @@ use their rules to define our 5 additional targets:
|
||||
load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar")
|
||||
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
|
||||
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push")
|
||||
load("@zml//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "simple_layer",
|
||||
main = "main.zig",
|
||||
deps = [
|
||||
@ -248,10 +248,10 @@ load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
|
||||
load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar")
|
||||
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
|
||||
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push")
|
||||
load("@zml//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
# The executable
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "mnist",
|
||||
args = [
|
||||
"$(location @com_github_ggerganov_ggml_mnist//file)",
|
||||
|
||||
@ -150,9 +150,9 @@ pub fn asyncMain() !void {
|
||||
And add a `zig_cc_binary` target in `my_project/BUILD.bazel`:
|
||||
|
||||
```python
|
||||
load("@zml//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "torch2zml",
|
||||
main = "torch2zml.zig",
|
||||
deps = [
|
||||
@ -246,7 +246,7 @@ We can test the MLP layer with the `zml.testing.testLayer` utility:
|
||||
```zig
|
||||
pub fn asyncMain() !void {
|
||||
...
|
||||
|
||||
|
||||
var ctx = try zml.Context.init();
|
||||
defer ctx.deinit();
|
||||
const platform = ctx.autoPlatform(.{});
|
||||
@ -293,5 +293,5 @@ During this phase, you have three kinds of errors that can appear:
|
||||
"C,W,H" of tensors, you can port this to actual tensor attributes using
|
||||
`x.withTags(.{.c, .w, .h})`, and use those tags (eg `.c`) to refer to axes
|
||||
instead of offsets. E.g. in Pytorch: `x.sum(0) # reduce over channel axis`
|
||||
becomes `x.sum(.c)`. More on this topic in
|
||||
becomes `x.sum(.c)`. More on this topic in
|
||||
["Working with tensors"](../tutorials/working_with_tensors.md).
|
||||
|
||||
@ -352,9 +352,9 @@ As mentioned already, ZML uses Bazel; so to build our model, we just need to
|
||||
create a simple `BUILD.bazel` file, next to the `main.zig` file, like this:
|
||||
|
||||
```python
|
||||
load("@zml//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "simple_layer",
|
||||
main = "main.zig",
|
||||
deps = [
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load("//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "benchmark",
|
||||
main = "main.zig",
|
||||
deps = [
|
||||
|
||||
@ -2,9 +2,9 @@ load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar")
|
||||
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
|
||||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push")
|
||||
load("//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "llama",
|
||||
srcs = [
|
||||
"llama.zig",
|
||||
@ -18,9 +18,9 @@ zig_cc_binary(
|
||||
],
|
||||
)
|
||||
|
||||
# TODO(steeve): Re-enable when rules_zig linkmode is fixed.
|
||||
# TODO(steeve): Re-enable with a small, tokenless huggingface model.
|
||||
#
|
||||
# zig_cc_binary(
|
||||
# zig_test(
|
||||
# name = "test-implementation",
|
||||
# srcs = ["llama.zig"],
|
||||
# args = [
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load("//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "mnist",
|
||||
args = [
|
||||
"$(location @mnist//:mnist.pt)",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load("//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "modernbert",
|
||||
srcs = ["modernbert.zig"],
|
||||
args = [
|
||||
|
||||
@ -2,9 +2,9 @@ load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar")
|
||||
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
|
||||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push")
|
||||
load("//bazel:zig.bzl", "zig_cc_binary")
|
||||
load("@rules_zig//zig:defs.bzl", "zig_binary")
|
||||
|
||||
zig_cc_binary(
|
||||
zig_binary(
|
||||
name = "simple_layer",
|
||||
main = "main.zig",
|
||||
deps = [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user