// Copyright © 2023-2024 Apple Inc. #pragma once #include #include #include #include #include #include #include #include #include #include "mlx/io.h" namespace nb = nanobind; using namespace mlx::core; using LoadOutputTypes = std::variant< array, std::unordered_map, SafetensorsLoad, GGUFLoad>; SafetensorsLoad mlx_load_safetensor_helper(nb::object file, StreamOrDevice s); void mlx_save_safetensor_helper( nb::object file, nb::dict d, std::optional m); GGUFLoad mlx_load_gguf_helper(nb::object file, StreamOrDevice s); void mlx_save_gguf_helper( nb::object file, nb::dict d, std::optional m); LoadOutputTypes mlx_load_helper( nb::object file, std::optional format, bool return_metadata, StreamOrDevice s); void mlx_save_helper(nb::object file, array a); void mlx_savez_helper( nb::object file, nb::args args, const nb::kwargs& kwargs, bool compressed = false);