Repository navigation
feat: add Clover support - #31306
Open
Maphist0 wants to merge 2 commits into
Open
feat: add Clover support#31306Maphist0 wants to merge 2 commits into
Maphist0 wants to merge 2 commits into
Conversation
Port Clover conversion, metadata, loading and hybrid attention to upstream. Reuse the current QKV, MoE and recurrent-memory infrastructure.
Share anchor-and-mask block construction with DFlash and register draft-self in the same speculative framework. Add opt-in raw-logit entropy acceptance to the shared sampler for unconstrained temperature-zero decoding.
This branch has not been deployed
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.
Overview
Add support for DiffuSpace's Clover-35B-A3B-Preview, including GGUF conversion, loading and hybrid attention.
Following the DFlash #22105 and DFlash2 series (#27342, #27816), this adds another speculative decoding mode:
draft-self, for self-speculative generation through the existing speculative framework.The same model proposes masked blocks and verifies them causally. Block construction is shared with DFlash; no separate draft model is required.
The speculative example includes opt-in entropy-threshold acceptance for unconstrained temperature-zero decoding.
Additional information
Validated with BF16 CPU and H200 CUDA inference.
Validation:
CPU compile:
cmake -S source -B build-clover-cpu \ -DGGML_CUDA=OFF \ -DGGML_BLAS=OFF \ -DLLAMA_CURL=OFF \ -DLLAMA_BUILD_TESTS=OFF \ -DLLAMA_BUILD_SERVER=OFF \ -DCMAKE_BUILD_TYPE=Release cmake --build build-clover-cpu --target llama-speculative-simpleCUDA compile:
cmake -S source -B build-clover-cuda \ -DGGML_CUDA=ON \ -DCMAKE_CUDA_ARCHITECTURES=90a \ -DLLAMA_CURL=OFF \ -DLLAMA_BUILD_TESTS=OFF \ -DLLAMA_BUILD_SERVER=OFF \ -DCMAKE_BUILD_TYPE=Release cmake --build build-clover-cuda --target llama-speculative-simpleCkpt convert:
python source/convert_hf_to_gguf.py \ <clover_ckpt_path> \ --outtype bf16 \ --outfile clover-bf16.ggufThe example
llama-speculative-simpleprogram:build-clover-cuda/bin/llama-speculative-simple \ -m clover-bf16.gguf \ --spec-type draft-self \ --spec-draft-n-max 15 \ --spec-accept-ratio 0.9 \ --spec-accept-delta 0.6 \ -ctk bf16 -ctv bf16 \ -f explanation.prompt \ -n 64 -c 1024 -b 256 -ub 256 \ --temp 0 --top-k 1 --seed 42 \ -ngl 99 -t 8 -tb 8 --flash-attn on --color off // another example build-clover-cuda/bin/llama-speculative-simple \ -m clover-bf16.gguf \ -p "Here is a quick sort implementation in C++. Just code, no comments:\n\n#include" \ --spec-type draft-self \ --spec-draft-n-max 15 \ --color on \ --spec-accept-ratio 0.9 \ --spec-accept-delta 0.6 \ -ctk bf16 -ctv bf16 \ -n 256 --temp 0 --top-k 1 --seed 42 -ngl 99 -lv 4The current implementation generates around 32 tokens/s on an H200, with substantial room for improvement. Further performance optimizations are planned as separate PRs.
Requirements