Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to encode MLXArrays to .safetensors binary data in-memory #59

Open
grananqvist opened this issue Mar 11, 2025 · 1 comment
Open

Comments

@grananqvist
Copy link

for data transfer purposes it would be very useful to be able to encode [String:MLXArray] into .safetensors format in the form of in-memory binary data type Data.

e.g. in addition to a FileWriter in mlx core https://github.com/ml-explore/mlx/blob/fd0d63ba5b83da41d6a0e75a0bcb5d70ec93eb40/mlx/io/load.h#L109, we can have a reader and writer to a binary data buffer, and expose this to swift apis, or something similar.

The purpose look like this:

weights: [String: MLXArray]
let blob: Data = save(weights) 
// ... blob can be transfered over the network
let sameWeights = load(blob)
// weights and sameWeights should be equal
@davidkoski davidkoski transferred this issue from ml-explore/mlx-swift Mar 24, 2025
@davidkoski
Copy link
Collaborator

Moving to mlx-c first -- this requires exposing a load/save function in io.h that uses an in memory byte buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants