diff --git a/docs/howtos/dockerize_models.md b/docs/howtos/dockerize_models.md index af296f8..0d2d845 100644 --- a/docs/howtos/dockerize_models.md +++ b/docs/howtos/dockerize_models.md @@ -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)", diff --git a/docs/howtos/howto_torch2zml.md b/docs/howtos/howto_torch2zml.md index a5785f4..026e201 100644 --- a/docs/howtos/howto_torch2zml.md +++ b/docs/howtos/howto_torch2zml.md @@ -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). diff --git a/docs/tutorials/write_first_model.md b/docs/tutorials/write_first_model.md index e48cd7e..7cea735 100644 --- a/docs/tutorials/write_first_model.md +++ b/docs/tutorials/write_first_model.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 = [ diff --git a/examples/benchmark/BUILD.bazel b/examples/benchmark/BUILD.bazel index c4a0d01..ff55ed6 100644 --- a/examples/benchmark/BUILD.bazel +++ b/examples/benchmark/BUILD.bazel @@ -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 = [ diff --git a/examples/llama/BUILD.bazel b/examples/llama/BUILD.bazel index f6c29c9..6f4cd70 100644 --- a/examples/llama/BUILD.bazel +++ b/examples/llama/BUILD.bazel @@ -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 = [ diff --git a/examples/mnist/BUILD.bazel b/examples/mnist/BUILD.bazel index f8eeae3..dfc635b 100644 --- a/examples/mnist/BUILD.bazel +++ b/examples/mnist/BUILD.bazel @@ -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)", diff --git a/examples/modernbert/BUILD.bazel b/examples/modernbert/BUILD.bazel index 5f8291c..081127e 100644 --- a/examples/modernbert/BUILD.bazel +++ b/examples/modernbert/BUILD.bazel @@ -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 = [ diff --git a/examples/simple_layer/BUILD.bazel b/examples/simple_layer/BUILD.bazel index 9898839..b10b6da 100644 --- a/examples/simple_layer/BUILD.bazel +++ b/examples/simple_layer/BUILD.bazel @@ -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 = [