crucible v0.1: CPU inference library for PyTorch .pt state dicts, in pure Zig
- restricted pickle VM (whitelisted globals — cannot execute arbitrary Python, unlike torch.load) - zip container reader (store + raw-deflate) - Tensor views: dtype/offset/sizes/strides, f32 materialization - layers: conv2d f32x8 FMA, linear, relu, maxpool2, adaptiveAvgPool2d, softmax, padInput - examples/stripsolver: real .pt forward, 3777 @ 1.0 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
This commit is contained in:
commit
d401f6b07e
11 files changed
+1228
No files matched your search
@@ -0,0 +1,49 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
// The library module — what downstream consumers import.
|
||||
const crucible_mod = b.addModule("crucible", .{
|
||||
.root_source_file = b.path("src/crucible.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// Static lib artifact (optional install).
|
||||
const lib = b.addLibrary(.{
|
||||
.name = "crucible",
|
||||
.root_module = crucible_mod,
|
||||
});
|
||||
b.installArtifact(lib);
|
||||
|
||||
// Example executable: stripsolver (needs a tests/ png decoder? no —
|
||||
// example is self-contained: it uses crucible only for state dict +
|
||||
// layers; arm input comes from CSV).
|
||||
const example_mod = b.createModule(.{
|
||||
.root_source_file = b.path("examples/stripsolver.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.imports = &.{
|
||||
.{ .name = "crucible", .module = crucible_mod },
|
||||
},
|
||||
});
|
||||
const example = b.addExecutable(.{
|
||||
.name = "stripsolver",
|
||||
.root_module = example_mod,
|
||||
});
|
||||
b.installArtifact(example);
|
||||
|
||||
const run_example = b.addRunArtifact(example);
|
||||
run_example.step.dependOn(b.getInstallStep());
|
||||
if (b.args) |args| run_example.addArgs(args);
|
||||
const run_step = b.step("run", "Run the stripsolver example");
|
||||
run_step.dependOn(&run_example.step);
|
||||
|
||||
// Unit tests.
|
||||
const tests = b.addTest(.{ .root_module = crucible_mod });
|
||||
const run_tests = b.addRunArtifact(tests);
|
||||
const test_step = b.step("test", "Run unit tests");
|
||||
test_step.dependOn(&run_tests.step);
|
||||
}
|
||||
Reference in new issue
Block a user