From 9d69c13793c4c69c080ed4273bcd36ded69de2bb Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Wed, 3 Jun 2026 00:30:12 +0200 Subject: mlx: add opt-in 8-bit weight quantization --- pplx_embed_mlx.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pplx_embed_mlx.h') diff --git a/pplx_embed_mlx.h b/pplx_embed_mlx.h index 2b7164d..9b341e0 100644 --- a/pplx_embed_mlx.h +++ b/pplx_embed_mlx.h @@ -14,11 +14,18 @@ /* Opaque MLX model context */ typedef struct pplx_mlx_ctx pplx_mlx_ctx_t; +typedef struct { + int quantize_bits; /* 0 disables; currently 8 */ + int quantize_group_size; /* default 64 when quantize_bits is set */ +} pplx_mlx_options_t; + /* * Load model into MLX arrays from safetensors + config.json. * Returns NULL on error. */ pplx_mlx_ctx_t *pplx_mlx_load(const char *model_dir); +pplx_mlx_ctx_t *pplx_mlx_load_with_options(const char *model_dir, + const pplx_mlx_options_t *opts); /* * Load one contiguous transformer layer range for distributed execution. @@ -27,6 +34,9 @@ pplx_mlx_ctx_t *pplx_mlx_load(const char *model_dir); */ pplx_mlx_ctx_t *pplx_mlx_load_slice(const char *model_dir, int layer_start, int layer_end); +pplx_mlx_ctx_t *pplx_mlx_load_slice_with_options( + const char *model_dir, int layer_start, int layer_end, + const pplx_mlx_options_t *opts); void pplx_mlx_free(pplx_mlx_ctx_t *ctx); -- cgit v1.3.1