[Models] Support DeepSeek-V4 GGUF weights mapping and architecture fa… - #126
Open
DjoserKhemSimeu wants to merge 1 commit into
Open
[Models] Support DeepSeek-V4 GGUF weights mapping and architecture fa…#126DjoserKhemSimeu wants to merge 1 commit into
DjoserKhemSimeu wants to merge 1 commit into
Conversation
…llback - Map deepseek_v4 model_type to deepseek2 GGUF architecture name map in TransformersGGUFWeightsAdapter. - Support fallback to config.architectures in GGUFConfigParser when model_type is not directly in MODEL_FOR_CAUSAL_LM_MAPPING_NAMES. - Add unit test verifying GGUFConfigParser architecture fallback. Signed-off-by: DjoserKhemSimeu <djoser.simeu@gmail.com>
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
This PR adds GGUF weight mapping and configuration parsing support for DeepSeek-V4 architectures (such as
DeepSeek-V4-Flashcheckpoints).Motivation & Problem
When serving a DeepSeek-V4 GGUF checkpoint (e.g.,
bartowski/DeepSeek-V4-Flash-0731-GGUF), model initialization fails during weight name resolution with the following error:Root Causes
transformers.py, onlydeepseek_v2anddeepseek_v3were mapped to the internaldeepseek2GGUF architecture mapping.deepseek_v4was unhandled, causing a lookup failure ingguf.MODEL_ARCH_NAMES.config_parser.py, ifconfig.model_typewas not yet registered inside transformers'MODEL_FOR_CAUSAL_LM_MAPPING_NAMESand no custom adapter override was set, the parser failed withRuntimeError: Can't get gguf config for {config.model_type}instead of inspectingconfig.architecturesalready declared in the Hugging Face config.Technical Changes
GGUF Weights Adapter (
vllm_gguf_plugin/weights_adapter/transformers.py):Included
"deepseek_v4"alongside"deepseek_v3"and"deepseek_v2"to map to the"deepseek2"GGUF architecture.Set up MoE expert slicing (
gate_proj,up_proj,down_proj, ande_score_correction_bias).Config Parser Fallback (
vllm_gguf_plugin/config_parser.py):Added graceful fallback to
config.architectures[0]whenget_adapter_architecture(config)andMODEL_FOR_CAUSAL_LM_MAPPING_NAMESdo not have an explicit entry for new or custom causal LM model types.Tests (
tests/test_plugin.py):Added unit test
test_gguf_config_parser_fallback_to_config_architecturesto verify config parser fallback behavior for newly introduced model types with custom architectures.Verification & Testing
blk.{idx}.exp_probs_b.bias,blk.{idx}.ffn_{gate,up,down}_exps.weight).GGUFConfigParsertest suite passes and handles both canonical and custom architecture configs.Signed-off-by: DjoserKhemSimeu [djoser.simeu@gmail.com](mailto:djoser.simeu@gmail.com)