Skip to content

Add eval, async_eval, and IO ops (load/save/safetensors/gguf)#589

Merged
sydneyrenee merged 1 commit intomainfrom
feature/eval-and-io
Mar 25, 2026
Merged

Add eval, async_eval, and IO ops (load/save/safetensors/gguf)#589
sydneyrenee merged 1 commit intomainfrom
feature/eval-and-io

Conversation

@sydneyrenee
Copy link
Copy Markdown
Contributor

Summary

  • eval/async_eval: Force or asynchronously evaluate lazy computation graphs. Accepts single arrays, multiple arrays, or arrays of arrays.
  • IO load/save: .npy single-array format roundtrip
  • Safetensors: save_safetensors/load with named tensor dicts and optional string metadata
  • GGUF: save_gguf/load with named tensor dicts and variant metadata

Build changes

  • Swapped IO stub files (no_safetensors.cpp, no_gguf.cpp) for real MLX implementations
  • Vendored nlohmann/json v3.11.3 (safetensors JSON parsing dependency)
  • Vendored gguf-tools at upstream pinned commit 8fa6eb6 (gguflib.c, fp16.c, bf16.h)

Issues addressed

Not included

Test plan

  • 10 new tests in batch5-ops.test.ts, all passing
  • Full suite: 230 passing, 9 pending (pre-existing)
  • eval: single array, multiple arrays, array-of-arrays, async_eval
  • npy: save + load roundtrip with shape/value verification
  • safetensors: save + load with multiple named tensors, metadata preservation
  • gguf: save + load roundtrip with shape verification
  • Error handling: non-existent files, invalid paths

eval/async_eval: Force or asynchronously evaluate lazy computation graphs.
Accepts single arrays, multiple arrays, or arrays of arrays.

IO: load/save for .npy single-array format, save_safetensors/load for
named tensor dicts with optional metadata, save_gguf/load for GGUF format.

Build changes: Enabled real safetensors and GGUF implementations by
swapping stub files for the actual MLX IO sources. Vendored nlohmann/json
(safetensors dependency) and gguf-tools (gguflib, fp16) at the commit
pinned by upstream MLX.
@sydneyrenee sydneyrenee merged commit df74b63 into main Mar 25, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant