feat: add GGUF/GGML model worker using llama-cpp-python#3827
Open
crawfordxx wants to merge 1 commit intolm-sys:mainfrom
Open
feat: add GGUF/GGML model worker using llama-cpp-python#3827crawfordxx wants to merge 1 commit intolm-sys:mainfrom
crawfordxx wants to merge 1 commit intolm-sys:mainfrom
Conversation
Add a new model worker (gguf_worker.py) that loads quantized GGUF/GGML models via llama-cpp-python, enabling FastChat to serve locally quantized models with reduced memory requirements. The worker follows the same pattern as existing workers (mlx_worker, vllm_worker) and supports: - Streaming and non-streaming generation - Temperature, top_p, top_k, repeat_penalty parameters - GPU layer offloading via --n-gpu-layers - Configurable context length - Controller registration and heartbeat Closes lm-sys#2410
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.
Summary
Add a new model worker (
fastchat/serve/gguf_worker.py) that loads quantized GGUF/GGML models via llama-cpp-python, enabling FastChat to serve locally quantized models with reduced memory requirements.Closes #2410
Changes
GGUFWorkerclass extendingBaseModelWorker, following the same patterns asmlx_worker.pyandvllm_worker.pyllama-cpp-pythonis an optional dependency -- only imported when using the GGUF workertemperature,top_p,top_k,max_new_tokens,repeat_penalty,presence_penalty,frequency_penalty--n-gpu-layers(set to-1to offload all layers)--context-lenUsage
Test plan
llama-cpp-pythonand download a small GGUF modelgguf_workerpointing at the model/list_models)/worker_generate_stream/worker_generate--n-gpu-layers -1for GPU offloading