Open
Conversation
- Introduced kv_bits, kv_group_size, and quantized_kv_start parameters for improved sampling control. - Enhanced stream_generate function calls in both models to utilize new quantization settings.
- Added kv_bits, kv_group_size, and quantized_kv_start parameters to enhance KV cache quantization. - Updated initialization and request handling to incorporate new quantization settings for both models.
- Added CLI options for kv_bits, kv_group_size, and quantized_kv_start to enhance user control over KV cache quantization. - Updated MLXServerConfig and ModelEntryConfig to include new parameters and validation for model type compatibility. - Modified server handler to incorporate quantization settings during model configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: add KV cache quantization support for LM and multimodal models
Closes #276
Summary
--kv-bits,--kv-group-size, and--quantized-kv-startCLI options and YAML config fields to enable KV cache quantization (including TurboQuant) forlmandmultimodalmodel typesgenerate_stepin bothmlx-lmandmlx-vlmUsage
CLI
YAML config
Changed files
app/cli.py— New--kv-bits,--kv-group-size,--quantized-kv-startCLI optionsapp/config.py— New fields onMLXServerConfigandModelEntryConfigwith validationapp/server.py— Pass KV params to LM and VLM handler constructorsapp/handler/mlx_lm.py— Accept, store, and include KV params in model_paramsapp/handler/mlx_vlm.py— Accept, store, and include KV params in model_paramsapp/models/mlx_lm.py— Forward KV params tostream_generateapp/models/mlx_vlm.py— Forward KV params tostream_generate